Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,7 @@
{
"presets": ["es2015", "stage-0"],
"plugins": [
"transform-es3-member-expression-literals",
"transform-es3-property-literals"
]
}

View File

@@ -0,0 +1,4 @@
{
"parser": "babel-eslint",
"extends": "eslint-config-jss"
}

View File

@@ -0,0 +1,4 @@
src
bench
coverage
tmp

View File

@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2014-present Oleg Slobodskoi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,52 @@
## 5.0.0 / 2017-06-20
- update to jss 8
## 4.0.0 / 2017-04-10
- update to jss 7.0
## 3.0.0 / 2016-12-09
- remove dep to named option
- update to jss 6.0
## 2.0.2 / 2016-11-17
- fix sort for ms edge
## 2.0.1 / 2016-11-05
- migrate tests
## 2.0.0 / 2016-08-01
- update to jss 5
- update dev deps
## 1.0.2 / 2015-04-16
- handle only regular rules
## 1.0.1 / 2015-03-24
- update babel deps
## 1.0.0 / 2015-10-19
- support jss 3.0
- now plugin needs to be called like a middleware
## 0.2.0 / 2015-09-21
- migrate to es6
- move examples to jss-examples repository
- simplify packaging
## 0.1.1 / 2015-09-08
- update jss dependency
## 0.1.0 / 2014-07-19
- first release

View File

@@ -0,0 +1,89 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["jssPropsSort"] = factory();
else
root["jssPropsSort"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = jssPropsSort;
/**
* Sort props by length.
*/
function jssPropsSort() {
function sort(prop0, prop1) {
return prop0.length - prop1.length;
}
function onProcessStyle(style, rule) {
if (rule.type !== 'style') return style;
var newStyle = {};
var props = Object.keys(style).sort(sort);
for (var prop in props) {
newStyle[props[prop]] = style[props[prop]];
}
return newStyle;
}
return { onProcessStyle: onProcessStyle };
}
/***/ }
/******/ ])
});
;
//# sourceMappingURL=jss-props-sort.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 5218a99c788b3233028d","webpack:///./src/index.js"],"names":["jssPropsSort","sort","prop0","prop1","length","onProcessStyle","style","rule","type","newStyle","props","Object","keys","prop"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;sBCnCwBA,Y;AAHxB;;;AAGe,UAASA,YAAT,GAAwB;AACrC,YAASC,IAAT,CAAcC,KAAd,EAAqBC,KAArB,EAA4B;AAC1B,YAAOD,MAAME,MAAN,GAAeD,MAAMC,MAA5B;AACD;;AAED,YAASC,cAAT,CAAwBC,KAAxB,EAA+BC,IAA/B,EAAqC;AACnC,SAAIA,KAAKC,IAAL,KAAc,OAAlB,EAA2B,OAAOF,KAAP;;AAE3B,SAAMG,WAAW,EAAjB;AACA,SAAMC,QAAQC,OAAOC,IAAP,CAAYN,KAAZ,EAAmBL,IAAnB,CAAwBA,IAAxB,CAAd;AACA,UAAK,IAAMY,IAAX,IAAmBH,KAAnB,EAA0B;AACxBD,gBAASC,MAAMG,IAAN,CAAT,IAAwBP,MAAMI,MAAMG,IAAN,CAAN,CAAxB;AACD;AACD,YAAOJ,QAAP;AACD;;AAED,UAAO,EAACJ,8BAAD,EAAP;AACD,E","file":"jss-props-sort.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"jssPropsSort\"] = factory();\n\telse\n\t\troot[\"jssPropsSort\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 5218a99c788b3233028d","/**\n * Sort props by length.\n */\nexport default function jssPropsSort() {\n function sort(prop0, prop1) {\n return prop0.length - prop1.length\n }\n\n function onProcessStyle(style, rule) {\n if (rule.type !== 'style') return style\n\n const newStyle = {}\n const props = Object.keys(style).sort(sort)\n for (const prop in props) {\n newStyle[props[prop]] = style[props[prop]]\n }\n return newStyle\n }\n\n return {onProcessStyle}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js"],"sourceRoot":""}

