diff options
Diffstat (limited to 'node_modules/css-tokenize')
| -rw-r--r-- | node_modules/css-tokenize/.npmignore | 28 | ||||
| -rw-r--r-- | node_modules/css-tokenize/.travis.yml | 4 | ||||
| -rw-r--r-- | node_modules/css-tokenize/LICENSE | 22 | ||||
| -rw-r--r-- | node_modules/css-tokenize/README.md | 100 | ||||
| -rw-r--r-- | node_modules/css-tokenize/example.js | 13 | ||||
| -rw-r--r-- | node_modules/css-tokenize/index.js | 172 | ||||
| -rw-r--r-- | node_modules/css-tokenize/package.json | 34 | ||||
| -rw-r--r-- | node_modules/css-tokenize/test/base.js | 100 | ||||
| -rw-r--r-- | node_modules/css-tokenize/test/brackets.css | 7 | ||||
| -rw-r--r-- | node_modules/css-tokenize/test/gauntlet.css | 38 | ||||
| -rw-r--r-- | node_modules/css-tokenize/test/nested.css | 5 |
11 files changed, 0 insertions, 523 deletions
diff --git a/node_modules/css-tokenize/.npmignore b/node_modules/css-tokenize/.npmignore deleted file mode 100644 index 59d842ba..00000000 --- a/node_modules/css-tokenize/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# Commenting this out is preferred by some people, see -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- -node_modules - -# Users Environment Variables -.lock-wscript diff --git a/node_modules/css-tokenize/.travis.yml b/node_modules/css-tokenize/.travis.yml deleted file mode 100644 index 2083806b..00000000 --- a/node_modules/css-tokenize/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.11" - - "0.10"
\ No newline at end of file diff --git a/node_modules/css-tokenize/LICENSE b/node_modules/css-tokenize/LICENSE deleted file mode 100644 index 18ed0820..00000000 --- a/node_modules/css-tokenize/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Anand Thakker - -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. - diff --git a/node_modules/css-tokenize/README.md b/node_modules/css-tokenize/README.md deleted file mode 100644 index df92e822..00000000 --- a/node_modules/css-tokenize/README.md +++ /dev/null @@ -1,100 +0,0 @@ -css-tokenize -============ - -Coarsely tokenize a stream of CSS, largely modeled after -[substack/html-tokenize](/substack/html-tokenize). - -```javascript -var tokenize = require('css-tokenize'), -through = require('through2'); - -process.stdin -.pipe(tokenize()) -.pipe(through.obj(function(token, enc, next) { - token[1] = token[1].toString(); // it's a buffer slice - console.log('TOKEN', token); - next(); -})) -``` - -Input: -```css - -div { - background: red; -} - -.cls { - color: green; -} - -#id { - font-size: 10px; -} - -/* comment */ - -@media screen and (min-width: 1000px) { - a { - text-decoration: underline; - } -} - -a:hover { - font-weight: bold; -} - -section - - -{ - margin: 0; - /* comment wthin a rule */ - padding: 5px; -} - - -body > * { - -} -``` - -Output: -``` -TOKEN [ 'root', '\n' ] -TOKEN [ 'rule_start', 'div {' ] -TOKEN [ 'rule', '\n background: red;\n' ] -TOKEN [ 'rule_end', '}' ] -TOKEN [ 'root', '\n\n' ] -TOKEN [ 'rule_start', '.cls {' ] -TOKEN [ 'rule', '\n color: green;\n' ] -TOKEN [ 'rule_end', '}' ] -TOKEN [ 'root', '\n\n' ] -TOKEN [ 'rule_start', '#id {' ] -TOKEN [ 'rule', '\n font-size: 10px;\n' ] -TOKEN [ 'rule_end', '}' ] -TOKEN [ 'comment', '\n\n/* comment */' ] -TOKEN [ 'space', '\n\n' ] -TOKEN [ 'atrule_start', '@media screen and (min-width: 1000px) {' ] -TOKEN [ 'atrule', '\n ' ] -TOKEN [ 'rule_start', 'a {' ] -TOKEN [ 'rule', '\n text-decoration: underline;\n ' ] -TOKEN [ 'rule_end', '}' ] -TOKEN [ 'atrule', '\n' ] -TOKEN [ 'atrule_end', '}' ] -TOKEN [ 'root', '\n\n' ] -TOKEN [ 'rule_start', 'a:hover {' ] -TOKEN [ 'rule', '\n font-weight: bold; \n' ] -TOKEN [ 'rule_end', '}' ] -TOKEN [ 'root', '\n\n' ] -TOKEN [ 'rule_start', 'section \n\n\n{' ] -TOKEN [ 'rule', '\n margin: 0;\n ' ] -TOKEN [ 'comment', '/* comment wthin a rule */' ] -TOKEN [ 'rule', '\n padding: 5px;\n' ] -TOKEN [ 'rule_end', '}' ] -TOKEN [ 'root', '\n\n\n' ] -TOKEN [ 'rule_start', 'body > * {' ] -TOKEN [ 'rule', '\n \n' ] -TOKEN [ 'rule_end', '}' ] -TOKEN [ 'root', '\n' ] -``` diff --git a/node_modules/css-tokenize/example.js b/node_modules/css-tokenize/example.js deleted file mode 100644 index b0ff6534..00000000 --- a/node_modules/css-tokenize/example.js +++ /dev/null @@ -1,13 +0,0 @@ - -var tokenize = require('./'), - through = require('through2'), - fs = require('fs'); - -var input = process.argv[2] ? fs.createReadStream(process.argv[2]) : process.stdin; - -input.pipe(tokenize()) - .pipe(through.obj(function(token, enc, next) { - token[1] = token[1].toString(); // it's a buffer slice - console.log('TOKEN', token); - next(); - })) diff --git a/node_modules/css-tokenize/index.js b/node_modules/css-tokenize/index.js deleted file mode 100644 index 21d84470..00000000 --- a/node_modules/css-tokenize/index.js +++ /dev/null @@ -1,172 +0,0 @@ - -/** - * The approach here owes a LOT to https://github.com/substack/html-tokenize. - */ - -var Transform = require('readable-stream').Transform; -var inherits = require('inherits'); - -inherits(Tokenize, Transform); -module.exports = Tokenize; - -var codes = { - fslash: '/'.charCodeAt(0), - bslash: '\\'.charCodeAt(0), - lparen: '('.charCodeAt(0), - rparen: ')'.charCodeAt(0), - lbrace: '{'.charCodeAt(0), - rbrace: '}'.charCodeAt(0), - lbrack: '['.charCodeAt(0), - rbrack: ']'.charCodeAt(0), - squote: '\''.charCodeAt(0), - dquote: '"'.charCodeAt(0), - at: '@'.charCodeAt(0), - semi: ';'.charCodeAt(0), - asterisk: '*'.charCodeAt(0) -} - -var sequences = { - comment_start: '/*', - comment_end: '*/' -} - - -function charCodes(s) { return s.split('').map(function(c){return c.charCodeAt(0)}) } -var sets = { - space: charCodes(' \t\n\r\f'), - open_brackets: [codes.lparen, codes.lbrace, codes.lbrack], - newline: charCodes('\n\r\f') -} - -function Tokenize() { - if (!(this instanceof Tokenize)) return new Tokenize; - Transform.call(this); - this._readableState.objectMode = true; - this.state = [['root']]; - this._input = null; // buffer the input for read-ahead - this._position = 0; // current position in this._input - this.buffers = []; // collect data for current token -} - - -Tokenize.prototype._transform = function(buf, enc, next) { - var input = this._input = this._input ? Buffer.concat([ this._input, buf ]) : buf; - - for(var i = this._position; i < input.length; i++) { - var c = input[i]; - var state = this.state[this.state.length - 1][0], - stateData = this.state[this.state.length - 1][1], - end = null; - - // console.log(i, c, this.state); - - /* comments */ - if(i === input.length - 1 - && (('comment' === state && c === codes.asterisk) - || c === codes.fslash)) { - // need more data: save unprocessed input and bail out. - this._input = this._input.slice(this._position); - break; - } - else if('comment' !== state - && c === codes.fslash && input[i+1] === codes.asterisk) { - if('root' !== state) end = [].concat(state); - i--; //backup to save the '/*' for the comment token. - this.state.push(['comment']) - } - else if('comment' === state - && c === codes.asterisk && input[i+1] === codes.fslash) { - i++; - end = this.state.pop(); - } - /* strings */ - else if('string' === state - && c === stateData) { - this.state.pop(); - } - else if('string' !== state - && codes.squote === c || codes.dquote === c) { - this.state.push(['string', c]); - } - /* brackets */ - // else if(codes.lparen === c) { - // this.state.push(['brackets', codes.rparen]); - // } - // else if(codes.lbrack === c) { - // this.state.push(['brackets', codes.rbrack]); - // } - // else if('brackets' === state - // && c === stateData) { - // this.state.pop(); - // } - /* rules */ - else if('rule_start' === state - && c === codes.lbrace) { - end = this.state.pop(); - this.state.push(['rule']); - } - else if('atrule_start' === state - && c === codes.lbrace) { - end = this.state.pop(); - this.state.push(['atrule']); - } - else if(('rule' === state || 'atrule' === state) - && c === codes.rbrace) { - end = this.state.pop(); - i--; // backup to save the ending curly brace for the rule_end token. - this.state.push([ state + '_end' ]); - } - else if(('rule_end' === state || 'atrule_end' === state) - && c === codes.rbrace) { - end = this.state.pop(); - } - else if('root' === state - && c === codes.at) { - end = ['space']; - i--; - this.state.push(['atrule_start']) - } - // rules can start from the root or nested within at-rules. - else if(sets.space.indexOf(c) < 0) - { - if('root' === state) { - end = ['root']; - i--; - this.state.push(['rule_start']) - } - else if('atrule' === state) { - end = ['atrule']; - i--; - this.state.push(['rule_start']); - } - } - - if(end && i >= this._position) { - var out; - this.push(out = [end[0], input.slice(this._position, i+1)]); - this._position = i+1; - end = null; - } - } - - if(this._position < this._input.length) { - this._input = this._input.slice(this._position); - this._position = 0; - } - else { - this._input = null; - this._position = 0; - } - next(); -} - - -Tokenize.prototype._flush = function (next) { - if(this._input) - this.push([this.state.pop()[0], this._input.slice(this._position)]); - if(this.state.length !== 0) { - console.warn("[css-tokenize] unfinished business", this.state); - } - this.push(null); - next(); -}; diff --git a/node_modules/css-tokenize/package.json b/node_modules/css-tokenize/package.json deleted file mode 100644 index 5d0bfa3b..00000000 --- a/node_modules/css-tokenize/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "css-tokenize", - "version": "1.0.1", - "description": "Transform stream that tokenizes CSS", - "main": "index.js", - "scripts": { - "test": "tape test/*.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/anandthakker/css-tokenize.git" - }, - "keywords": [ - "css", - "tokenize", - "parse", - "stream", - "streaming" - ], - "author": "Anand Thakker <vestibule@anandthakker.net> (http://anandthakker.net)", - "license": "MIT", - "bugs": { - "url": "https://github.com/anandthakker/css-tokenize/issues" - }, - "homepage": "https://github.com/anandthakker/css-tokenize", - "devDependencies": { - "tape": "^3.0.3", - "through2": "^0.6.3" - }, - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "^1.0.33" - } -} diff --git a/node_modules/css-tokenize/test/base.js b/node_modules/css-tokenize/test/base.js deleted file mode 100644 index a42298b7..00000000 --- a/node_modules/css-tokenize/test/base.js +++ /dev/null @@ -1,100 +0,0 @@ -var fs = require('fs'), - test = require('tape'), - through = require('through2'), - tokenize = require('../') - - -test('basic', function(t) { - var tok = tokenize(); - - var input = "html { font-size: 10px; }" - var expected = [ - ['rule_start', 'html {'], - ['rule', ' font-size: 10px; '], - ['rule_end', '}'] - ] - - t.plan(expected.length); - tok.pipe(through.obj(function(token, enc, next) { - token[1] = token[1].toString(); - if (expected.length > 0) t.same(token, expected.shift()) - next(); - })) - - tok.end(input); -}) - -test('at-rule nesting', function(t) { - var tok = tokenize(); - var expected = [ - [ 'atrule_start', '@media screen and (min-width: 1000px) {' ], - [ 'atrule', '\n ' ], - [ 'rule_start', 'a {' ], - [ 'rule', '\n text-decoration: underline;\n ' ], - [ 'rule_end', '}' ], - [ 'atrule', '\n' ], - [ 'atrule_end', '}' ], - [ 'root', '\n' ] - ] - - t.plan(expected.length); - tok.pipe(through.obj(function(token, enc, next) { - token[1] = token[1].toString(); - if (expected.length > 0) t.same(token, expected.shift()) - next(); - })) - - fs.createReadStream(__dirname + '/nested.css').pipe(tok); -}) - -test('gauntlet', function(t) { - var tok = tokenize(); - - var expected = [ - ['root', '\n'], - ['rule_start', 'div {'], - ['rule', '\n background: red;\n'], - ['rule_end', '}'], - ['root', '\n\n'], - ['rule_start', '.cls {'], - ['rule', '\n color: green;\n'], - ['rule_end', '}'], - ['root', '\n\n'], - ['rule_start', '#id {'], - ['rule', '\n font-size: 10px;\n'], - ['rule_end', '}'], - ['comment', '\n\n/* comment */'], - ['space', '\n\n'], - ['atrule_start', '@media screen and (min-width: 1000px) {'], - ['atrule', '\n '], - ['rule_start', 'a {'], - ['rule', '\n text-decoration: underline;\n '], - ['rule_end', '}'], - ['atrule', '\n'], - ['atrule_end', '}'], - ['root', '\n\n'], - ['rule_start', 'a:hover {'], - ['rule', '\n font-weight: bold; \n'], - ['rule_end', '}'], - ['root', '\n\n'], - ['rule_start', 'section \n\n\n{'], - ['rule', '\n margin: 0;\n '], - ['comment', '/* comment wthin a rule */'], - ['rule', '\n padding: 5px;\n'], - ['rule_end', '}'], - ['root', '\n\n\n'], - ['rule_start', 'body > * {'], - ['rule', '\n \n'], - ['rule_end', '}'], - ['root', '\n'] - ] - - t.plan(expected.length); - tok.pipe(through.obj(function(token, enc, next) { - token[1] = token[1].toString(); - if (expected.length > 0) t.same(token, expected.shift()) - next(); - })); - - fs.createReadStream(__dirname + '/gauntlet.css').pipe(tok); -}) diff --git a/node_modules/css-tokenize/test/brackets.css b/node_modules/css-tokenize/test/brackets.css deleted file mode 100644 index 559ca209..00000000 --- a/node_modules/css-tokenize/test/brackets.css +++ /dev/null @@ -1,7 +0,0 @@ - -.hello { - background: url(http://blahlbahlbah.com); -} - - -.explore-mail-tease{padding-top:20px;overflow:hidden;background:#202021 url(/assets/modules/home/octicons-bg-f51579234572c7286b1ead7a6408f2d43c7a0520dbb09f9d2b8b6b59024a01a0.png) center repeat;border-bottom:1px solid #ddd}.explore-mail-tease h3{color:#fff;text-align:center}.explore-mail-tease img{margin-bottom:-5px} diff --git a/node_modules/css-tokenize/test/gauntlet.css b/node_modules/css-tokenize/test/gauntlet.css deleted file mode 100644 index 833c8c9c..00000000 --- a/node_modules/css-tokenize/test/gauntlet.css +++ /dev/null @@ -1,38 +0,0 @@ - -div { - background: red; -} - -.cls { - color: green; -} - -#id { - font-size: 10px; -} - -/* comment */ - -@media screen and (min-width: 1000px) { - a { - text-decoration: underline; - } -} - -a:hover { - font-weight: bold; -} - -section - - -{ - margin: 0; - /* comment wthin a rule */ - padding: 5px; -} - - -body > * { - -} diff --git a/node_modules/css-tokenize/test/nested.css b/node_modules/css-tokenize/test/nested.css deleted file mode 100644 index 8922e61a..00000000 --- a/node_modules/css-tokenize/test/nested.css +++ /dev/null @@ -1,5 +0,0 @@ -@media screen and (min-width: 1000px) { - a { - text-decoration: underline; - } -} |
