jstransformer-css
Advanced tools
+15
| ## v0.2.0 / April 10, 2015 | ||
| - publish v0.2.0 to npm | ||
| - refactor, template cruft, close #1 | ||
| ## v0.1.1 / April 3, 2015 | ||
| - publish v0.1.1 to npm | ||
| - fix typos | ||
| ## v0.1.0 / April 3, 2015 | ||
| - publish v0.1.0 to npm | ||
| ## v0.0.0 / April 3, 2015 | ||
| - first commits / publish v0.0.0 to npm |
+22
| Copyright (c) 2015 [Charlike Make Reagent](http://j.mp/1stW47C), contributors | ||
| 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. |
+72
| ## [![npm][npmjs-img]][npmjs-url] [![mit license][license-img]][license-url] [![build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![deps status][daviddm-img]][daviddm-url] | ||
| > Transform CSS to JSON AST using [reworkcss/css](https://github.com/reworkcss/css). | ||
| ## Install | ||
| ``` | ||
| npm i --save jstransformer-css | ||
| npm test | ||
| ``` | ||
| ## Usage | ||
| > For more use-cases see the [tests](./test/index.js) | ||
| ```js | ||
| var css = require('jstransformer-css'); | ||
| css.render('body {\n font-size: 12px;\n}'); | ||
| //=> json abstract syntax tree | ||
| ``` | ||
| ## Related | ||
| - [blink](http://blinkjs.github.io/blink): Blink converts Node.js modules into CSS and provides a CSS Authoring Framework, with BEM support. | ||
| - [absurd](http://absurdjs.com/): JavaScript library with superpowers - http://absurdjs.com/ | ||
| - [css](https://github.com/reworkcss/css): CSS parser / stringifier | ||
| - [rework](https://github.com/reworkcss/rework): Plugin framework for CSS preprocessing | ||
| - [gonzales](http://github.com/css/gonzales): Gonzales — fast CSS parser | ||
| - [postcss](https://github.com/postcss/postcss): Tool for transforming CSS with JS plugins | ||
| - [cssp](http://github.com/css/cssp): CSSP — Ometa-JS based CSS parser | ||
| - [cssom](https://github.com/NV/CSSOM): CSS Object Model implementation and CSS parser | ||
| ## Related | ||
| - [jstransformer](https://github.com/jstransformers/jstransformer): Normalize the API of any jstransformer | ||
| - [jstransformer-myth](https://github.com/jstransformers/jstransformer-myth): Myth support for JS Transformers | ||
| - [jstransformer-styl](https://github.com/jstransformers/jstransformer-styl): JSTransformer support for styl. | ||
| - [jstransformer-stylus](https://github.com/jstransformers/jstransformer-stylus): Transform stylus into css | ||
| - [jstransformer-rework](https://github.com/jstransformers/jstransformer-rework): ReworkCSS support for JS Transformers. CSS to CSS transformation. | ||
| ## License [![MIT license][license-img]][license-url] | ||
| Copyright (c) 2015 [JSTransformers][jstransformers-url], [Charlike Mike Reagent][contrib-more], [contributors][contrib-graf]. | ||
| Released under the [`MIT`][license-url] license. | ||
| [jstransformers-url]: https://github.com/jstransformers | ||
| [npmjs-url]: http://npm.im/jstransformer-css | ||
| [npmjs-img]: https://img.shields.io/npm/v/jstransformer-css.svg?style=flat&label=jstransformer-css | ||
| [coveralls-url]: https://coveralls.io/r/jstransformers/jstransformer-css?branch=master | ||
| [coveralls-img]: https://img.shields.io/coveralls/jstransformers/jstransformer-css.svg?style=flat | ||
| [license-url]: https://github.com/jstransformers/jstransformer-css/blob/master/LICENSE.md | ||
| [license-img]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat | ||
| [travis-url]: https://travis-ci.org/jstransformers/jstransformer-css | ||
| [travis-img]: https://img.shields.io/travis/jstransformers/jstransformer-css.svg?style=flat | ||
| [daviddm-url]: https://david-dm.org/jstransformers/jstransformer-css | ||
| [daviddm-img]: https://img.shields.io/david/jstransformers/jstransformer-css.svg?style=flat | ||
| [author-gratipay]: https://gratipay.com/tunnckoCore | ||
| [author-twitter]: https://twitter.com/tunnckoCore | ||
| [author-github]: https://github.com/tunnckoCore | ||
| [author-npmjs]: https://npmjs.org/~tunnckocore | ||
| [contrib-more]: http://j.mp/1stW47C | ||
| [contrib-graf]: https://github.com/jstransformers/jstransformer-css/graphs/contributors | ||
| *** | ||
| _Proudly generated by [docks(1)](https://github.com/tunnckoCore), April 10, 2015_ |
| {"type":"stylesheet","stylesheet":{"rules":[{"type":"rule","selectors":["body"],"declarations":[{"type":"declaration","property":"background","value":"#eee","position":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}},{"type":"declaration","property":"color","value":"#888","position":{"start":{"line":1,"column":26},"end":{"line":1,"column":37}}}],"position":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}}],"parsingErrors":[]}} |
| /** | ||
| * jstransformer-css <https://github.com/jstransformers/jstransformer-css> | ||
| * | ||
| * Copyright (c) 2015 Charlike Mike Reagent, contributors. | ||
| * Released under the MIT license. | ||
| */ | ||
| 'use strict'; | ||
| var fs = require('fs'); | ||
| var css = require('css'); | ||
| var test = require('assertit'); | ||
| var transform = require('../index'); | ||
| test('jstransformer-css', function(done) { | ||
| var json = transform.render('body { background: #eee; color: #888; }'); | ||
| test.deepEqual(json, fs.readFileSync('./test/expected.json', 'utf8')); | ||
| done(); | ||
| }); | ||
| test('should support sourcemaps', function(done) { | ||
| var code = 'body {\n font-size: 12px;\n}'; | ||
| var ast = transform.render(code, {source: 'body.css'}); | ||
| var data = css.stringify(JSON.parse(ast), {sourcemap: true}); | ||
| test.equal(typeof data, 'object'); | ||
| test.equal(data.code, code); | ||
| test.deepEqual(data.map.sources, ['body.css']); | ||
| done(); | ||
| }); |
+0
-5
@@ -6,9 +6,4 @@ sudo: false | ||
| - "0.10" | ||
| - "0.11" | ||
| - "0.12" | ||
| matrix: | ||
| allow_failures: | ||
| - node_js: "0.10" | ||
| fast_finish: true | ||
| script: "npm run-script test-travis" | ||
| after_script: "npm install coveralls && cat ./coverage/lcov.info | coveralls" |
+8
-8
| { | ||
| "name": "jstransformer-css", | ||
| "version": "0.1.1", | ||
| "version": "0.2.0", | ||
| "description": "Transform CSS to JSON AST using `reworkcss/css`.", | ||
| "scripts": { | ||
| "lint": "jshint index.js && jscs index.js --reporter inline", | ||
| "test": "node test.js", | ||
| "test-cov": "istanbul cover test.js", | ||
| "test-travis": "istanbul cover test.js --report lcovonly" | ||
| "test": "node test", | ||
| "test-cov": "istanbul cover test", | ||
| "test-travis": "istanbul cover test --report lcovonly" | ||
| }, | ||
@@ -25,11 +25,11 @@ "author": { | ||
| "type": "MIT", | ||
| "url": "https://github.com/jstransformers/jstransformer-css/blob/master/license.md" | ||
| "url": "https://github.com/jstransformers/jstransformer-css/blob/master/LICENSE.md" | ||
| }, | ||
| "dependencies": { | ||
| "css": "^2.2.0" | ||
| "css": "~2.2.0" | ||
| }, | ||
| "devDependencies": { | ||
| "istanbul-harmony": "~0.3.1", | ||
| "testit": "~2.0.2" | ||
| "assertit": "^0.1.0", | ||
| "istanbul-harmony": "~0.3.1" | ||
| } | ||
| } |
| repo_token: Z6HA0iYQyCBPnDgoz0xQw26ScJHGPbvt2 |
| # .gitattributes <https://github.com/tunnckoCore/dotfiles> | ||
| # | ||
| # Copyright (c) 2015 Charlike Mike Reagent, contributors. | ||
| # Released under the MIT license. | ||
| # | ||
| # These settings are for any web project | ||
| # Handle line endings automatically for files detected as text | ||
| # and leave all files detected as binary untouched. | ||
| * text=auto | ||
| # | ||
| # The above will handle all files NOT found below | ||
| # These files are text and should be normalized (Convert crlf => lf) | ||
| # | ||
| *.php text | ||
| *.css text | ||
| *.js text | ||
| *.htm text | ||
| *.html text | ||
| *.xml text | ||
| *.txt text | ||
| *.ini text | ||
| *.inc text | ||
| .htaccess text | ||
| # | ||
| # These files are binary and should be left untouched | ||
| # (binary is a macro for -text -diff) | ||
| # | ||
| *.png binary | ||
| *.jpg binary | ||
| *.jpeg binary | ||
| *.gif binary | ||
| *.ico binary | ||
| *.mov binary | ||
| *.mp4 binary | ||
| *.mp3 binary | ||
| *.flv binary | ||
| *.fla binary | ||
| *.swf binary | ||
| *.gz binary | ||
| *.zip binary | ||
| *.7z binary | ||
| *.ttf binary |
-116
| { | ||
| "fileExtensions": [".js"], | ||
| "maxErrors": 10, | ||
| "esnext": true, | ||
| "safeContextKeyword": ["self", "_this", "that"], | ||
| "maximumLineLength": { | ||
| "value": 80, | ||
| "allowUrlComments": true, | ||
| "allowComments": true, | ||
| "allowRegex": true | ||
| }, | ||
| "validateQuoteMarks": "'", | ||
| "validateIndentation": 2, | ||
| "requireCurlyBraces": [ | ||
| "if", | ||
| "else", | ||
| "for", | ||
| "while", | ||
| "do", | ||
| "try", | ||
| "catch" | ||
| ], | ||
| "requireSpaceAfterKeywords": [ | ||
| "if", | ||
| "else", | ||
| "for", | ||
| "while", | ||
| "do", | ||
| "switch", | ||
| "case", | ||
| "return", | ||
| "try", | ||
| "catch", | ||
| "typeof" | ||
| ], | ||
| "requireCamelCaseOrUpperCaseIdentifiers": true, | ||
| "requireSpacesInConditionalExpression": true, | ||
| "requireSpaceBeforeBlockStatements": true, | ||
| "requireSpaceBeforeBinaryOperators": true, | ||
| "requireOperatorBeforeLineBreak": true, | ||
| "requireCapitalizedConstructors": true, | ||
| "requireParenthesesAroundIIFE": true, | ||
| "requireCommaBeforeLineBreak": true, | ||
| "requireLineFeedAtFileEnd": true, | ||
| "requireDotNotation": true, | ||
| "disallowYodaConditions": true, | ||
| "disallowMultipleLineStrings": true, | ||
| "disallowMultipleLineBreaks": true, | ||
| "disallowMultipleVarDecl": true, | ||
| "disallowMixedSpacesAndTabs": true, | ||
| "disallowTrailingComma": true, | ||
| "disallowTrailingWhitespace": true, | ||
| "disallowSpaceAfterPrefixUnaryOperators": true, | ||
| "disallowSpacesInsideObjectBrackets": "all", | ||
| "disallowSpacesInsideParentheses": true, | ||
| "disallowSpacesInsideArrayBrackets": true, | ||
| "disallowNewlineBeforeBlockStatements": true, | ||
| "disallowSpaceBeforePostfixUnaryOperators": true, | ||
| "disallowImplicitTypeConversion": ["string"], | ||
| "disallowKeywords": ["with"], | ||
| "disallowKeywordsOnNewLine": ["else"], | ||
| "disallowSpacesInCallExpression": true, | ||
| "requireSpacesInFunctionExpression": { | ||
| "beforeOpeningCurlyBrace": true | ||
| }, | ||
| "disallowSpacesInFunctionExpression": { | ||
| "beforeOpeningRoundBrace": true | ||
| }, | ||
| "disallowSpacesInFunctionDeclaration": { | ||
| "beforeOpeningRoundBrace": true | ||
| }, | ||
| "plugins": [ | ||
| "jscs-jsdoc" | ||
| ], | ||
| "jsDoc": { | ||
| "checkParamNames": true, | ||
| "requireParamTypes": true, | ||
| "checkRedundantParams": true, | ||
| "checkReturnTypes": true, | ||
| "checkRedundantReturns": true, | ||
| "requireReturnTypes": true, | ||
| "checkRedundantAccess": true, | ||
| "checkTypes": "capitalizedNativeCase", | ||
| "checkAnnotations": { | ||
| "preset": "jsdoc3", | ||
| "extra": { | ||
| "api": true | ||
| } | ||
| } | ||
| }, | ||
| "excludeFiles": [ | ||
| "_gh_pages/**", | ||
| "node_modules/**", | ||
| "bower_components/**", | ||
| "components/**", | ||
| "vendor/**", | ||
| "build/**", | ||
| "dest/**", | ||
| "dist/**", | ||
| "src/**", | ||
| "lib-cov/**", | ||
| "coverage/**", | ||
| "nbproject/**", | ||
| "cache/**", | ||
| "temp/**", | ||
| "tmp/**" | ||
| ] | ||
| } |
Sorry, the diff of this file is not supported yet
-37
| { | ||
| "maxerr" : 10, | ||
| "indent" : 2, | ||
| "maxparams" : 3, | ||
| "maxdepth" : 3, | ||
| "maxstatements" : 15, | ||
| "maxlen" : 120, | ||
| "camelcase" : true, | ||
| "forin" : false, | ||
| "immed" : true, | ||
| "newcap" : true, | ||
| "quotmark" : "single", | ||
| "asi" : true, | ||
| "eqnull" : true, | ||
| "esnext" : true, | ||
| "funcscope" : true, | ||
| "globalstrict" : true, | ||
| "lastsemic" : true, | ||
| "shadow" : true, | ||
| "node" : true, | ||
| "nonstandard" : true, | ||
| "globals": { | ||
| "it": true, | ||
| "describe": true, | ||
| "beforeEach": true, | ||
| "afterEach": true, | ||
| "before": true, | ||
| "after": true, | ||
| "define": true, | ||
| "should": true | ||
| } | ||
| } |
| {"type":"stylesheet","stylesheet":{"rules":[{"type":"rule","selectors":["body"],"declarations":[{"type":"declaration","property":"background","value":"#eee","position":{"start":{"line":1,"column":8},"end":{"line":1,"column":24}}},{"type":"declaration","property":"color","value":"#888","position":{"start":{"line":1,"column":26},"end":{"line":1,"column":37}}}],"position":{"start":{"line":1,"column":1},"end":{"line":1,"column":40}}}],"parsingErrors":[]}} |
-11
| ## v0.1.1 / April 3, 2015 | ||
| - npm@v0.1.1 | ||
| - fix typos | ||
| ## v0.1.0 / April 3, 2015 | ||
| - npm@v0.1.0 | ||
| ## v0.0.0 / April 3, 2015 | ||
| - first commits / npm@v0.0.0 |
-22
| Copyright (c) 2015 [Charlike Make Reagent](http://j.mp/1stW47C), contributors | ||
| 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. |
-73
| ## [![npm][npmjs-img]][npmjs-url] [![mit license][license-img]][license-url] [![build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![deps status][daviddm-img]][daviddm-url] | ||
| > Transform CSS to JSON AST using `reworkcss/css`. | ||
| ## Install | ||
| ``` | ||
| npm i --save jstransformer-css | ||
| npm test | ||
| ``` | ||
| ## Usage | ||
| > For more use-cases see the [tests](./test.js) | ||
| ```js | ||
| var css = require('jstransformer-css'); | ||
| css.render('body {\n font-size: 12px;\n}'); | ||
| //=> json abstract syntax tree | ||
| ``` | ||
| ## Related | ||
| - [blink](http://blinkjs.github.io/blink): Blink converts Node.js modules into CSS and provides a CSS Authoring Framework, with BEM support. | ||
| - [absurd](http://absurdjs.com/): JavaScript library with superpowers - http://absurdjs.com/ | ||
| - [css](https://github.com/reworkcss/css): CSS parser / stringifier | ||
| - [rework](https://github.com/reworkcss/rework): Plugin framework for CSS preprocessing | ||
| - [gonzales](http://github.com/css/gonzales): Gonzales — fast CSS parser | ||
| - [postcss](https://github.com/postcss/postcss): Tool for transforming CSS with JS plugins | ||
| - [cssp](http://github.com/css/cssp): CSSP — Ometa-JS based CSS parser | ||
| - [cssom](https://github.com/NV/CSSOM): CSS Object Model implementation and CSS parser | ||
| ## Author | ||
| **Charlike Mike Reagent** | ||
| + [gratipay/tunnckoCore][author-gratipay] | ||
| + [twitter/tunnckoCore][author-twitter] | ||
| + [github/tunnckoCore][author-github] | ||
| + [npmjs/tunnckoCore][author-npmjs] | ||
| + [more ...][contrib-more] | ||
| ## License [![MIT license][license-img]][license-url] | ||
| Copyright (c) 2015 [Charlike Mike Reagent][contrib-more], [contributors][contrib-graf]. | ||
| Released under the [`MIT`][license-url] license. | ||
| [npmjs-url]: http://npm.im/jstransformer-css | ||
| [npmjs-img]: https://img.shields.io/npm/v/jstransformer-css.svg?style=flat&label=jstransformer-css | ||
| [coveralls-url]: https://coveralls.io/r/jstransformers/jstransformer-css?branch=master | ||
| [coveralls-img]: https://img.shields.io/coveralls/jstransformers/jstransformer-css.svg?style=flat | ||
| [license-url]: https://github.com/jstransformers/jstransformer-css/blob/master/license.md | ||
| [license-img]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat | ||
| [travis-url]: https://travis-ci.org/jstransformers/jstransformer-css | ||
| [travis-img]: https://img.shields.io/travis/jstransformers/jstransformer-css.svg?style=flat | ||
| [daviddm-url]: https://david-dm.org/jstransformers/jstransformer-css | ||
| [daviddm-img]: https://img.shields.io/david/jstransformers/jstransformer-css.svg?style=flat | ||
| [author-gratipay]: https://gratipay.com/tunnckoCore | ||
| [author-twitter]: https://twitter.com/tunnckoCore | ||
| [author-github]: https://github.com/tunnckoCore | ||
| [author-npmjs]: https://npmjs.org/~tunnckocore | ||
| [contrib-more]: http://j.mp/1stW47C | ||
| [contrib-graf]: https://github.com/jstransformers/jstransformer-css/graphs/contributors | ||
| *** | ||
| _Proudly generated by [docks(1)](https://github.com/tunnckoCore), April 3, 2015_ |
-31
| /** | ||
| * jstransformer-css <https://github.com/jstransformers/jstransformer-css> | ||
| * | ||
| * Copyright (c) 2015 Charlike Mike Reagent, contributors. | ||
| * Released under the MIT license. | ||
| */ | ||
| 'use strict'; | ||
| var fs = require('fs'); | ||
| var css = require('css'); | ||
| var test = require('testit'); | ||
| var assert = require('assert'); | ||
| var transform = require('./index'); | ||
| test('jstransformer-css', function(done) { | ||
| var json = transform.render('body { background: #eee; color: #888; }'); | ||
| assert.deepEqual(json, fs.readFileSync('./expected.json', 'utf8')); | ||
| done(); | ||
| }); | ||
| test('should support sourcemaps', function(done) { | ||
| var code = 'body {\n font-size: 12px;\n}'; | ||
| var ast = transform.render(code, {source: 'body.css'}); | ||
| var data = css.stringify(JSON.parse(ast), {sourcemap: true}); | ||
| assert.strictEqual(typeof data, 'object'); | ||
| assert.strictEqual(data.code, code); | ||
| assert.deepEqual(data.map.sources, ['body.css']); | ||
| done(); | ||
| }); |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
8731
-31.98%10
-33.33%38
-2.56%72
-1.37%Updated