View File

@@ -0,0 +1,2 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jssPropsSort=t():e.jssPropsSort=t()}(this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t){"use strict";function o(){function e(e,t){return e.length-t.length}function t(t,o){if("style"!==o.type)return t;var r={},n=Object.keys(t).sort(e);for(var s in n)r[n[s]]=t[n[s]];return r}return{onProcessStyle:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o}])});
//# sourceMappingURL=jss-props-sort.min.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
const webpackConfig = require('./webpack.config')
module.exports = (config) => {
config.set({
browsers: ['Chrome'],
frameworks: ['mocha'],
files: ['tests.webpack.js'],
preprocessors: {
'tests.webpack.js': ['webpack', 'sourcemap']
},
webpack: Object.assign(webpackConfig, {
devtool: 'inline-source-map'
}),
webpackServer: {
noInfo: true
},
reporters: ['mocha', 'coverage'],
coverageReporter: {
dir: 'coverage',
file: 'coverage.json',
type: 'json'
}
})
}

View File

@@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = jssPropsSort;
/**
* Sort props by length.
*/
function jssPropsSort() {
function sort(prop0, prop1) {
return prop0.length - prop1.length;
}
function onProcessStyle(style, rule) {
if (rule.type !== 'style') return style;
var newStyle = {};
var props = Object.keys(style).sort(sort);
for (var prop in props) {
newStyle[props[prop]] = style[props[prop]];
}
return newStyle;
}
return { onProcessStyle: onProcessStyle };
}

View File

@@ -0,0 +1,88 @@
'use strict';
var _expect = require('expect.js');
var _expect2 = _interopRequireDefault(_expect);
var _jss = require('jss');
var _index = require('./index');
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var settings = {
createGenerateClassName: function createGenerateClassName() {
return function (rule) {
return rule.key + '-id';
};
}
};
describe('jss-props-sort', function () {
var jss = void 0;
beforeEach(function () {
jss = (0, _jss.create)(settings).use((0, _index2['default'])());
});
describe('sort props by length', function () {
var sheet = void 0;
beforeEach(function () {
sheet = jss.createStyleSheet({
a: {
'border-left': '1px',
border: '3px'
}
});
});
it('should have a rule', function () {
(0, _expect2['default'])(sheet.getRule('a')).to.not.be(undefined);
});
it('should generate correct CSS', function () {
(0, _expect2['default'])(sheet.toString()).to.be('.a-id {\n border: 3px;\n border-left: 1px;\n}');
});
});
describe('leave non-style rules unchanged', function () {
describe('@font-face', function () {
var sheet = void 0;
beforeEach(function () {
sheet = jss.createStyleSheet({
'@font-face': {
'font-family': 'MyHelvetica',
src: 'local("Helvetica")'
}
});
});
it('should generate correct CSS', function () {
(0, _expect2['default'])(sheet.toString()).to.be('@font-face {\n font-family: MyHelvetica;\n src: local("Helvetica");\n}');
});
});
describe('@media', function () {
var sheet = void 0;
beforeEach(function () {
sheet = jss.createStyleSheet({
'@media print': {
a: {
'border-left': '1px',
border: '3px'
}
}
});
});
it('should generate correct CSS', function () {
(0, _expect2['default'])(sheet.toString()).to.be('@media print {\n .a-id {\n border: 3px;\n border-left: 1px;\n }\n}');
});
});
});
});

View File

@@ -0,0 +1,119 @@
{
"_args": [
[
"jss-props-sort@5.0.0",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "jss-props-sort@5.0.0",
"_id": "jss-props-sort@5.0.0",
"_inBundle": false,
"_integrity": "sha512-xtoVE7BlcPaMN/dzypHPYJn+QiphLPB1skypAOp9zLkOozPbR/x0JVAFdZnd7zqmmjvg+Ma/txjSg0HN/eZsGA==",
"_location": "/material-ui/jss-props-sort",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "jss-props-sort@5.0.0",
"name": "jss-props-sort",
"escapedName": "jss-props-sort",
"rawSpec": "5.0.0",
"saveSpec": null,
"fetchSpec": "5.0.0"
},
"_requiredBy": [
"/material-ui/jss-preset-default"
],
"_resolved": "https://registry.npmjs.org/jss-props-sort/-/jss-props-sort-5.0.0.tgz",
"_spec": "5.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Oleg Slobodskoi",
"email": "oleg008@gmail.com"
},
"bugs": {
"url": "https://github.com/cssinjs/jss-props-sort/issues"
},
"description": "JSS plugin that ensures style properties extend each other instead of override",
"devDependencies": {
"babel-cli": "^6.5.1",
"babel-core": "^6.5.1",
"babel-eslint": "^7.1.0",
"babel-loader": "^6.2.4",
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
"babel-plugin-transform-es3-property-literals": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"cross-env": "^3.1.3",
"es5-shim": "^4.5.9",
"eslint": "^3.9.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-config-jss": "^2.4.0",
"eslint-plugin-import": "^2.1.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.5.0",
"expect.js": "^0.3.1",
"jss": "^8.0.0",
"karma": "^1.1.1",
"karma-benchmark": "^0.6.0",
"karma-benchmark-reporter": "^0.1.1",
"karma-browserstack-launcher": "^1.0.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"lint-staged": "^3.0.3",
"mocha": "^3.0.2",
"pre-commit": "^1.1.3",
"rimraf": "^2.5.4",
"webpack": "^1.13.1"
},
"engines": {},
"homepage": "https://github.com/cssinjs/jss-props-sort#readme",
"keywords": [
"cssinjs",
"css-in-js",
"css in js",
"jss",
"plugin",
"sort",
"props"
],
"license": "MIT",
"lint-staged": {
"./src/*.js": [
"eslint",
"git add"
]
},
"main": "lib/index.js",
"name": "jss-props-sort",
"peerDependencies": {
"jss": "^8.0.0"
},
"pre-commit": "lint:staged",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/cssinjs/jss-props-sort.git"
},
"scripts": {
"all": "npm run lint && npm run test && npm run build",
"build": "npm run clean && npm run build:lib && npm run build:tests && npm run build:dist",
"build:dist": "npm run build:dist:max && npm run build:dist:min",
"build:dist:max": "cross-env NODE_ENV=development webpack src/index.js dist/jss-props-sort.js",
"build:dist:min": "cross-env NODE_ENV=production webpack src/index.js dist/jss-props-sort.min.js",
"build:lib": "babel src --out-dir lib",
"build:tests": "npm run build:tests:lib && npm run build:tests:local",
"build:tests:lib": "cross-env NODE_ENV=test babel src --out-dir tests",
"build:tests:local": "cross-env NODE_ENV=test webpack src/index.test.js tmp/tests.js",
"clean": "rimraf {lib,dist,tests,tmp}/*",
"lint": "eslint ./src",
"lint:staged": "lint-staged",
"prepublish": "npm run all",
"test": "cross-env NODE_ENV=test karma start --single-run ",
"test:watch": "cross-env NODE_ENV=test karma start"
},
"version": "5.0.0"
}

View File

@@ -0,0 +1,41 @@
# JSS plugin that ensures style properties extend each other instead of override
[![Gitter](https://badges.gitter.im/JoinChat.svg)](https://gitter.im/cssinjs/lobby)
Inspired by React Native. When using this plugin,
more specific properties will not be overwritten by less specific.
## Usage example
```javascript
const styles = {
container: {
'border-left': '1px solid red',
border: '3px solid green'
}
})
```
Compiles to:
```css
.jss-jkh4234 {
border: 3px solid green;
border-left: 1px solid red;
}
```
## Demo
[Simple](http://cssinjs.github.io/examples/plugins/jss-props-sort/simple/index.html)
## Run tests
```bash
npm i
npm run test
```
## License
MIT

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>JSS Tests</title>
<link href="./node_modules/mocha/mocha.css" rel="stylesheet" />
</head>
<body>
<div id="mocha"></div>
<script src="./node_modules/es5-shim/es5-shim.js"></script>
<script src="./node_modules/mocha/mocha.js"></script>
<script>mocha.setup('bdd')</script>
<script src="tmp/tests.js"></script>
<script>
mocha.checkLeaks();
mocha.run();
</script>
</body>
</html>

View File

@@ -0,0 +1,2 @@
var context = require.context('./src', true, /\.test\.js$/)
context.keys().forEach(context)

View File

@@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = jssPropsSort;
/**
* Sort props by length.
*/
function jssPropsSort() {
function sort(prop0, prop1) {
return prop0.length - prop1.length;
}
function onProcessStyle(style, rule) {
if (rule.type !== 'style') return style;
var newStyle = {};
var props = Object.keys(style).sort(sort);
for (var prop in props) {
newStyle[props[prop]] = style[props[prop]];
}
return newStyle;
}
return { onProcessStyle: onProcessStyle };
}

View File

@@ -0,0 +1,88 @@
'use strict';
var _expect = require('expect.js');
var _expect2 = _interopRequireDefault(_expect);
var _jss = require('jss');
var _index = require('./index');
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var settings = {
createGenerateClassName: function createGenerateClassName() {
return function (rule) {
return rule.key + '-id';
};
}
};
describe('jss-props-sort', function () {
var jss = void 0;
beforeEach(function () {
jss = (0, _jss.create)(settings).use((0, _index2['default'])());
});
describe('sort props by length', function () {
var sheet = void 0;
beforeEach(function () {
sheet = jss.createStyleSheet({
a: {
'border-left': '1px',
border: '3px'
}
});
});
it('should have a rule', function () {
(0, _expect2['default'])(sheet.getRule('a')).to.not.be(undefined);
});
it('should generate correct CSS', function () {
(0, _expect2['default'])(sheet.toString()).to.be('.a-id {\n border: 3px;\n border-left: 1px;\n}');
});
});
describe('leave non-style rules unchanged', function () {
describe('@font-face', function () {
var sheet = void 0;
beforeEach(function () {
sheet = jss.createStyleSheet({
'@font-face': {
'font-family': 'MyHelvetica',
src: 'local("Helvetica")'
}
});
});
it('should generate correct CSS', function () {
(0, _expect2['default'])(sheet.toString()).to.be('@font-face {\n font-family: MyHelvetica;\n src: local("Helvetica");\n}');
});
});
describe('@media', function () {
var sheet = void 0;
beforeEach(function () {
sheet = jss.createStyleSheet({
'@media print': {
a: {
'border-left': '1px',
border: '3px'
}
}
});
});
it('should generate correct CSS', function () {
(0, _expect2['default'])(sheet.toString()).to.be('@media print {\n .a-id {\n border: 3px;\n border-left: 1px;\n }\n}');
});
});
});
});

View File

@@ -0,0 +1,42 @@
'use strict'
const webpack = require('webpack')
const env = process.env.NODE_ENV
const isDev = env === 'development'
const isTest = env === 'test'
const isProd = env === 'production'
const plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env),
__DEV__: isDev,
__TEST__: isTest
})
]
if (isProd) {
plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}))
}
module.exports = {
output: {
library: 'jssPropsSort',
libraryTarget: 'umd'
},
plugins,
module: {
loaders: [
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}
]
},
devtool: 'source-map'
}