From b373055e028210399a09c2ccc1d27b6aad636a6a Mon Sep 17 00:00:00 2001 From: Jonathan Suh Date: Mon, 22 Feb 2016 11:13:46 -0600 Subject: [PATCH 1/2] CSSComb version 3.1.8. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d4ef808..ced4a1d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "sublime-csscomb", "version": "1.2.0", "dependencies": { - "csscomb": "3.0.4" + "csscomb": "3.1.8" }, "license": "MIT" } From 74c84d529769720c69b32d88d2fbe652bc1776ec Mon Sep 17 00:00:00 2001 From: Jonathan Suh Date: Mon, 22 Feb 2016 12:01:40 -0600 Subject: [PATCH 2/2] Updated node_modules for new CSSComb version support. --- .../{csscomb/node_modules => }/.bin/gonzales | 0 .../node_modules => }/commander/History.md | 0 .../node_modules => }/commander/Readme.md | 0 .../node_modules => }/commander/index.js | 0 node_modules/commander/package.json | 81 + .../node_modules => }/csscomb-core/.npmignore | 1 + .../node_modules => }/csscomb-core/README.md | 0 node_modules/csscomb-core/TODO.nani | 1 + node_modules/csscomb-core/coverage.html | 293 ++ .../csscomb-core/lib/core.js | 490 ++- node_modules/csscomb-core/lib/errors.js | 51 + node_modules/csscomb-core/lib/format.js | 5 + node_modules/csscomb-core/lib/plugin.js | 91 + node_modules/csscomb-core/package.json | 77 + node_modules/csscomb-core/test/add_handler.js | 32 + node_modules/csscomb-core/test/configure.js | 0 node_modules/csscomb-core/test/constructor.js | 22 + .../csscomb-core/test/get_options_order.js | 0 node_modules/csscomb-core/test/get_syntax.js | 10 + node_modules/csscomb-core/test/get_value.js | 11 + .../csscomb-core/test/lint_directory.js | 0 node_modules/csscomb-core/test/lint_file.js | 0 node_modules/csscomb-core/test/lint_path.js | 0 node_modules/csscomb-core/test/lint_string.js | 19 + node_modules/csscomb-core/test/lint_tree.js | 59 + .../csscomb-core/test/process_directory.js | 0 .../csscomb-core/test/process_file.js | 0 .../csscomb-core/test/process_path.js | 0 .../csscomb-core/test/process_string.js | 0 .../csscomb-core/test/process_tree.js | 0 node_modules/csscomb-core/test/set_value.js | 73 + .../csscomb-core/test/should_process.js | 54 + .../csscomb-core/test/should_process_file.js | 27 + .../csscomb-core/test/update_option_order.js | 0 node_modules/csscomb-core/test/use.js | 0 node_modules/csscomb/.jscs.json | 77 - node_modules/csscomb/.jshint-groups.js | 35 - node_modules/csscomb/.npmignore | 8 - node_modules/csscomb/CHANGELOG.md | 60 +- node_modules/csscomb/CONTRIBUTE.md | 65 - node_modules/csscomb/README.md | 2 +- node_modules/csscomb/doc/configuration.md | 133 - node_modules/csscomb/doc/options.md | 914 ---- node_modules/csscomb/doc/plugins.md | 6 - node_modules/csscomb/doc/usage-cli.md | 101 - node_modules/csscomb/doc/usage-node.md | 228 - node_modules/csscomb/lib/csscomb.js | 46 +- node_modules/csscomb/lib/format.js | 5 + node_modules/csscomb/lib/gonzales.js | 4 + .../csscomb/lib/options/always-semicolon.js | 96 +- .../csscomb/lib/options/block-indent.js | 100 +- .../csscomb/lib/options/color-case.js | 31 +- .../csscomb/lib/options/color-shorthand.js | 30 +- .../csscomb/lib/options/element-case.js | 57 +- .../csscomb/lib/options/eof-newline.js | 37 +- .../csscomb/lib/options/leading-zero.js | 32 +- node_modules/csscomb/lib/options/quotes.js | 45 +- .../lib/options/remove-empty-rulesets.js | 102 +- .../csscomb/lib/options/sort-order.js | 115 +- .../csscomb/lib/options/space-after-colon.js | 27 +- .../lib/options/space-after-combinator.js | 45 +- .../lib/options/space-after-opening-brace.js | 24 +- .../options/space-after-selector-delimiter.js | 42 +- .../lib/options/space-before-closing-brace.js | 103 +- .../csscomb/lib/options/space-before-colon.js | 46 +- .../lib/options/space-before-combinator.js | 52 +- .../lib/options/space-before-opening-brace.js | 55 +- .../space-before-selector-delimiter.js | 39 +- .../lib/options/space-between-declarations.js | 48 +- .../csscomb/lib/options/strip-spaces.js | 45 +- node_modules/csscomb/lib/options/tab-size.js | 7 +- .../csscomb/lib/options/unitless-zero.js | 76 +- .../lib/options/vendor-prefix-align.js | 119 +- node_modules/csscomb/logo.png | Bin 4254 -> 0 bytes .../node_modules/commander/package.json | 56 - .../minimatch/node_modules/lru-cache/LICENSE | 23 - .../node_modules/lru-cache/package.json | 33 - .../node_modules/lru-cache/test/foreach.js | 52 - .../node_modules/sigmund/package.json | 42 - .../vow-fs/node_modules/glob/LICENSE | 27 - .../glob/node_modules/inherits/package.json | 33 - .../node_modules/node-uuid/package.json | 47 - .../node_modules/vow-queue/package.json | 67 - .../node_modules/vow-fs/package.json | 67 - .../node_modules/csscomb-core/package.json | 35 - .../node_modules/gonzales-pe/README.md | 102 - .../node_modules/gonzales-pe/bin/gonzales.js | 11 - .../gonzales-pe/lib/ast-to-src.js | 14 - .../gonzales-pe/lib/ast-to-string.js | 28 - .../node_modules/gonzales-pe/lib/css/mark.js | 117 - .../gonzales-pe/lib/css/node-types.js | 49 - .../node_modules/gonzales-pe/lib/css/rules.js | 2514 ----------- .../gonzales-pe/lib/css/stringify.js | 97 - .../gonzales-pe/lib/gonzales.ast-to-css.js | 121 - .../gonzales-pe/lib/gonzales.css-to-ast.js | 3832 ----------------- .../node_modules/gonzales-pe/lib/gonzales.js | 5 - .../node_modules/gonzales-pe/lib/js/mark.js | 117 - .../gonzales-pe/lib/js/node-types.js | 8 - .../node_modules/gonzales-pe/lib/js/rules.js | 281 -- .../gonzales-pe/lib/js/stringify.js | 48 - .../gonzales-pe/lib/js/tokenizer.js | 249 -- .../gonzales-pe/lib/less/node-types.js | 58 - .../gonzales-pe/lib/less/stringify.js | 113 - .../gonzales-pe/lib/sass/stringify.js | 117 - .../gonzales-pe/lib/scss/node-types.js | 61 - .../gonzales-pe/lib/scss/stringify.js | 117 - .../gonzales-pe/lib/src-to-ast.js | 75 - .../node_modules/gonzales-pe/package.json | 41 - .../gonzales-pe/web/gonzales.ast-to-css.js | 120 - .../gonzales-pe/web/gonzales.css-to-ast.js | 3831 ---------------- node_modules/csscomb/package.json | 135 +- node_modules/csscomb/test/core/configure.js | 48 - node_modules/csscomb/test/core/get-config.js | 51 - node_modules/csscomb/test/core/less.js | 42 - .../csscomb/test/core/less/import.less | 4 - .../core/less/interpolated-variable-1.less | 4 - .../core/less/interpolated-variable-2.less | 4 - .../csscomb/test/core/less/mixin.less | 4 - .../csscomb/test/core/less/nested-media.less | 6 - .../csscomb/test/core/less/nested-rule.less | 6 - .../csscomb/test/core/less/operation.less | 8 - .../test/core/less/parent-selector.less | 8 - .../csscomb/test/core/less/variable.less | 5 - node_modules/csscomb/test/core/scss.js | 107 - .../csscomb/test/core/scss/content.scss | 5 - .../csscomb/test/core/scss/default.scss | 4 - node_modules/csscomb/test/core/scss/each.scss | 7 - .../csscomb/test/core/scss/extend-1.scss | 4 - .../csscomb/test/core/scss/extend-2.scss | 4 - node_modules/csscomb/test/core/scss/for.scss | 7 - .../csscomb/test/core/scss/function.scss | 3 - .../csscomb/test/core/scss/if-else-if.scss | 7 - .../csscomb/test/core/scss/if-else.scss | 7 - node_modules/csscomb/test/core/scss/if.scss | 5 - .../csscomb/test/core/scss/import.scss | 4 - .../csscomb/test/core/scss/include.scss | 4 - .../core/scss/interpolated-variable-1.scss | 4 - .../core/scss/interpolated-variable-2.scss | 4 - .../csscomb/test/core/scss/mixin-1.scss | 6 - .../csscomb/test/core/scss/mixin-2.scss | 6 - .../csscomb/test/core/scss/mixin-3.scss | 6 - .../csscomb/test/core/scss/mixin-4.scss | 6 - .../csscomb/test/core/scss/nested-media.scss | 6 - .../test/core/scss/nested-property.scss | 8 - .../csscomb/test/core/scss/nested-rule.scss | 6 - .../test/core/scss/parent-selector.scss | 8 - .../csscomb/test/core/scss/variable.scss | 4 - node_modules/csscomb/test/core/scss/warn.scss | 4 - .../csscomb/test/core/scss/while.scss | 8 - node_modules/csscomb/test/core/use.js | 41 - node_modules/csscomb/test/mocha.js | 93 - .../test/options/always-semicolon-less.js | 54 - .../condition-multiline.less | 6 - .../always-semicolon-less/condition.less | 1 - .../include-1-multiline.expected.less | 4 - .../include-1-multiline.less | 4 - .../include-1.expected.less | 1 - .../always-semicolon-less/include-1.less | 1 - .../include-2-multiline.expected.less | 4 - .../include-2-multiline.less | 4 - .../include-2.expected.less | 1 - .../always-semicolon-less/include-2.less | 1 - .../include-3-multiline.expected.less | 4 - .../include-3-multiline.less | 4 - .../include-3.expected.less | 1 - .../always-semicolon-less/include-3.less | 1 - .../include-4-multiline.expected.less | 4 - .../include-4-multiline.less | 4 - .../include-4.expected.less | 1 - .../always-semicolon-less/include-4.less | 1 - .../include-5-multiline.expected.less | 4 - .../include-5-multiline.less | 4 - .../include-5.expected.less | 1 - .../always-semicolon-less/include-5.less | 1 - .../test/options/always-semicolon-sass.js | 10 - .../options/always-semicolon-sass/test.sass | 7 - .../test/options/always-semicolon-scss.js | 62 - .../block-include-multiline.scss | 7 - .../always-semicolon-scss/block-include.scss | 1 - .../block-value-multiline.scss | 7 - .../always-semicolon-scss/block-value.scss | 1 - .../condition-multiline.scss | 6 - .../always-semicolon-scss/condition.scss | 1 - .../extend-multiline.expected.scss | 4 - .../extend-multiline.scss | 4 - .../extend.expected.scss | 1 - .../options/always-semicolon-scss/extend.scss | 1 - .../include-1-multiline.expected.scss | 4 - .../include-1-multiline.scss | 4 - .../include-1.expected.scss | 1 - .../always-semicolon-scss/include-1.scss | 1 - .../include-2-multiline.expected.scss | 4 - .../include-2-multiline.scss | 4 - .../include-2.expected.scss | 1 - .../always-semicolon-scss/include-2.scss | 1 - .../always-semicolon-scss/loop-multiline.scss | 6 - .../options/always-semicolon-scss/loop.scss | 1 - .../csscomb/test/options/always-semicolon.js | 125 - .../csscomb/test/options/block-indent-sass.js | 21 - .../block-indent-sass/block.expected.sass | 6 - .../test/options/block-indent-sass/block.sass | 6 - .../block-indent-sass/mixin.expected.sass | 8 - .../test/options/block-indent-sass/mixin.sass | 8 - .../nested-ruleset.expected.sass | 9 - .../block-indent-sass/nested-ruleset.sass | 9 - .../csscomb/test/options/block-indent-scss.js | 10 - .../nested-include.expected.scss | 5 - .../block-indent-scss/nested-include.scss | 5 - .../csscomb/test/options/block-indent.js | 66 - .../options/block-indent/test-2.expected.css | 30 - .../options/block-indent/test-3.expected.css | 36 - .../test/options/block-indent/test.css | 30 - .../options/block-indent/test.expected.css | 30 - .../csscomb/test/options/color-case.js | 102 - .../csscomb/test/options/color-shorthand.js | 70 - .../csscomb/test/options/element-case-scss.js | 10 - .../element-case-scss/mixin.expected.scss | 3 - .../test/options/element-case-scss/mixin.scss | 3 - .../csscomb/test/options/element-case.js | 99 - .../csscomb/test/options/eof-newline.js | 69 - node_modules/csscomb/test/options/integral.js | 28 - .../test/options/integral/integral.css | 129 - .../options/integral/integral.expected.css | 151 - .../options/integral/issue-252.expected.sass | 11 - .../test/options/integral/issue-252.sass | 8 - .../csscomb/test/options/leading-zero.js | 51 - node_modules/csscomb/test/options/quotes.js | 120 - .../options/remove-empty-rulesets-less.js | 27 - .../1.expected.less | 14 - .../options/remove-empty-rulesets-less/1.less | 14 - .../options/remove-empty-rulesets-scss.js | 22 - .../empty-nested-rule.expected.scss | 1 - .../empty-nested-rule.scss | 5 - .../remove-empty-rulesets-scss/include.scss | 4 - .../nested-rule-1.scss | 6 - .../nested-rule-2.expected.scss | 7 - .../nested-rule-2.scss | 9 - .../test/options/remove-empty-rulesets.js | 112 - node_modules/csscomb/test/options/sass.js | 108 - .../csscomb/test/options/sass/content.sass | 3 - .../csscomb/test/options/sass/default.sass | 3 - .../csscomb/test/options/sass/each.sass | 4 - .../csscomb/test/options/sass/extend-1.sass | 3 - .../csscomb/test/options/sass/extend-2.sass | 3 - .../csscomb/test/options/sass/for.sass | 4 - .../csscomb/test/options/sass/function.sass | 2 - .../csscomb/test/options/sass/if-else-if.sass | 5 - .../csscomb/test/options/sass/if-else.sass | 5 - .../csscomb/test/options/sass/if.sass | 3 - .../csscomb/test/options/sass/import.sass | 3 - .../csscomb/test/options/sass/include.sass | 3 - .../options/sass/interpolated-variable-1.sass | 3 - .../options/sass/interpolated-variable-2.sass | 3 - .../csscomb/test/options/sass/mixin-1.sass | 4 - .../csscomb/test/options/sass/mixin-2.sass | 4 - .../csscomb/test/options/sass/mixin-3.sass | 4 - .../csscomb/test/options/sass/mixin-4.sass | 4 - .../test/options/sass/nested-media.sass | 4 - .../test/options/sass/nested-property.sass | 6 - .../test/options/sass/nested-rule.sass | 4 - .../test/options/sass/parent-selector.sass | 6 - .../csscomb/test/options/sass/variable.sass | 3 - .../csscomb/test/options/sass/warn.sass | 3 - .../csscomb/test/options/sass/while.sass | 5 - .../test/options/sort-order-fallback.js | 36 - .../sort-order-fallback/test-2.expected.css | 11 - .../sort-order-fallback/test-3.expected.css | 11 - .../test/options/sort-order-fallback/test.css | 10 - .../sort-order-fallback/test.expected.css | 12 - .../csscomb/test/options/sort-order-less.js | 96 - .../sort-order-less/comments-1.expected.less | 1 - .../options/sort-order-less/comments-1.less | 1 - .../sort-order-less/comments-2.expected.less | 7 - .../options/sort-order-less/comments-2.less | 7 - .../sort-order-less/comments-3.expected.less | 6 - .../options/sort-order-less/comments-3.less | 6 - .../sort-order-less/comments-4.expected.less | 4 - .../options/sort-order-less/comments-4.less | 4 - .../different-groups.expected.less | 5 - .../sort-order-less/different-groups.less | 4 - .../sort-order-less/import.expected.less | 1 - .../test/options/sort-order-less/import.less | 1 - .../sort-order-less/mixin-1.expected.less | 12 - .../test/options/sort-order-less/mixin-1.less | 12 - .../sort-order-less/mixin-2.expected.less | 6 - .../test/options/sort-order-less/mixin-2.less | 6 - .../sort-order-less/mixin-3.expected.less | 5 - .../test/options/sort-order-less/mixin-3.less | 5 - .../nested-rule-1.expected.less | 6 - .../sort-order-less/nested-rule-1.less | 6 - .../nested-rule-2.expected.less | 7 - .../sort-order-less/nested-rule-2.less | 7 - .../sort-order-less/rule.expected.less | 4 - .../test/options/sort-order-less/rule.less | 4 - .../sort-order-less/variable.expected.less | 1 - .../options/sort-order-less/variable.less | 1 - .../csscomb/test/options/sort-order-sass.js | 89 - .../sort-order-sass/comments.expected.sass | 6 - .../options/sort-order-sass/comments.sass | 6 - .../sort-order-sass/condition.expected.sass | 6 - .../options/sort-order-sass/condition.sass | 6 - .../different-groups.expected.sass | 4 - .../sort-order-sass/different-groups.sass | 3 - .../sort-order-sass/extend.expected.sass | 3 - .../test/options/sort-order-sass/extend.sass | 3 - .../sort-order-sass/import.expected.sass | 3 - .../test/options/sort-order-sass/import.sass | 3 - .../sort-order-sass/include.expected.sass | 3 - .../test/options/sort-order-sass/include.sass | 3 - .../sort-order-sass/mixin.expected.sass | 4 - .../test/options/sort-order-sass/mixin.sass | 4 - .../nested-rule-1.expected.sass | 5 - .../sort-order-sass/nested-rule-1.sass | 5 - .../nested-rule-2.expected.sass | 6 - .../sort-order-sass/nested-rule-2.sass | 6 - .../sort-order-sass/rule.expected.sass | 3 - .../test/options/sort-order-sass/rule.sass | 3 - .../sort-order-sass/ruleset.expected.sass | 6 - .../test/options/sort-order-sass/ruleset.sass | 6 - .../sort-order-sass/variable.expected.sass | 3 - .../options/sort-order-sass/variable.sass | 3 - .../csscomb/test/options/sort-order-scss.js | 116 - .../sort-order-scss/comments-1.expected.scss | 7 - .../options/sort-order-scss/comments-1.scss | 7 - .../sort-order-scss/comments-2.expected.scss | 1 - .../options/sort-order-scss/comments-2.scss | 1 - .../sort-order-scss/condition.expected.scss | 8 - .../options/sort-order-scss/condition.scss | 8 - .../different-groups.expected.scss | 5 - .../sort-order-scss/different-groups.scss | 4 - .../sort-order-scss/extend.expected.scss | 1 - .../test/options/sort-order-scss/extend.scss | 1 - .../sort-order-scss/import.expected.scss | 1 - .../test/options/sort-order-scss/import.scss | 1 - .../sort-order-scss/include.expected.scss | 1 - .../test/options/sort-order-scss/include.scss | 1 - .../sort-order-scss/leftovers.expected.scss | 36 - .../options/sort-order-scss/leftovers.scss | 24 - .../sort-order-scss/mixin.expected.scss | 1 - .../test/options/sort-order-scss/mixin.scss | 1 - .../nested-rule-1.expected.scss | 1 - .../sort-order-scss/nested-rule-1.scss | 1 - .../nested-rule-2.expected.scss | 1 - .../sort-order-scss/nested-rule-2.scss | 1 - .../rule-multiline.expected.scss | 4 - .../sort-order-scss/rule-multiline.scss | 4 - .../sort-order-scss/rule.expected.scss | 1 - .../test/options/sort-order-scss/rule.scss | 1 - .../sort-order-scss/ruleset.expected.scss | 8 - .../test/options/sort-order-scss/ruleset.scss | 8 - .../sort-order-scss/variable.expected.scss | 1 - .../options/sort-order-scss/variable.scss | 1 - .../csscomb/test/options/sort-order.js | 115 - .../test/options/sort-order/data-uri.css | 7 - .../options/sort-order/data-uri.expected.css | 7 - .../test/options/sort-order/issue-94-1.css | 18 - .../sort-order/issue-94-1.expected.css | 17 - .../test/options/sort-order/issue-94-2.css | 19 - .../sort-order/issue-94-2.expected.css | 19 - .../test/options/sort-order/issue-94-3.css | 21 - .../sort-order/issue-94-3.expected.css | 20 - .../test/options/sort-order/leftovers-1.css | 20 - .../sort-order/leftovers-1.expected.css | 23 - .../test/options/sort-order/leftovers-2.css | 20 - .../sort-order/leftovers-2.expected.css | 23 - .../test/options/sort-order/leftovers-3.css | 20 - .../sort-order/leftovers-3.expected.css | 20 - .../test/options/sort-order/leftovers-4.css | 20 - .../sort-order/leftovers-4.expected.css | 20 - .../options/sort-order/multiple-groups-2.css | 6 - .../sort-order/multiple-groups-2.expected.css | 7 - .../sort-order/multiple-groups-comments.css | 5 - .../multiple-groups-comments.expected.css | 6 - .../options/sort-order/multiple-groups.css | 7 - .../sort-order/multiple-groups.expected.css | 8 - .../sort-order/single-group-comments.css | 5 - .../single-group-comments.expected.css | 5 - .../test/options/sort-order/single-group.css | 5 - .../sort-order/single-group.expected.css | 5 - .../test/options/space-after-colon-sass.js | 15 - .../colon-after-property-name.expected.sass | 3 - .../colon-after-property-name.sass | 3 - .../colon-before-property-name.expected.sass | 3 - .../colon-before-property-name.sass | 3 - .../test/options/space-after-colon-scss.js | 10 - .../pseudo-elements.expected.scss | 11 - .../pseudo-elements.scss | 11 - .../csscomb/test/options/space-after-colon.js | 68 - .../space-after-colon/test-2.expected.css | 5 - .../space-after-colon/test-3.expected.css | 10 - .../test/options/space-after-colon/test.css | 5 - .../space-after-colon/test.expected.css | 5 - .../test/options/space-after-combinator.js | 84 - .../test-2.expected.css | 10 - .../test-3.expected.css | 22 - .../options/space-after-combinator/test.css | 10 - .../space-after-combinator/test.expected.css | 10 - .../test/options/space-after-opening-brace.js | 84 - .../test-2.expected.css | 5 - .../test-3.expected.css | 11 - .../space-after-opening-brace/test.css | 5 - .../test.expected.css | 5 - .../space-after-selector-delimiter-sass.js | 10 - .../issue-238.expected.sass | 5 - .../issue-238.sass | 4 - .../options/space-after-selector-delimiter.js | 83 - .../test-2.expected.css | 5 - .../test-3.expected.css | 11 - .../space-after-selector-delimiter/test.css | 6 - .../test.expected.css | 5 - .../options/space-before-closing-brace.js | 76 - .../test-2.expected.css | 5 - .../test-3.expected.css | 11 - .../space-before-closing-brace/test.css | 5 - .../test.expected.css | 5 - .../test/options/space-before-colon-sass.js | 16 - .../test.expected.sass | 3 - .../options/space-before-colon-sass/test.sass | 3 - .../space-before-colon-sass/test2.sass | 3 - .../test/options/space-before-colon.js | 68 - .../space-before-colon/test-2.expected.css | 5 - .../space-before-colon/test-3.expected.css | 10 - .../test/options/space-before-colon/test.css | 5 - .../space-before-colon/test.expected.css | 5 - .../test/options/space-before-combinator.js | 84 - .../test-2.expected.css | 10 - .../test-3.expected.css | 22 - .../options/space-before-combinator/test.css | 10 - .../space-before-combinator/test.expected.css | 10 - .../space-before-opening-brace-scss.js | 10 - .../issue-231.expected.scss | 8 - .../issue-231.scss | 8 - .../options/space-before-opening-brace.js | 89 - .../space-before-opening-brace/issue-232.css | 13 - .../issue-232.expected.css | 10 - .../test-2.expected.css | 5 - .../test-3.expected.css | 11 - .../space-before-opening-brace/test.css | 5 - .../test.expected.css | 5 - .../space-before-selector-delimiter.js | 83 - .../test-2.expected.css | 6 - .../test-3.expected.css | 12 - .../space-before-selector-delimiter/test.css | 6 - .../test.expected.css | 6 - .../options/space-between-declarations.js | 45 - .../space-between-declarations/comments.css | 8 - .../comments.expected.css | 6 - .../integer-value.css | 6 - .../integer-value.expected.css | 3 - .../space-between-declarations/issue-239.css | 2 - .../issue-239.expected.css | 6 - .../space-newline-value.css | 4 - .../space-newline-value.expected.css | 7 - .../space-value.css | 6 - .../space-value.expected.css | 3 - .../space-between-declarations/test.css | 2 - .../csscomb/test/options/strip-spaces.js | 113 - node_modules/csscomb/test/options/tab-size.js | 20 - .../csscomb/test/options/tab-size/test.css | 4 - .../test/options/tab-size/test.expected.css | 4 - .../csscomb/test/options/unitless-zero.js | 103 - .../test/options/vendor-prefix-align-sass.js | 14 - .../vendor-prefix-align-sass/property.sass | 4 - .../value.expected.sass | 4 - .../vendor-prefix-align-sass/value.sass | 4 - .../test/options/vendor-prefix-align.js | 156 - .../vendor-prefix-align/already-aligned.css | 11 - .../already-aligned.expected.css | 11 - .../test/options/vendor-prefix-align/both.css | 5 - .../vendor-prefix-align/both.expected.css | 5 - .../options/vendor-prefix-align/complex.css | 30 - .../vendor-prefix-align/complex.expected.css | 30 - .../options/vendor-prefix-align/issue-193.css | 2 - .../issue-193.expected.css | 2 - .../options/vendor-prefix-align/issue-241.css | 6 - .../issue-241.expected.css | 6 - .../multiline-comments.css | 9 - .../multiline-comments.expected.css | 9 - .../vendor-prefix-align/one-line-2.css | 1 - .../one-line-2.expected.css | 1 - .../options/vendor-prefix-align/one-line.css | 1 - .../vendor-prefix-align/one-line.expected.css | 1 - .../vendor-prefix-align/property-align.css | 8 - .../property-align.expected.css | 8 - .../options/vendor-prefix-align/same-name.css | 7 - .../same-name.expected.css | 7 - .../vendor-prefix-align/value-align.css | 10 - .../value-align.expected.css | 10 - .../with-comment-property-2.css | 3 - .../with-comment-property-2.expected.css | 3 - .../with-comment-property.css | 5 - .../with-comment-property.expected.css | 5 - .../vendor-prefix-align/with-comment.css | 5 - .../with-comment.expected.css | 5 - .../vendor-prefix-align/without-space.css | 5 - .../without-space.expected.css | 5 - .../vow-fs/node_modules => }/glob/.npmignore | 0 .../vow-fs/node_modules => }/glob/.travis.yml | 0 .../node_modules/sigmund => glob}/LICENSE | 0 .../vow-fs/node_modules => }/glob/README.md | 0 .../node_modules => }/glob/examples/g.js | 0 .../glob/examples/usr-local.js | 0 .../vow-fs/node_modules => }/glob/glob.js | 0 .../node_modules => }/glob/package.json | 90 +- .../node_modules => }/glob/test/00-setup.js | 0 .../glob/test/bash-comparison.js | 0 .../glob/test/bash-results.json | 0 .../node_modules => }/glob/test/cwd-test.js | 0 .../glob/test/globstar-match.js | 0 .../node_modules => }/glob/test/mark.js | 0 .../glob/test/new-glob-optional-options.js | 0 .../glob/test/nocase-nomagic.js | 0 .../glob/test/pause-resume.js | 0 .../glob/test/root-nomount.js | 0 .../node_modules => }/glob/test/root.js | 0 .../node_modules => }/glob/test/stat.js | 0 .../node_modules => }/glob/test/zz-cleanup.js | 0 .../node_modules => }/gonzales-pe/.npmignore | 0 .../{csscomb => gonzales-pe}/.travis.yml | 3 +- .../gonzales-pe/CHANGELOG.md | 32 + .../gonzales-pe/MIT-LICENSE.txt | 0 node_modules/gonzales-pe/README.md | 227 + node_modules/gonzales-pe/TODO.nani | 26 + .../gonzales-pe/bin/generate-tests.js | 45 + node_modules/gonzales-pe/bin/gonzales.js | 26 + .../gonzales-pe/doc/AST-Description.md | 0 .../gonzales-pe/doc/Gonzales-Usage.md | 0 node_modules/gonzales-pe/lib/css/mark.js | 129 + node_modules/gonzales-pe/lib/css/parse.js | 2688 ++++++++++++ node_modules/gonzales-pe/lib/css/stringify.js | 80 + .../gonzales-pe/lib/css/tokenizer.js | 86 +- node_modules/gonzales-pe/lib/gonzales.js | 9 + .../gonzales-pe/lib/less/mark.js | 0 .../lib/less/parse.js} | 756 ++-- .../gonzales-pe/lib/less/stringify.js | 95 + .../lib/less}/tokenizer.js | 60 +- .../sass => gonzales-pe/lib}/node-types.js | 40 +- node_modules/gonzales-pe/lib/node.js | 151 + node_modules/gonzales-pe/lib/parse.js | 42 + node_modules/gonzales-pe/lib/parsing-error.js | 79 + .../gonzales-pe/lib/sass/mark.js | 1 + .../lib/sass/parse.js} | 732 ++-- .../gonzales-pe/lib/sass/stringify.js | 98 + .../gonzales-pe/lib/sass/tokenizer.js | 102 +- .../gonzales-pe/lib/scss/mark.js | 0 .../lib/scss/parse.js} | 555 ++- .../gonzales-pe/lib/scss/stringify.js | 98 + .../lib/scss}/tokenizer.js | 95 +- .../gonzales-pe/lib/token-types.js | 2 + node_modules/gonzales-pe/package.json | 83 + .../glob/node_modules => }/inherits/LICENSE | 0 .../glob/node_modules => }/inherits/README.md | 0 .../node_modules => }/inherits/inherits.js | 0 .../inherits/inherits_browser.js | 0 node_modules/inherits/package.json | 77 + .../glob/node_modules => }/inherits/test.js | 0 .../node_modules => }/lru-cache/.npmignore | 0 node_modules/lru-cache/.travis.yml | 8 + .../node_modules => }/lru-cache/CONTRIBUTORS | 0 node_modules/lru-cache/LICENSE | 15 + .../node_modules => }/lru-cache/README.md | 46 +- .../lru-cache/lib/lru-cache.js | 114 +- node_modules/lru-cache/package.json | 84 + .../node_modules => }/lru-cache/test/basic.js | 79 +- node_modules/lru-cache/test/foreach.js | 120 + .../lru-cache/test/memory-leak.js | 1 + node_modules/lru-cache/test/serialize.js | 216 + .../node_modules => }/minimatch/LICENSE | 0 .../node_modules => }/minimatch/README.md | 0 .../node_modules => }/minimatch/minimatch.js | 0 .../node_modules => }/minimatch/package.json | 85 +- .../node_modules => }/minimatch/test/basic.js | 0 .../minimatch/test/brace-expand.js | 0 .../minimatch/test/caching.js | 0 .../minimatch/test/defaults.js | 0 .../node_modules => }/node-uuid/.npmignore | 0 .../node_modules => }/node-uuid/LICENSE.md | 0 .../node_modules => }/node-uuid/README.md | 0 .../node-uuid/benchmark/README.md | 0 .../node-uuid/benchmark/bench.gnu | 0 .../node-uuid/benchmark/bench.sh | 0 .../node-uuid/benchmark/benchmark-native.c | 0 .../node-uuid/benchmark/benchmark.js | 0 node_modules/node-uuid/package.json | 75 + .../node-uuid/test/compare_v1.js | 0 .../node-uuid/test/test.html | 0 .../node_modules => }/node-uuid/test/test.js | 0 .../node_modules => }/node-uuid/uuid.js | 0 node_modules/sigmund/LICENSE | 15 + .../node_modules => }/sigmund/README.md | 6 +- .../node_modules => }/sigmund/bench.js | 0 node_modules/sigmund/package.json | 85 + .../node_modules => }/sigmund/sigmund.js | 0 .../node_modules => }/sigmund/test/basic.js | 0 .../node_modules => }/vow-fs/.npmignore | 0 .../node_modules => }/vow-fs/.travis.yml | 0 .../node_modules => }/vow-fs/README.md | 0 .../node_modules => }/vow-fs/lib/fs.js | 0 node_modules/vow-fs/package.json | 91 + .../node_modules => }/vow-fs/test/copy.js | 0 .../vow-fs/test/issymlink.js | 0 .../node_modules => }/vow-fs/test/makedir.js | 0 .../vow-fs/test/maketmpfile.js | 0 .../vow-fs/test/removedir.js | 0 .../node_modules => }/vow-fs/test/runner.js | 0 .../node_modules => }/vow-queue/.jscs.json | 0 .../node_modules => }/vow-queue/.jshintignore | 0 .../node_modules => }/vow-queue/.jshintrc | 0 .../node_modules => }/vow-queue/.npmignore | 0 .../node_modules => }/vow-queue/.travis.yml | 0 .../node_modules => }/vow-queue/CHANGELOG.md | 0 .../vow-queue/CONTRIBUTION.md | 0 .../node_modules => }/vow-queue/LICENSE | 0 .../node_modules => }/vow-queue/Makefile | 0 .../node_modules => }/vow-queue/README.md | 0 .../node_modules => }/vow-queue/bower.json | 0 .../node_modules => }/vow-queue/lib/queue.js | 0 node_modules/vow-queue/package.json | 91 + .../{csscomb/node_modules => }/vow/lib/vow.js | 0 .../node_modules => }/vow/package.json | 122 +- .../{csscomb/node_modules => }/vow/vow.min.js | 0 621 files changed, 8664 insertions(+), 21914 deletions(-) rename node_modules/{csscomb/node_modules => }/.bin/gonzales (100%) rename node_modules/{csscomb/node_modules => }/commander/History.md (100%) rename node_modules/{csscomb/node_modules => }/commander/Readme.md (100%) rename node_modules/{csscomb/node_modules => }/commander/index.js (100%) create mode 100644 node_modules/commander/package.json rename node_modules/{csscomb/node_modules => }/csscomb-core/.npmignore (52%) rename node_modules/{csscomb/node_modules => }/csscomb-core/README.md (100%) create mode 100644 node_modules/csscomb-core/TODO.nani create mode 100644 node_modules/csscomb-core/coverage.html rename node_modules/{csscomb/node_modules => }/csscomb-core/lib/core.js (51%) create mode 100644 node_modules/csscomb-core/lib/errors.js create mode 100644 node_modules/csscomb-core/lib/format.js create mode 100644 node_modules/csscomb-core/lib/plugin.js create mode 100644 node_modules/csscomb-core/package.json create mode 100644 node_modules/csscomb-core/test/add_handler.js create mode 100644 node_modules/csscomb-core/test/configure.js create mode 100644 node_modules/csscomb-core/test/constructor.js create mode 100644 node_modules/csscomb-core/test/get_options_order.js create mode 100644 node_modules/csscomb-core/test/get_syntax.js create mode 100644 node_modules/csscomb-core/test/get_value.js create mode 100644 node_modules/csscomb-core/test/lint_directory.js create mode 100644 node_modules/csscomb-core/test/lint_file.js create mode 100644 node_modules/csscomb-core/test/lint_path.js create mode 100644 node_modules/csscomb-core/test/lint_string.js create mode 100644 node_modules/csscomb-core/test/lint_tree.js create mode 100644 node_modules/csscomb-core/test/process_directory.js create mode 100644 node_modules/csscomb-core/test/process_file.js create mode 100644 node_modules/csscomb-core/test/process_path.js create mode 100644 node_modules/csscomb-core/test/process_string.js create mode 100644 node_modules/csscomb-core/test/process_tree.js create mode 100644 node_modules/csscomb-core/test/set_value.js create mode 100644 node_modules/csscomb-core/test/should_process.js create mode 100644 node_modules/csscomb-core/test/should_process_file.js create mode 100644 node_modules/csscomb-core/test/update_option_order.js create mode 100644 node_modules/csscomb-core/test/use.js delete mode 100644 node_modules/csscomb/.jscs.json delete mode 100644 node_modules/csscomb/.jshint-groups.js delete mode 100644 node_modules/csscomb/.npmignore delete mode 100644 node_modules/csscomb/CONTRIBUTE.md delete mode 100644 node_modules/csscomb/doc/configuration.md delete mode 100644 node_modules/csscomb/doc/options.md delete mode 100644 node_modules/csscomb/doc/plugins.md delete mode 100644 node_modules/csscomb/doc/usage-cli.md delete mode 100644 node_modules/csscomb/doc/usage-node.md create mode 100644 node_modules/csscomb/lib/format.js create mode 100644 node_modules/csscomb/lib/gonzales.js delete mode 100644 node_modules/csscomb/logo.png delete mode 100644 node_modules/csscomb/node_modules/commander/package.json delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/LICENSE delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/package.json delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/foreach.js delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/package.json delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/LICENSE delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/package.json delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/package.json delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/package.json delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/package.json delete mode 100644 node_modules/csscomb/node_modules/csscomb-core/package.json delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/README.md delete mode 100755 node_modules/csscomb/node_modules/gonzales-pe/bin/gonzales.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-src.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-string.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/css/mark.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/css/node-types.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/css/rules.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/css/stringify.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.ast-to-css.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.css-to-ast.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/js/mark.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/js/node-types.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/js/rules.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/js/stringify.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/js/tokenizer.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/less/node-types.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/less/stringify.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/sass/stringify.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/scss/node-types.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/scss/stringify.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/lib/src-to-ast.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/package.json delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.ast-to-css.js delete mode 100644 node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.css-to-ast.js delete mode 100644 node_modules/csscomb/test/core/configure.js delete mode 100644 node_modules/csscomb/test/core/get-config.js delete mode 100644 node_modules/csscomb/test/core/less.js delete mode 100644 node_modules/csscomb/test/core/less/import.less delete mode 100644 node_modules/csscomb/test/core/less/interpolated-variable-1.less delete mode 100644 node_modules/csscomb/test/core/less/interpolated-variable-2.less delete mode 100644 node_modules/csscomb/test/core/less/mixin.less delete mode 100644 node_modules/csscomb/test/core/less/nested-media.less delete mode 100644 node_modules/csscomb/test/core/less/nested-rule.less delete mode 100644 node_modules/csscomb/test/core/less/operation.less delete mode 100644 node_modules/csscomb/test/core/less/parent-selector.less delete mode 100644 node_modules/csscomb/test/core/less/variable.less delete mode 100644 node_modules/csscomb/test/core/scss.js delete mode 100644 node_modules/csscomb/test/core/scss/content.scss delete mode 100644 node_modules/csscomb/test/core/scss/default.scss delete mode 100644 node_modules/csscomb/test/core/scss/each.scss delete mode 100644 node_modules/csscomb/test/core/scss/extend-1.scss delete mode 100644 node_modules/csscomb/test/core/scss/extend-2.scss delete mode 100644 node_modules/csscomb/test/core/scss/for.scss delete mode 100644 node_modules/csscomb/test/core/scss/function.scss delete mode 100644 node_modules/csscomb/test/core/scss/if-else-if.scss delete mode 100644 node_modules/csscomb/test/core/scss/if-else.scss delete mode 100644 node_modules/csscomb/test/core/scss/if.scss delete mode 100644 node_modules/csscomb/test/core/scss/import.scss delete mode 100644 node_modules/csscomb/test/core/scss/include.scss delete mode 100644 node_modules/csscomb/test/core/scss/interpolated-variable-1.scss delete mode 100644 node_modules/csscomb/test/core/scss/interpolated-variable-2.scss delete mode 100644 node_modules/csscomb/test/core/scss/mixin-1.scss delete mode 100644 node_modules/csscomb/test/core/scss/mixin-2.scss delete mode 100644 node_modules/csscomb/test/core/scss/mixin-3.scss delete mode 100644 node_modules/csscomb/test/core/scss/mixin-4.scss delete mode 100644 node_modules/csscomb/test/core/scss/nested-media.scss delete mode 100644 node_modules/csscomb/test/core/scss/nested-property.scss delete mode 100644 node_modules/csscomb/test/core/scss/nested-rule.scss delete mode 100644 node_modules/csscomb/test/core/scss/parent-selector.scss delete mode 100644 node_modules/csscomb/test/core/scss/variable.scss delete mode 100644 node_modules/csscomb/test/core/scss/warn.scss delete mode 100644 node_modules/csscomb/test/core/scss/while.scss delete mode 100644 node_modules/csscomb/test/core/use.js delete mode 100644 node_modules/csscomb/test/mocha.js delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less.js delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/condition-multiline.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/condition.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-1.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-1.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-2.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-2.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-3.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-3.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-4.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-4.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-5.expected.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-less/include-5.less delete mode 100644 node_modules/csscomb/test/options/always-semicolon-sass.js delete mode 100644 node_modules/csscomb/test/options/always-semicolon-sass/test.sass delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss.js delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/block-include-multiline.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/block-include.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/block-value-multiline.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/block-value.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/condition-multiline.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/condition.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.expected.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/extend.expected.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/extend.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.expected.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-1.expected.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-1.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.expected.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-2.expected.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/include-2.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/loop-multiline.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon-scss/loop.scss delete mode 100644 node_modules/csscomb/test/options/always-semicolon.js delete mode 100644 node_modules/csscomb/test/options/block-indent-sass.js delete mode 100644 node_modules/csscomb/test/options/block-indent-sass/block.expected.sass delete mode 100644 node_modules/csscomb/test/options/block-indent-sass/block.sass delete mode 100644 node_modules/csscomb/test/options/block-indent-sass/mixin.expected.sass delete mode 100644 node_modules/csscomb/test/options/block-indent-sass/mixin.sass delete mode 100644 node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.expected.sass delete mode 100644 node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.sass delete mode 100644 node_modules/csscomb/test/options/block-indent-scss.js delete mode 100644 node_modules/csscomb/test/options/block-indent-scss/nested-include.expected.scss delete mode 100644 node_modules/csscomb/test/options/block-indent-scss/nested-include.scss delete mode 100644 node_modules/csscomb/test/options/block-indent.js delete mode 100644 node_modules/csscomb/test/options/block-indent/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/block-indent/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/block-indent/test.css delete mode 100644 node_modules/csscomb/test/options/block-indent/test.expected.css delete mode 100644 node_modules/csscomb/test/options/color-case.js delete mode 100644 node_modules/csscomb/test/options/color-shorthand.js delete mode 100644 node_modules/csscomb/test/options/element-case-scss.js delete mode 100644 node_modules/csscomb/test/options/element-case-scss/mixin.expected.scss delete mode 100644 node_modules/csscomb/test/options/element-case-scss/mixin.scss delete mode 100644 node_modules/csscomb/test/options/element-case.js delete mode 100644 node_modules/csscomb/test/options/eof-newline.js delete mode 100644 node_modules/csscomb/test/options/integral.js delete mode 100644 node_modules/csscomb/test/options/integral/integral.css delete mode 100644 node_modules/csscomb/test/options/integral/integral.expected.css delete mode 100644 node_modules/csscomb/test/options/integral/issue-252.expected.sass delete mode 100644 node_modules/csscomb/test/options/integral/issue-252.sass delete mode 100644 node_modules/csscomb/test/options/leading-zero.js delete mode 100644 node_modules/csscomb/test/options/quotes.js delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-less.js delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-less/1.expected.less delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-less/1.less delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-scss.js delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.expected.scss delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.scss delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-scss/include.scss delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-1.scss delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.expected.scss delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.scss delete mode 100644 node_modules/csscomb/test/options/remove-empty-rulesets.js delete mode 100644 node_modules/csscomb/test/options/sass.js delete mode 100644 node_modules/csscomb/test/options/sass/content.sass delete mode 100644 node_modules/csscomb/test/options/sass/default.sass delete mode 100644 node_modules/csscomb/test/options/sass/each.sass delete mode 100644 node_modules/csscomb/test/options/sass/extend-1.sass delete mode 100644 node_modules/csscomb/test/options/sass/extend-2.sass delete mode 100644 node_modules/csscomb/test/options/sass/for.sass delete mode 100644 node_modules/csscomb/test/options/sass/function.sass delete mode 100644 node_modules/csscomb/test/options/sass/if-else-if.sass delete mode 100644 node_modules/csscomb/test/options/sass/if-else.sass delete mode 100644 node_modules/csscomb/test/options/sass/if.sass delete mode 100644 node_modules/csscomb/test/options/sass/import.sass delete mode 100644 node_modules/csscomb/test/options/sass/include.sass delete mode 100644 node_modules/csscomb/test/options/sass/interpolated-variable-1.sass delete mode 100644 node_modules/csscomb/test/options/sass/interpolated-variable-2.sass delete mode 100644 node_modules/csscomb/test/options/sass/mixin-1.sass delete mode 100644 node_modules/csscomb/test/options/sass/mixin-2.sass delete mode 100644 node_modules/csscomb/test/options/sass/mixin-3.sass delete mode 100644 node_modules/csscomb/test/options/sass/mixin-4.sass delete mode 100644 node_modules/csscomb/test/options/sass/nested-media.sass delete mode 100644 node_modules/csscomb/test/options/sass/nested-property.sass delete mode 100644 node_modules/csscomb/test/options/sass/nested-rule.sass delete mode 100644 node_modules/csscomb/test/options/sass/parent-selector.sass delete mode 100644 node_modules/csscomb/test/options/sass/variable.sass delete mode 100644 node_modules/csscomb/test/options/sass/warn.sass delete mode 100644 node_modules/csscomb/test/options/sass/while.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-fallback.js delete mode 100644 node_modules/csscomb/test/options/sort-order-fallback/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order-fallback/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order-fallback/test.css delete mode 100644 node_modules/csscomb/test/options/sort-order-fallback/test.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order-less.js delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-1.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-1.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-2.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-2.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-3.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-3.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-4.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/comments-4.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/different-groups.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/different-groups.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/import.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/import.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/mixin-1.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/mixin-1.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/mixin-2.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/mixin-2.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/mixin-3.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/mixin-3.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/nested-rule-1.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/nested-rule-1.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/nested-rule-2.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/nested-rule-2.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/rule.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/rule.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/variable.expected.less delete mode 100644 node_modules/csscomb/test/options/sort-order-less/variable.less delete mode 100644 node_modules/csscomb/test/options/sort-order-sass.js delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/comments.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/comments.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/condition.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/condition.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/different-groups.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/different-groups.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/extend.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/extend.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/import.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/import.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/include.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/include.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/mixin.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/mixin.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/rule.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/rule.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/ruleset.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/ruleset.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/variable.expected.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-sass/variable.sass delete mode 100644 node_modules/csscomb/test/options/sort-order-scss.js delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/comments-1.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/comments-1.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/comments-2.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/comments-2.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/condition.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/condition.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/different-groups.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/different-groups.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/extend.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/extend.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/import.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/import.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/include.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/include.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/leftovers.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/leftovers.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/mixin.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/mixin.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/rule-multiline.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/rule-multiline.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/rule.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/rule.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/ruleset.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/ruleset.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/variable.expected.scss delete mode 100644 node_modules/csscomb/test/options/sort-order-scss/variable.scss delete mode 100644 node_modules/csscomb/test/options/sort-order.js delete mode 100644 node_modules/csscomb/test/options/sort-order/data-uri.css delete mode 100644 node_modules/csscomb/test/options/sort-order/data-uri.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/issue-94-1.css delete mode 100644 node_modules/csscomb/test/options/sort-order/issue-94-1.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/issue-94-2.css delete mode 100644 node_modules/csscomb/test/options/sort-order/issue-94-2.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/issue-94-3.css delete mode 100644 node_modules/csscomb/test/options/sort-order/issue-94-3.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-1.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-1.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-2.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-2.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-3.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-3.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-4.css delete mode 100644 node_modules/csscomb/test/options/sort-order/leftovers-4.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/multiple-groups-2.css delete mode 100644 node_modules/csscomb/test/options/sort-order/multiple-groups-2.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/multiple-groups-comments.css delete mode 100644 node_modules/csscomb/test/options/sort-order/multiple-groups-comments.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/multiple-groups.css delete mode 100644 node_modules/csscomb/test/options/sort-order/multiple-groups.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/single-group-comments.css delete mode 100644 node_modules/csscomb/test/options/sort-order/single-group-comments.expected.css delete mode 100644 node_modules/csscomb/test/options/sort-order/single-group.css delete mode 100644 node_modules/csscomb/test/options/sort-order/single-group.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-colon-sass.js delete mode 100644 node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.expected.sass delete mode 100644 node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.sass delete mode 100644 node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.expected.sass delete mode 100644 node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.sass delete mode 100644 node_modules/csscomb/test/options/space-after-colon-scss.js delete mode 100644 node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.expected.scss delete mode 100644 node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.scss delete mode 100644 node_modules/csscomb/test/options/space-after-colon.js delete mode 100644 node_modules/csscomb/test/options/space-after-colon/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-colon/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-colon/test.css delete mode 100644 node_modules/csscomb/test/options/space-after-colon/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-combinator.js delete mode 100644 node_modules/csscomb/test/options/space-after-combinator/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-combinator/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-combinator/test.css delete mode 100644 node_modules/csscomb/test/options/space-after-combinator/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-opening-brace.js delete mode 100644 node_modules/csscomb/test/options/space-after-opening-brace/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-opening-brace/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-opening-brace/test.css delete mode 100644 node_modules/csscomb/test/options/space-after-opening-brace/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter-sass.js delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.expected.sass delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.sass delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter.js delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter/test.css delete mode 100644 node_modules/csscomb/test/options/space-after-selector-delimiter/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-closing-brace.js delete mode 100644 node_modules/csscomb/test/options/space-before-closing-brace/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-closing-brace/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-closing-brace/test.css delete mode 100644 node_modules/csscomb/test/options/space-before-closing-brace/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-colon-sass.js delete mode 100644 node_modules/csscomb/test/options/space-before-colon-sass/test.expected.sass delete mode 100644 node_modules/csscomb/test/options/space-before-colon-sass/test.sass delete mode 100644 node_modules/csscomb/test/options/space-before-colon-sass/test2.sass delete mode 100644 node_modules/csscomb/test/options/space-before-colon.js delete mode 100644 node_modules/csscomb/test/options/space-before-colon/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-colon/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-colon/test.css delete mode 100644 node_modules/csscomb/test/options/space-before-colon/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-combinator.js delete mode 100644 node_modules/csscomb/test/options/space-before-combinator/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-combinator/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-combinator/test.css delete mode 100644 node_modules/csscomb/test/options/space-before-combinator/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace-scss.js delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.expected.scss delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.scss delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace.js delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace/issue-232.css delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace/issue-232.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace/test.css delete mode 100644 node_modules/csscomb/test/options/space-before-opening-brace/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-selector-delimiter.js delete mode 100644 node_modules/csscomb/test/options/space-before-selector-delimiter/test-2.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-selector-delimiter/test-3.expected.css delete mode 100644 node_modules/csscomb/test/options/space-before-selector-delimiter/test.css delete mode 100644 node_modules/csscomb/test/options/space-before-selector-delimiter/test.expected.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations.js delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/comments.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/comments.expected.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/integer-value.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/integer-value.expected.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/issue-239.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/issue-239.expected.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/space-newline-value.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/space-newline-value.expected.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/space-value.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/space-value.expected.css delete mode 100644 node_modules/csscomb/test/options/space-between-declarations/test.css delete mode 100644 node_modules/csscomb/test/options/strip-spaces.js delete mode 100644 node_modules/csscomb/test/options/tab-size.js delete mode 100644 node_modules/csscomb/test/options/tab-size/test.css delete mode 100644 node_modules/csscomb/test/options/tab-size/test.expected.css delete mode 100644 node_modules/csscomb/test/options/unitless-zero.js delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align-sass.js delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align-sass/property.sass delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align-sass/value.expected.sass delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align-sass/value.sass delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align.js delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/both.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/both.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/complex.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/complex.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/issue-193.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/issue-193.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/issue-241.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/issue-241.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/one-line.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/one-line.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/property-align.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/property-align.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/same-name.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/same-name.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/value-align.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/value-align.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/with-comment.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/with-comment.expected.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/without-space.css delete mode 100644 node_modules/csscomb/test/options/vendor-prefix-align/without-space.expected.css rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/.npmignore (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/.travis.yml (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund => glob}/LICENSE (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/README.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/examples/g.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/examples/usr-local.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/glob.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/package.json (56%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/00-setup.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/bash-comparison.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/bash-results.json (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/cwd-test.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/globstar-match.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/mark.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/new-glob-optional-options.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/nocase-nomagic.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/pause-resume.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/root-nomount.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/root.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/stat.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/glob/test/zz-cleanup.js (100%) rename node_modules/{csscomb/node_modules => }/gonzales-pe/.npmignore (100%) rename node_modules/{csscomb => gonzales-pe}/.travis.yml (90%) rename node_modules/{csscomb/node_modules => }/gonzales-pe/CHANGELOG.md (72%) rename node_modules/{csscomb/node_modules => }/gonzales-pe/MIT-LICENSE.txt (100%) create mode 100644 node_modules/gonzales-pe/README.md create mode 100644 node_modules/gonzales-pe/TODO.nani create mode 100755 node_modules/gonzales-pe/bin/generate-tests.js create mode 100755 node_modules/gonzales-pe/bin/gonzales.js rename node_modules/{csscomb/node_modules => }/gonzales-pe/doc/AST-Description.md (100%) rename node_modules/{csscomb/node_modules => }/gonzales-pe/doc/Gonzales-Usage.md (100%) create mode 100644 node_modules/gonzales-pe/lib/css/mark.js create mode 100644 node_modules/gonzales-pe/lib/css/parse.js create mode 100644 node_modules/gonzales-pe/lib/css/stringify.js rename node_modules/{csscomb/node_modules => }/gonzales-pe/lib/css/tokenizer.js (75%) create mode 100644 node_modules/gonzales-pe/lib/gonzales.js rename node_modules/{csscomb/node_modules => }/gonzales-pe/lib/less/mark.js (100%) rename node_modules/{csscomb/node_modules/gonzales-pe/lib/less/rules.js => gonzales-pe/lib/less/parse.js} (78%) create mode 100644 node_modules/gonzales-pe/lib/less/stringify.js rename node_modules/{csscomb/node_modules/gonzales-pe/lib/scss => gonzales-pe/lib/less}/tokenizer.js (83%) rename node_modules/{csscomb/node_modules/gonzales-pe/lib/sass => gonzales-pe/lib}/node-types.js (62%) create mode 100644 node_modules/gonzales-pe/lib/node.js create mode 100644 node_modules/gonzales-pe/lib/parse.js create mode 100644 node_modules/gonzales-pe/lib/parsing-error.js rename node_modules/{csscomb/node_modules => }/gonzales-pe/lib/sass/mark.js (99%) rename node_modules/{csscomb/node_modules/gonzales-pe/lib/sass/rules.js => gonzales-pe/lib/sass/parse.js} (82%) create mode 100644 node_modules/gonzales-pe/lib/sass/stringify.js rename node_modules/{csscomb/node_modules => }/gonzales-pe/lib/sass/tokenizer.js (76%) rename node_modules/{csscomb/node_modules => }/gonzales-pe/lib/scss/mark.js (100%) rename node_modules/{csscomb/node_modules/gonzales-pe/lib/scss/rules.js => gonzales-pe/lib/scss/parse.js} (85%) create mode 100644 node_modules/gonzales-pe/lib/scss/stringify.js rename node_modules/{csscomb/node_modules/gonzales-pe/lib/less => gonzales-pe/lib/scss}/tokenizer.js (74%) rename node_modules/{csscomb/node_modules => }/gonzales-pe/lib/token-types.js (94%) create mode 100644 node_modules/gonzales-pe/package.json rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules => }/inherits/LICENSE (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules => }/inherits/README.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules => }/inherits/inherits.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules => }/inherits/inherits_browser.js (100%) create mode 100644 node_modules/inherits/package.json rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules => }/inherits/test.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/lru-cache/.npmignore (100%) create mode 100644 node_modules/lru-cache/.travis.yml rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/lru-cache/CONTRIBUTORS (100%) create mode 100644 node_modules/lru-cache/LICENSE rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/lru-cache/README.md (70%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/lru-cache/lib/lru-cache.js (70%) create mode 100644 node_modules/lru-cache/package.json rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/lru-cache/test/basic.js (86%) create mode 100644 node_modules/lru-cache/test/foreach.js rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/lru-cache/test/memory-leak.js (99%) create mode 100644 node_modules/lru-cache/test/serialize.js rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/LICENSE (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/README.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/minimatch.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/package.json (54%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/test/basic.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/test/brace-expand.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/test/caching.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/minimatch/test/defaults.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/.npmignore (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/LICENSE.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/README.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/benchmark/README.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/benchmark/bench.gnu (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/benchmark/bench.sh (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/benchmark/benchmark-native.c (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/benchmark/benchmark.js (100%) create mode 100644 node_modules/node-uuid/package.json rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/test/compare_v1.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/test/test.html (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/test/test.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/node-uuid/uuid.js (100%) create mode 100644 node_modules/sigmund/LICENSE rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/sigmund/README.md (91%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/sigmund/bench.js (100%) create mode 100644 node_modules/sigmund/package.json rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/sigmund/sigmund.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules => }/sigmund/test/basic.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/.npmignore (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/.travis.yml (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/README.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/lib/fs.js (100%) create mode 100644 node_modules/vow-fs/package.json rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/test/copy.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/test/issymlink.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/test/makedir.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/test/maketmpfile.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/test/removedir.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules => }/vow-fs/test/runner.js (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/.jscs.json (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/.jshintignore (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/.jshintrc (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/.npmignore (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/.travis.yml (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/CHANGELOG.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/CONTRIBUTION.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/LICENSE (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/Makefile (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/README.md (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/bower.json (100%) rename node_modules/{csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules => }/vow-queue/lib/queue.js (100%) create mode 100644 node_modules/vow-queue/package.json rename node_modules/{csscomb/node_modules => }/vow/lib/vow.js (100%) rename node_modules/{csscomb/node_modules => }/vow/package.json (58%) rename node_modules/{csscomb/node_modules => }/vow/vow.min.js (100%) diff --git a/node_modules/csscomb/node_modules/.bin/gonzales b/node_modules/.bin/gonzales similarity index 100% rename from node_modules/csscomb/node_modules/.bin/gonzales rename to node_modules/.bin/gonzales diff --git a/node_modules/csscomb/node_modules/commander/History.md b/node_modules/commander/History.md similarity index 100% rename from node_modules/csscomb/node_modules/commander/History.md rename to node_modules/commander/History.md diff --git a/node_modules/csscomb/node_modules/commander/Readme.md b/node_modules/commander/Readme.md similarity index 100% rename from node_modules/csscomb/node_modules/commander/Readme.md rename to node_modules/commander/Readme.md diff --git a/node_modules/csscomb/node_modules/commander/index.js b/node_modules/commander/index.js similarity index 100% rename from node_modules/csscomb/node_modules/commander/index.js rename to node_modules/commander/index.js diff --git a/node_modules/commander/package.json b/node_modules/commander/package.json new file mode 100644 index 0000000..c9fc308 --- /dev/null +++ b/node_modules/commander/package.json @@ -0,0 +1,81 @@ +{ + "_args": [ + [ + "commander@2.0.0", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb" + ] + ], + "_from": "commander@2.0.0", + "_id": "commander@2.0.0", + "_inCache": true, + "_installable": true, + "_location": "/commander", + "_npmUser": { + "email": "tj@vision-media.ca", + "name": "tjholowaychuk" + }, + "_npmVersion": "1.2.25", + "_phantomChildren": {}, + "_requested": { + "name": "commander", + "raw": "commander@2.0.0", + "rawSpec": "2.0.0", + "scope": null, + "spec": "2.0.0", + "type": "version" + }, + "_requiredBy": [ + "/csscomb" + ], + "_resolved": "https://registry.npmjs.org/commander/-/commander-2.0.0.tgz", + "_shasum": "d1b86f901f8b64bd941bdeadaf924530393be928", + "_shrinkwrap": null, + "_spec": "commander@2.0.0", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb", + "author": { + "email": "tj@vision-media.ca", + "name": "TJ Holowaychuk" + }, + "bugs": { + "url": "https://github.com/visionmedia/commander.js/issues" + }, + "dependencies": {}, + "description": "the complete solution for node.js command-line programs", + "devDependencies": { + "should": ">= 0.0.1" + }, + "directories": {}, + "dist": { + "shasum": "d1b86f901f8b64bd941bdeadaf924530393be928", + "tarball": "http://registry.npmjs.org/commander/-/commander-2.0.0.tgz" + }, + "engines": { + "node": ">= 0.6.x" + }, + "homepage": "https://github.com/visionmedia/commander.js#readme", + "keywords": [ + "command", + "option", + "parser", + "prompt", + "stdin" + ], + "main": "index", + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + } + ], + "name": "commander", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/visionmedia/commander.js.git" + }, + "scripts": { + "test": "make test" + }, + "version": "2.0.0" +} diff --git a/node_modules/csscomb/node_modules/csscomb-core/.npmignore b/node_modules/csscomb-core/.npmignore similarity index 52% rename from node_modules/csscomb/node_modules/csscomb-core/.npmignore rename to node_modules/csscomb-core/.npmignore index 3c3629e..5d763dc 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/.npmignore +++ b/node_modules/csscomb-core/.npmignore @@ -1 +1,2 @@ +covreporter node_modules diff --git a/node_modules/csscomb/node_modules/csscomb-core/README.md b/node_modules/csscomb-core/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/README.md rename to node_modules/csscomb-core/README.md diff --git a/node_modules/csscomb-core/TODO.nani b/node_modules/csscomb-core/TODO.nani new file mode 100644 index 0000000..ebb80de --- /dev/null +++ b/node_modules/csscomb-core/TODO.nani @@ -0,0 +1 @@ +Rename setValue_ to formatValue diff --git a/node_modules/csscomb-core/coverage.html b/node_modules/csscomb-core/coverage.html new file mode 100644 index 0000000..f2f0ca7 --- /dev/null +++ b/node_modules/csscomb-core/coverage.html @@ -0,0 +1,293 @@ +Coverage report
core.js
'use strict';
Function _classCallCheck
✓ Was called
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
Branch IfStatement
✗ Positive was not executed (if)
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
✓ Negative was executed (else)
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
require('babel/polyfill');
var fs = require('fs');
var gonzales = require('gonzales-pe');
var minimatch = require('minimatch');
var Errors = require('./errors');
var Plugin = require('./plugin');
var vow = require('vow');
var vfs = require('vow-fs');
var Comb = (function () {
Function Comb
✓ Was called
function Comb() {···
_classCallCheck(this, Comb);

this.config = {};
this.exclude = [];
// Whether lint mode is on.
this.lint = false;
// List of file paths that should be excluded from processing.
this.pathsToExclude = null;
// List of used plugins.
this.plugins = [];
this.pluginsDependencies = {};
// List of supported syntaxes.
this.supportedSyntaxes = new Set();
// Whether verbose mode is on.
this.verbose = false;
}
function Comb() {
_classCallCheck(this, Comb);
this.config = {};
this.exclude = [];
// Whether lint mode is on.
this.lint = false;
// List of file paths that should be excluded from processing.
this.pathsToExclude = null;
// List of used plugins.
this.plugins = [];
this.pluginsDependencies = {};
// List of supported syntaxes.
this.supportedSyntaxes = new Set();
// Whether verbose mode is on.
this.verbose = false;
}
Function configure
✓ Was called
Comb.prototype.configure = function configure(config) {···
if (typeof config !== 'object')
// TODO: throw error
throw new Error();

this.lint = config.lint;
this.verbose = config.verbose;
if (config.exclude) this.exclude = config.exclude.map(function (pattern) {
return new minimatch.Minimatch(pattern);
});

for (var i = 0, l = this.plugins.length; i < l; i++) {
var plugin = this.plugins[i];
var _name = plugin.name;
if (!config.hasOwnProperty(_name)) continue;

try {
plugin.value = config[_name];
this.config[_name] = plugin.value;
} catch (e) {}
}

// Chaining.
return this;
};
Comb.prototype.configure = function configure(config) {
Branch IfStatement
✓ Positive was executed (if)
throw new Error();
✓ Negative was executed (else)
throw new Error();···

this.lint = config.lint;
if (typeof config !== 'object')
// TODO: throw error
throw new Error();
this.lint = config.lint;
this.verbose = config.verbose;
Function (anonymous_5)
✓ Was called
if (config.exclude) this.exclude = config.exclude.map(function (pattern) {···
return new minimatch.Minimatch(pattern);
});
Branch IfStatement
✓ Positive was executed (if)
if (config.exclude) this.exclude = config.exclude.map(function (pattern) {···
return new minimatch.Minimatch(pattern);
});
✓ Negative was executed (else)
});···

for (var i = 0, l = this.plugins.length; i < l; i++) {
if (config.exclude) this.exclude = config.exclude.map(function (pattern) {
return new minimatch.Minimatch(pattern);
});
for (var i = 0, l = this.plugins.length; i < l; i++) {
var plugin = this.plugins[i];
var _name = plugin.name;
Branch IfStatement
✗ Positive was not executed (if)
if (!config.hasOwnProperty(_name)) continue;
✓ Negative was executed (else)
if (!config.hasOwnProperty(_name)) continue;···

try {
if (!config.hasOwnProperty(_name)) continue;
try {
plugin.value = config[_name];
this.config[_name] = plugin.value;
} catch (e) {}
}
// Chaining.
return this;
};
Function getAcceptableFilesFromDirectory
✓ Was called
Comb.prototype.getAcceptableFilesFromDirectory = function getAcceptableFilesFromDirectory(path) {···
if (!this.shouldProcess(path)) return;

var files = [];
var filesInThisDir = fs.readdirSync(path);

for (var i = 0, fl = filesInThisDir.length; i < fl; i++) {
var fullname = path + '/' + filesInThisDir[i];
var stat = fs.statSync(fullname);
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);
}

return files;
};
Comb.prototype.getAcceptableFilesFromDirectory = function getAcceptableFilesFromDirectory(path) {
Branch IfStatement
✗ Positive was not executed (if)
if (!this.shouldProcess(path)) return;
✓ Negative was executed (else)
if (!this.shouldProcess(path)) return;···

var files = [];
if (!this.shouldProcess(path)) return;
var files = [];
var filesInThisDir = fs.readdirSync(path);
for (var i = 0, fl = filesInThisDir.length; i < fl; i++) {
var fullname = path + '/' + filesInThisDir[i];
var stat = fs.statSync(fullname);
Branch IfStatement
✓ Positive was executed (if)
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);
✓ Negative was executed (else)
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);
Branch LogicalExpression
✓ Was returned
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);
✓ Was returned
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);
Branch IfStatement
✓ Positive was executed (if)
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);
✓ Negative was executed (else)
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);···
}
if (stat.isDirectory() && this.shouldProcess(fullname)) files = files.concat(this.getAcceptableFilesFromDirectory(fullname));else if (this.shouldProcessFile(fullname)) files.push(fullname);
}
return files;
};
/**
* @param {String} path
* @returns {Promise}
*/
Function lintDirectory
✓ Was called
Comb.prototype.lintDirectory = function lintDirectory(path) {···
var _this = this;

var files = this.getAcceptableFilesFromDirectory(path);
var promises = files.map(function (file) {
return _this.lintFile(file);
});
return Promise.all(promises);
};
Comb.prototype.lintDirectory = function lintDirectory(path) {
var _this = this;
var files = this.getAcceptableFilesFromDirectory(path);
Function (anonymous_8)
✓ Was called
var promises = files.map(function (file) {···
return _this.lintFile(file);
});
var promises = files.map(function (file) {
return _this.lintFile(file);
});
return Promise.all(promises);
};
/**
* @param {String} path
* @returns {Promise}
*/
Function lintFile
✓ Was called
Comb.prototype.lintFile = function lintFile(path) {···
var _this2 = this;

var syntax = path.split('.').pop();
return this.readFile(path).then(function (string) {
return _this2.lintString(string, { syntax: syntax, filename: path });
});
};
Comb.prototype.lintFile = function lintFile(path) {
var _this2 = this;
var syntax = path.split('.').pop();
Function (anonymous_10)
✓ Was called
return this.readFile(path).then(function (string) {···
return _this2.lintString(string, { syntax: syntax, filename: path });
});
return this.readFile(path).then(function (string) {
return _this2.lintString(string, { syntax: syntax, filename: path });
});
};
/**
* @param {String} path
*/
Function lintPath
✓ Was called
Comb.prototype.lintPath = function lintPath(path) {···
path = path.replace(/\/$/, '');
return fs.statSync(path).isDirectory() ? this.lintDirectory(path) : this.lintFile(path);
};
Comb.prototype.lintPath = function lintPath(path) {
path = path.replace(/\/$/, '');
Branch ConditionalExpression
✓ Positive was returned (? ...)
return fs.statSync(path).isDirectory() ? this.lintDirectory(path) : this.lintFile(path);
✓ Negative was returned (: ...)
return fs.statSync(path).isDirectory() ? this.lintDirectory(path) : this.lintFile(path);
return fs.statSync(path).isDirectory() ? this.lintDirectory(path) : this.lintFile(path);
};
/**
* @param {String} text
* @param {{context: String, filename: String, syntax: String}} options
* @returns {Promise} Resolves with <Array> list of found errors.
*/
Function lintString
✓ Was called
Comb.prototype.lintString = function lintString(text, options) {···
return this.parseString(text, options).then(this.lintTree.bind(this));
};
Comb.prototype.lintString = function lintString(text, options) {
return this.parseString(text, options).then(this.lintTree.bind(this));
};
/**
* @param {Node} ast
* @param {String=} filename
* @return {Promise} Resolves with <Array> list of errors.
*/
Function lintTree
✓ Was called
Comb.prototype.lintTree = function lintTree(ast, filename) {···
var _this3 = this;

var errors = [];
var config = this.config;

return new Promise(function (resolve) {
_this3.plugins.filter(function (plugin) {
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
}).forEach(function (plugin) {
var e = plugin.lint(ast, config);
errors = errors.concat(e);
});

if (filename) {
errors.map(function (error) {
error.filename = filename;
return error;
});
}

resolve(errors);
});
};
Comb.prototype.lintTree = function lintTree(ast, filename) {
var _this3 = this;
var errors = [];
var config = this.config;
Function (anonymous_14)
✓ Was called
return new Promise(function (resolve) {···
_this3.plugins.filter(function (plugin) {
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
}).forEach(function (plugin) {
var e = plugin.lint(ast, config);
errors = errors.concat(e);
});

if (filename) {
errors.map(function (error) {
error.filename = filename;
return error;
});
}

resolve(errors);
});
return new Promise(function (resolve) {
Function (anonymous_15)
✓ Was called
_this3.plugins.filter(function (plugin) {···
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
}).forEach(function (plugin) {
_this3.plugins.filter(function (plugin) {
Branch LogicalExpression
✓ Was returned
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
✗ Was not returned
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
Branch LogicalExpression
✓ Was returned
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
✗ Was not returned
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
return typeof plugin.value !== null && typeof plugin.lint === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
Function (anonymous_16)
✓ Was called
}).forEach(function (plugin) {···
var e = plugin.lint(ast, config);
errors = errors.concat(e);
});
}).forEach(function (plugin) {
var e = plugin.lint(ast, config);
errors = errors.concat(e);
});
Branch IfStatement
✓ Positive was executed (if)
if (filename) {···
errors.map(function (error) {
error.filename = filename;
return error;
});
}
✓ Negative was executed (else)
}···

resolve(errors);
if (filename) {
Function (anonymous_17)
✓ Was called
errors.map(function (error) {···
error.filename = filename;
return error;
});
errors.map(function (error) {
error.filename = filename;
return error;
});
}
resolve(errors);
});
};
Function parseString
✓ Was called
Comb.prototype.parseString = function parseString(text, options) {···
var syntax = options && options.syntax;
var filename = options && options.filename || '';
var context = options && options.context;
var tree = undefined;

if (!text) return this.lint ? [] : text;

if (!syntax) syntax = 'css';
this.syntax = syntax;

return new Promise(function (resolve) {
try {
tree = gonzales.parse(text, { syntax: syntax, rule: context });
resolve(tree, filename);
} catch (e) {
var version = require('../package.json').version;
var message = filename ? [filename] : [];
message.push(e.message);
message.push('CSScomb Core version: ' + version);
e.stack = e.message = message.join('\n');
throw e;
}
});
};
Comb.prototype.parseString = function parseString(text, options) {
Branch LogicalExpression
✓ Was returned
var syntax = options && options.syntax;
✓ Was returned
var syntax = options && options.syntax;
var syntax = options && options.syntax;
Branch LogicalExpression
✓ Was returned
var filename = options && options.filename || '';
✓ Was returned
var filename = options && options.filename || '';
Branch LogicalExpression
✓ Was returned
var filename = options && options.filename || '';
✓ Was returned
var filename = options && options.filename || '';
var filename = options && options.filename || '';
Branch LogicalExpression
✓ Was returned
var context = options && options.context;
✓ Was returned
var context = options && options.context;
var context = options && options.context;
var tree = undefined;
Branch IfStatement
✗ Positive was not executed (if)
if (!text) return this.lint ? [] : text;
✓ Negative was executed (else)
if (!text) return this.lint ? [] : text;···

if (!syntax) syntax = 'css';
Branch ConditionalExpression
✗ Positive was not returned (? ...)
if (!text) return this.lint ? [] : text;
✗ Negative was not returned (: ...)
if (!text) return this.lint ? [] : text;
if (!text) return this.lint ? [] : text;
Branch IfStatement
✓ Positive was executed (if)
if (!syntax) syntax = 'css';
✓ Negative was executed (else)
if (!syntax) syntax = 'css';···
this.syntax = syntax;
if (!syntax) syntax = 'css';
this.syntax = syntax;
Function (anonymous_19)
✓ Was called
return new Promise(function (resolve) {···
try {
tree = gonzales.parse(text, { syntax: syntax, rule: context });
resolve(tree, filename);
} catch (e) {
var version = require('../package.json').version;
var message = filename ? [filename] : [];
message.push(e.message);
message.push('CSScomb Core version: ' + version);
e.stack = e.message = message.join('\n');
throw e;
}
});
return new Promise(function (resolve) {
try {
tree = gonzales.parse(text, { syntax: syntax, rule: context });
resolve(tree, filename);
} catch (e) {
var version = require('../package.json').version;
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var message = filename ? [filename] : [];
✗ Negative was not returned (: ...)
var message = filename ? [filename] : [];
var message = filename ? [filename] : [];
message.push(e.message);
message.push('CSScomb Core version: ' + version);
e.stack = e.message = message.join('\n');
throw e;
}
});
};
Function pluginAlreadyUsed
✓ Was called
Comb.prototype.pluginAlreadyUsed = function pluginAlreadyUsed(name) {···
return this.pluginIndex(name) !== -1;
};
Comb.prototype.pluginAlreadyUsed = function pluginAlreadyUsed(name) {
return this.pluginIndex(name) !== -1;
};
Function pluginIndex
✓ Was called
Comb.prototype.pluginIndex = function pluginIndex(name) {···
var index = -1;
this.plugins.some(function (plugin, i) {
if (plugin.name === name) {
index = i;
return true;
}
});
return index;
};
Comb.prototype.pluginIndex = function pluginIndex(name) {
var index = -1;
Function (anonymous_22)
✗ Was not called
this.plugins.some(function (plugin, i) {···
if (plugin.name === name) {
index = i;
return true;
}
});
this.plugins.some(function (plugin, i) {
Branch IfStatement
✗ Positive was not executed (if)
if (plugin.name === name) {···
index = i;
return true;
}
✗ Negative was not executed (else)
}···
});
if (plugin.name === name) {
index = i;
return true;
}
});
return index;
};
/**
* Processes directory recursively.
*
* @param {String} path
* @returns {Promise}
*/
Function processDirectory
✗ Was not called
Comb.prototype.processDirectory = function processDirectory(path) {···
var that = this;

return vfs.listDir(path).then(function (filenames) {
return vow.all(filenames.map(function (filename) {
var fullname = path + '/' + filename;
return vfs.stat(fullname).then(function (stat) {
if (stat.isDirectory() && that.shouldProcess(fullname)) {
return that.processDirectory(fullname);
} else {
return that.processFile(fullname);
}
});
})).then(function (results) {
return [].concat.apply([], results);
});
});
};
Comb.prototype.processDirectory = function processDirectory(path) {
var that = this;
Function (anonymous_24)
✗ Was not called
return vfs.listDir(path).then(function (filenames) {···
return vow.all(filenames.map(function (filename) {
var fullname = path + '/' + filename;
return vfs.stat(fullname).then(function (stat) {
if (stat.isDirectory() && that.shouldProcess(fullname)) {
return that.processDirectory(fullname);
} else {
return that.processFile(fullname);
}
});
})).then(function (results) {
return [].concat.apply([], results);
});
});
return vfs.listDir(path).then(function (filenames) {
Function (anonymous_25)
✗ Was not called
return vow.all(filenames.map(function (filename) {···
var fullname = path + '/' + filename;
return vfs.stat(fullname).then(function (stat) {
if (stat.isDirectory() && that.shouldProcess(fullname)) {
return that.processDirectory(fullname);
} else {
return that.processFile(fullname);
}
});
})).then(function (results) {
return vow.all(filenames.map(function (filename) {
var fullname = path + '/' + filename;
Function (anonymous_26)
✗ Was not called
return vfs.stat(fullname).then(function (stat) {···
if (stat.isDirectory() && that.shouldProcess(fullname)) {
return that.processDirectory(fullname);
} else {
return that.processFile(fullname);
}
});
return vfs.stat(fullname).then(function (stat) {
Branch IfStatement
✗ Positive was not executed (if)
if (stat.isDirectory() && that.shouldProcess(fullname)) {···
return that.processDirectory(fullname);
} else {
✗ Negative was not executed (else)
} else {···
return that.processFile(fullname);
}
Branch LogicalExpression
✗ Was not returned
if (stat.isDirectory() && that.shouldProcess(fullname)) {
✗ Was not returned
if (stat.isDirectory() && that.shouldProcess(fullname)) {
if (stat.isDirectory() && that.shouldProcess(fullname)) {
return that.processDirectory(fullname);
} else {
return that.processFile(fullname);
}
});
Function (anonymous_27)
✗ Was not called
})).then(function (results) {···
return [].concat.apply([], results);
});
})).then(function (results) {
return [].concat.apply([], results);
});
});
};
/**
* Processes single file.
*
* @param {String} path
* @returns {Promise}
*/
Function processFile
✗ Was not called
Comb.prototype.processFile = function processFile(path) {···
var that = this;

if (!this.shouldProcessFile(path)) return;

return vfs.read(path, 'utf8').then(function (data) {
var syntax = path.split('.').pop();
var processedData = that.processString(data, {
syntax: syntax,
filename: path
});

if (that.lint) return processedData;

if (data === processedData) {
if (that.verbose) console.log(' ', path);
return 0;
}

return vfs.write(path, processedData, 'utf8').then(function () {
if (that.verbose) console.log('✓', path);
return 1;
});
});
};
Comb.prototype.processFile = function processFile(path) {
var that = this;
Branch IfStatement
✗ Positive was not executed (if)
if (!this.shouldProcessFile(path)) return;
✗ Negative was not executed (else)
if (!this.shouldProcessFile(path)) return;···

return vfs.read(path, 'utf8').then(function (data) {
if (!this.shouldProcessFile(path)) return;
Function (anonymous_29)
✗ Was not called
return vfs.read(path, 'utf8').then(function (data) {···
var syntax = path.split('.').pop();
var processedData = that.processString(data, {
syntax: syntax,
filename: path
});

if (that.lint) return processedData;

if (data === processedData) {
if (that.verbose) console.log(' ', path);
return 0;
}

return vfs.write(path, processedData, 'utf8').then(function () {
if (that.verbose) console.log('✓', path);
return 1;
});
});
return vfs.read(path, 'utf8').then(function (data) {
var syntax = path.split('.').pop();
var processedData = that.processString(data, {
syntax: syntax,
filename: path
});
Branch IfStatement
✗ Positive was not executed (if)
if (that.lint) return processedData;
✗ Negative was not executed (else)
if (that.lint) return processedData;···

if (data === processedData) {
if (that.lint) return processedData;
Branch IfStatement
✗ Positive was not executed (if)
if (data === processedData) {···
if (that.verbose) console.log(' ', path);
return 0;
}
✗ Negative was not executed (else)
}···

return vfs.write(path, processedData, 'utf8').then(function () {
if (data === processedData) {
Branch IfStatement
✗ Positive was not executed (if)
if (that.verbose) console.log(' ', path);
✗ Negative was not executed (else)
if (that.verbose) console.log(' ', path);···
return 0;
if (that.verbose) console.log(' ', path);
return 0;
}
Function (anonymous_30)
✗ Was not called
return vfs.write(path, processedData, 'utf8').then(function () {···
if (that.verbose) console.log('✓', path);
return 1;
});
return vfs.write(path, processedData, 'utf8').then(function () {
Branch IfStatement
✗ Positive was not executed (if)
if (that.verbose) console.log('✓', path);
✗ Negative was not executed (else)
if (that.verbose) console.log('✓', path);···
return 1;
if (that.verbose) console.log('✓', path);
return 1;
});
});
};
Function readFile
✓ Was called
Comb.prototype.readFile = function readFile(path) {···
var _this4 = this;

return new Promise(function (resolve, reject) {
if (!_this4.shouldProcessFile(path)) reject();

fs.readFile(path, 'utf8', function (e, string) {
if (e) reject();
resolve(string);
});
});
};
Comb.prototype.readFile = function readFile(path) {
var _this4 = this;
Function (anonymous_32)
✓ Was called
return new Promise(function (resolve, reject) {···
if (!_this4.shouldProcessFile(path)) reject();

fs.readFile(path, 'utf8', function (e, string) {
if (e) reject();
resolve(string);
});
});
return new Promise(function (resolve, reject) {
Branch IfStatement
✓ Positive was executed (if)
if (!_this4.shouldProcessFile(path)) reject();
✓ Negative was executed (else)
if (!_this4.shouldProcessFile(path)) reject();···

fs.readFile(path, 'utf8', function (e, string) {
if (!_this4.shouldProcessFile(path)) reject();
Function (anonymous_33)
✓ Was called
fs.readFile(path, 'utf8', function (e, string) {···
if (e) reject();
resolve(string);
});
fs.readFile(path, 'utf8', function (e, string) {
Branch IfStatement
✗ Positive was not executed (if)
if (e) reject();
✓ Negative was executed (else)
if (e) reject();···
resolve(string);
if (e) reject();
resolve(string);
});
});
};
/**
* Processes directory or file.
*
* @returns {Promise}
*/
Function processPath
✗ Was not called
Comb.prototype.processPath = function processPath(path) {···
var that = this;
path = path.replace(/\/$/, '');

return vfs.stat(path).then(function (stat) {
if (stat.isDirectory()) {
return that.processDirectory(path);
} else {
return that.processFile(path);
}
});
};
Comb.prototype.processPath = function processPath(path) {
var that = this;
path = path.replace(/\/$/, '');
Function (anonymous_35)
✗ Was not called
return vfs.stat(path).then(function (stat) {···
if (stat.isDirectory()) {
return that.processDirectory(path);
} else {
return that.processFile(path);
}
});
return vfs.stat(path).then(function (stat) {
Branch IfStatement
✗ Positive was not executed (if)
if (stat.isDirectory()) {···
return that.processDirectory(path);
} else {
✗ Negative was not executed (else)
} else {···
return that.processFile(path);
}
if (stat.isDirectory()) {
return that.processDirectory(path);
} else {
return that.processFile(path);
}
});
};
/**
* Processes a string.
*
* @param {String} text
* @param {{context: String, filename: String, syntax: String}} options
* @returns {String} Processed string
*/
Function processString
✓ Was called
Comb.prototype.processString = function processString(text, options) {···
return this.parseString(text, options).then(this.processTree.bind(this)).then(function (ast) {
return ast.toString();
});
};
Comb.prototype.processString = function processString(text, options) {
Function (anonymous_37)
✓ Was called
return this.parseString(text, options).then(this.processTree.bind(this)).then(function (ast) {···
return ast.toString();
});
return this.parseString(text, options).then(this.processTree.bind(this)).then(function (ast) {
return ast.toString();
});
};
/**
* @param {Node} ast
* @return {Node} Transformed AST
*/
Function processTree
✓ Was called
Comb.prototype.processTree = function processTree(ast) {···
var _this5 = this;

var config = this.config;

return new Promise(function (resolve) {
_this5.plugins.filter(function (plugin) {
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
}).forEach(function (plugin) {
plugin.process(ast, config);
});

resolve(ast);
});
};
Comb.prototype.processTree = function processTree(ast) {
var _this5 = this;
var config = this.config;
Function (anonymous_39)
✓ Was called
return new Promise(function (resolve) {···
_this5.plugins.filter(function (plugin) {
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
}).forEach(function (plugin) {
plugin.process(ast, config);
});

resolve(ast);
});
return new Promise(function (resolve) {
Function (anonymous_40)
✓ Was called
_this5.plugins.filter(function (plugin) {···
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
}).forEach(function (plugin) {
_this5.plugins.filter(function (plugin) {
Branch LogicalExpression
✓ Was returned
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
✗ Was not returned
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
Branch LogicalExpression
✓ Was returned
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
✗ Was not returned
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
return plugin.value !== null && typeof plugin.process === 'function' && plugin.syntax.indexOf(ast.syntax) !== -1;
Function (anonymous_41)
✓ Was called
}).forEach(function (plugin) {···
plugin.process(ast, config);
});
}).forEach(function (plugin) {
plugin.process(ast, config);
});
resolve(ast);
});
};
/**
* Checks if path is not present in `exclude` list.
*
* @param {String} path
* @returns {Boolean} False if specified path is present in `exclude` list.
* Otherwise returns true.
*/
Function shouldProcess
✓ Was called
Comb.prototype.shouldProcess = function shouldProcess(path) {···
path = path.replace(/\/$/, '');
if (!fs.existsSync(path)) {
console.warn('Path ' + path + ' was not found.');
return false;
}

path = path.replace(/^\.\//, '');
return this.exclude.every(function (e) {
return !e.match(path);
});
};
Comb.prototype.shouldProcess = function shouldProcess(path) {
path = path.replace(/\/$/, '');
Branch IfStatement
✗ Positive was not executed (if)
if (!fs.existsSync(path)) {···
console.warn('Path ' + path + ' was not found.');
return false;
}
✓ Negative was executed (else)
}···

path = path.replace(/^\.\//, '');
if (!fs.existsSync(path)) {
console.warn('Path ' + path + ' was not found.');
return false;
}
path = path.replace(/^\.\//, '');
Function (anonymous_43)
✗ Was not called
return this.exclude.every(function (e) {···
return !e.match(path);
});
return this.exclude.every(function (e) {
return !e.match(path);
});
};
/**
* Checks if specified path is not present in `exclude` list and it has one of
* acceptable extensions.
*
* @param {String} path
* @returns {Boolean} False if the path either has unacceptable extension or
* is present in `exclude` list. True if everything is ok.
*/
Function shouldProcessFile
✓ Was called
Comb.prototype.shouldProcessFile = function shouldProcessFile(path) {···
// Get file's extension:
var syntax = path.split('.').pop();

// Check if syntax is supported. If not, ignore the file:
if (!this.supportedSyntaxes.has(syntax)) return false;

return this.shouldProcess(path);
};
Comb.prototype.shouldProcessFile = function shouldProcessFile(path) {
// Get file's extension:
var syntax = path.split('.').pop();
// Check if syntax is supported. If not, ignore the file:
Branch IfStatement
✓ Positive was executed (if)
if (!this.supportedSyntaxes.has(syntax)) return false;
✓ Negative was executed (else)
if (!this.supportedSyntaxes.has(syntax)) return false;···

return this.shouldProcess(path);
if (!this.supportedSyntaxes.has(syntax)) return false;
return this.shouldProcess(path);
};
/**
* Add a plugin.
* @param {Object} options
* @return {Comb}
*/
Function use
✓ Was called
Comb.prototype.use = function use(options) {···
// Check whether plugin with the same is already used.
var pluginName = options.name;
if (this.pluginAlreadyUsed(pluginName)) {
if (this.verbose) console.warn(Errors.twoPluginsWithSameName(pluginName));
return;
}

var plugin = new Plugin(options);

plugin.syntax.forEach(function (s) {
this.supportedSyntaxes.add(s);
}, this);

// Sort plugins.
var pluginToRunBefore = plugin.runBefore;

if (!pluginToRunBefore) {
this.plugins.push(plugin);
} else {
if (this.pluginAlreadyUsed(pluginToRunBefore)) {
var i = this.pluginIndex(pluginToRunBefore);
this.plugins.splice(i, 0, plugin);
} else {
this.plugins.push(plugin);
if (!this.pluginsDependencies[pluginToRunBefore]) this.pluginsDependencies[pluginToRunBefore] = [];
this.pluginsDependencies[pluginToRunBefore].push(pluginName);
}
}

var dependents = this.pluginsDependencies[pluginName];
if (!dependents) return this;

for (var i = 0, l = dependents.length; i < l; i++) {
var _name2 = dependents[i];
var x = this.pluginIndex(_name2);
var _plugin = this.plugins[x];
this.plugins.splice(x, 1);
this.plugins.splice(-1, 0, _plugin);
}

// Chaining.
return this;
};
Comb.prototype.use = function use(options) {
// Check whether plugin with the same is already used.
var pluginName = options.name;
Branch IfStatement
✗ Positive was not executed (if)
if (this.pluginAlreadyUsed(pluginName)) {···
if (this.verbose) console.warn(Errors.twoPluginsWithSameName(pluginName));
return;
}
✓ Negative was executed (else)
}···

var plugin = new Plugin(options);
if (this.pluginAlreadyUsed(pluginName)) {
Branch IfStatement
✗ Positive was not executed (if)
if (this.verbose) console.warn(Errors.twoPluginsWithSameName(pluginName));
✗ Negative was not executed (else)
if (this.verbose) console.warn(Errors.twoPluginsWithSameName(pluginName));···
return;
if (this.verbose) console.warn(Errors.twoPluginsWithSameName(pluginName));
return;
}
var plugin = new Plugin(options);
Function (anonymous_46)
✓ Was called
plugin.syntax.forEach(function (s) {···
this.supportedSyntaxes.add(s);
}, this);
plugin.syntax.forEach(function (s) {
this.supportedSyntaxes.add(s);
}, this);
// Sort plugins.
var pluginToRunBefore = plugin.runBefore;
Branch IfStatement
✓ Positive was executed (if)
if (!pluginToRunBefore) {···
this.plugins.push(plugin);
} else {
✗ Negative was not executed (else)
} else {···
if (this.pluginAlreadyUsed(pluginToRunBefore)) {
var i = this.pluginIndex(pluginToRunBefore);
this.plugins.splice(i, 0, plugin);
} else {
this.plugins.push(plugin);
if (!this.pluginsDependencies[pluginToRunBefore]) this.pluginsDependencies[pluginToRunBefore] = [];
this.pluginsDependencies[pluginToRunBefore].push(pluginName);
}
}
if (!pluginToRunBefore) {
this.plugins.push(plugin);
} else {
Branch IfStatement
✗ Positive was not executed (if)
if (this.pluginAlreadyUsed(pluginToRunBefore)) {···
var i = this.pluginIndex(pluginToRunBefore);
this.plugins.splice(i, 0, plugin);
} else {
✗ Negative was not executed (else)
} else {···
this.plugins.push(plugin);
if (!this.pluginsDependencies[pluginToRunBefore]) this.pluginsDependencies[pluginToRunBefore] = [];
this.pluginsDependencies[pluginToRunBefore].push(pluginName);
}
if (this.pluginAlreadyUsed(pluginToRunBefore)) {
var i = this.pluginIndex(pluginToRunBefore);
this.plugins.splice(i, 0, plugin);
} else {
this.plugins.push(plugin);
Branch IfStatement
✗ Positive was not executed (if)
if (!this.pluginsDependencies[pluginToRunBefore]) this.pluginsDependencies[pluginToRunBefore] = [];
✗ Negative was not executed (else)
if (!this.pluginsDependencies[pluginToRunBefore]) this.pluginsDependencies[pluginToRunBefore] = [];···
this.pluginsDependencies[pluginToRunBefore].push(pluginName);
if (!this.pluginsDependencies[pluginToRunBefore]) this.pluginsDependencies[pluginToRunBefore] = [];
this.pluginsDependencies[pluginToRunBefore].push(pluginName);
}
}
var dependents = this.pluginsDependencies[pluginName];
Branch IfStatement
✓ Positive was executed (if)
if (!dependents) return this;
✗ Negative was not executed (else)
if (!dependents) return this;···

for (var i = 0, l = dependents.length; i < l; i++) {
if (!dependents) return this;
for (var i = 0, l = dependents.length; i < l; i++) {
var _name2 = dependents[i];
var x = this.pluginIndex(_name2);
var _plugin = this.plugins[x];
this.plugins.splice(x, 1);
this.plugins.splice(-1, 0, _plugin);
}
// Chaining.
return this;
};
return Comb;
})();
module.exports = Comb;
// TODO: throw error
errors.js
'use strict';
var format = require('./format');
module.exports = {
Function implementSetValue
✓ Was called
implementSetValue: function implementSetValue(valueType) {···
if (typeof valueType === 'undefined') throw new Error();

return format('If you see this message and you are not\n a developer adding a new option, please open an issue here:\n https://github.com/csscomb/core/issues/new\n\n For option to accept values of type "' + valueType + '"\n you need to implement custom `setValue()` method.');
},
implementSetValue: function implementSetValue(valueType) {
Branch IfStatement
✓ Positive was executed (if)
if (typeof valueType === 'undefined') throw new Error();
✓ Negative was executed (else)
if (typeof valueType === 'undefined') throw new Error();···

return format('If you see this message and you are not\n a developer adding a new option, please open an issue here:\n https://github.com/csscomb/core/issues/new\n\n For option to accept values of type "' + valueType + '"\n you need to implement custom `setValue()` method.');
if (typeof valueType === 'undefined') throw new Error();
return format('If you see this message and you are not\n a developer adding a new option, please open an issue here:\n https://github.com/csscomb/core/issues/new\n\n For option to accept values of type "' + valueType + '"\n you need to implement custom `setValue()` method.');
},
Function missingName
✓ Was called
missingName: function missingName() {···
return 'Plugin must have a valid `name` property.';
},
missingName: function missingName() {
return 'Plugin must have a valid `name` property.';
},
Function missingSetValue
✓ Was called
missingSetValue: function missingSetValue() {···
return format('Plugin must either implemet `setValue()` method\n or provide `accepts` object with acceptable values.');
},
missingSetValue: function missingSetValue() {
return format('Plugin must either implemet `setValue()` method\n or provide `accepts` object with acceptable values.');
},
Function missingSyntax
✓ Was called
missingSyntax: function missingSyntax() {···
return 'Plugin must list supported syntaxes.';
},
missingSyntax: function missingSyntax() {
return 'Plugin must list supported syntaxes.';
},
Function twoPluginsWithSameName
✓ Was called
twoPluginsWithSameName: function twoPluginsWithSameName(pluginName) {···
if (typeof pluginName === 'undefined') throw new Error();

return format('You\'re trying to use one plugin twice:\n ' + pluginName + '. Please make sure there are not two different\n plugins with the same name.');
},
twoPluginsWithSameName: function twoPluginsWithSameName(pluginName) {
Branch IfStatement
✓ Positive was executed (if)
if (typeof pluginName === 'undefined') throw new Error();
✓ Negative was executed (else)
if (typeof pluginName === 'undefined') throw new Error();···

return format('You\'re trying to use one plugin twice:\n ' + pluginName + '. Please make sure there are not two different\n plugins with the same name.');
if (typeof pluginName === 'undefined') throw new Error();
return format('You\'re trying to use one plugin twice:\n ' + pluginName + '. Please make sure there are not two different\n plugins with the same name.');
},
Function unacceptableBoolean
✓ Was called
unacceptableBoolean: function unacceptableBoolean(pattern) {···
if (typeof pattern === 'undefined') throw new Error();

return 'Value must be one of the following: ' + pattern.join(', ') + '.';
},
unacceptableBoolean: function unacceptableBoolean(pattern) {
Branch IfStatement
✓ Positive was executed (if)
if (typeof pattern === 'undefined') throw new Error();
✓ Negative was executed (else)
if (typeof pattern === 'undefined') throw new Error();···

return 'Value must be one of the following: ' + pattern.join(', ') + '.';
if (typeof pattern === 'undefined') throw new Error();
return 'Value must be one of the following: ' + pattern.join(', ') + '.';
},
Function unacceptableNumber
✓ Was called
unacceptableNumber: function unacceptableNumber() {···
return 'Value must be an integer.';
},
unacceptableNumber: function unacceptableNumber() {
return 'Value must be an integer.';
},
Function unacceptableString
✓ Was called
unacceptableString: function unacceptableString(pattern) {···
if (typeof pattern === 'undefined') throw new Error();

return 'Value must match pattern ' + pattern + '.';
},
unacceptableString: function unacceptableString(pattern) {
Branch IfStatement
✓ Positive was executed (if)
if (typeof pattern === 'undefined') throw new Error();
✓ Negative was executed (else)
if (typeof pattern === 'undefined') throw new Error();···

return 'Value must match pattern ' + pattern + '.';
if (typeof pattern === 'undefined') throw new Error();
return 'Value must match pattern ' + pattern + '.';
},
Function unacceptableValueType
✓ Was called
unacceptableValueType: function unacceptableValueType(valueType, accepts) {···
if (typeof valueType === 'undefined' || typeof accepts === 'undefined') throw new Error();

return format('The option does not accept values of type\n ' + valueType + '.\nValue\'s type must be one the following:\n ' + Object.keys(accepts).join(', ') + '.');
}
unacceptableValueType: function unacceptableValueType(valueType, accepts) {
Branch IfStatement
✓ Positive was executed (if)
if (typeof valueType === 'undefined' || typeof accepts === 'undefined') throw new Error();
✓ Negative was executed (else)
if (typeof valueType === 'undefined' || typeof accepts === 'undefined') throw new Error();···

return format('The option does not accept values of type\n ' + valueType + '.\nValue\'s type must be one the following:\n ' + Object.keys(accepts).join(', ') + '.');
Branch LogicalExpression
✓ Was returned
if (typeof valueType === 'undefined' || typeof accepts === 'undefined') throw new Error();
✓ Was returned
if (typeof valueType === 'undefined' || typeof accepts === 'undefined') throw new Error();
if (typeof valueType === 'undefined' || typeof accepts === 'undefined') throw new Error();
return format('The option does not accept values of type\n ' + valueType + '.\nValue\'s type must be one the following:\n ' + Object.keys(accepts).join(', ') + '.');
}
};
format.js
'use strict';
Function (anonymous_56)
✓ Was called
module.exports = function (string) {···
return string.replace(/\n\s*/gm, ' ');
};
module.exports = function (string) {
return string.replace(/\n\s*/gm, ' ');
};
plugin.js
'use strict';
var Errors = require('./errors');
Function Plugin
✗ Was not called
var Plugin = function Plugin(methods) {···
for (var method in methods) {
this[method] = typeof method === 'function' ? methods[method].bind(this) : methods[method];
}

this.validate();
};
var Plugin = function Plugin(methods) {
for (var method in methods) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
this[method] = typeof method === 'function' ? methods[method].bind(this) : methods[method];
✗ Negative was not returned (: ...)
this[method] = typeof method === 'function' ? methods[method].bind(this) : methods[method];
this[method] = typeof method === 'function' ? methods[method].bind(this) : methods[method];
}
this.validate();
};
Plugin.prototype = Object.defineProperties({
/**
* Plugin's name.
* @type {String}
*/
name: null,
/**
* List of supported syntaxes.
* @type {Array}
*/
syntax: null,
/**
* @type {Object}
*/
accepts: null,
/**
* @type {Function}
*/
process: null,
/**
* @type {Function}
*/
lint: null,
value_: null,
Function validate
✗ Was not called
validate: function validate() {···
if (typeof this.name !== 'string' || !this.name) throw new Error(Errors.missingName());

if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax());

if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue());
}
validate: function validate() {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof this.name !== 'string' || !this.name) throw new Error(Errors.missingName());
✗ Negative was not executed (else)
if (typeof this.name !== 'string' || !this.name) throw new Error(Errors.missingName());···

if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax());
Branch LogicalExpression
✗ Was not returned
if (typeof this.name !== 'string' || !this.name) throw new Error(Errors.missingName());
✗ Was not returned
if (typeof this.name !== 'string' || !this.name) throw new Error(Errors.missingName());
if (typeof this.name !== 'string' || !this.name) throw new Error(Errors.missingName());
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax());
✗ Negative was not executed (else)
if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax());···

if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue());
Branch LogicalExpression
✗ Was not returned
if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax());
✗ Was not returned
if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax());
if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax());
Branch IfStatement
✗ Positive was not executed (if)
if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue());
✗ Negative was not executed (else)
if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue());···
}
Branch LogicalExpression
✗ Was not returned
if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue());
✗ Was not returned
if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue());
if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue());
}
}, {
value: {
Function (anonymous_59)
✗ Was not called
get: function () {···
return this.value_;
},
get: function () {
return this.value_;
},
Function (anonymous_60)
✗ Was not called
set: function (value) {···
var valueType = typeof value;
var pattern = this.accepts && this.accepts[valueType];

if (this.setValue) {
this.value_ = this.setValue(value);
return this.value_;
}

if (!pattern) throw new Error(Errors.unacceptableValueType(valueType, this.accepts));

if (valueType === 'boolean') {
if (pattern.indexOf(value) < 0) throw new Error(Errors.unacceptableBoolean(pattern));
this.value_ = value;
return this.value_;
}

if (valueType === 'number') {
if (value !== parseInt(value)) throw new Error(Errors.unacceptableNumber());
this.value_ = new Array(value + 1).join(' ');
return this.value_;
}

if (valueType = 'string') {
if (!value.match(pattern)) throw new Error(Errors.unacceptableString(pattern));
this.value_ = value;
return this.value_;
}

throw new Error(Errors.implementSetValue(valueType));
},
set: function (value) {
var valueType = typeof value;
Branch LogicalExpression
✗ Was not returned
var pattern = this.accepts && this.accepts[valueType];
✗ Was not returned
var pattern = this.accepts && this.accepts[valueType];
var pattern = this.accepts && this.accepts[valueType];
Branch IfStatement
✗ Positive was not executed (if)
if (this.setValue) {···
this.value_ = this.setValue(value);
return this.value_;
}
✗ Negative was not executed (else)
}···

if (!pattern) throw new Error(Errors.unacceptableValueType(valueType, this.accepts));
if (this.setValue) {
this.value_ = this.setValue(value);
return this.value_;
}
Branch IfStatement
✗ Positive was not executed (if)
if (!pattern) throw new Error(Errors.unacceptableValueType(valueType, this.accepts));
✗ Negative was not executed (else)
if (!pattern) throw new Error(Errors.unacceptableValueType(valueType, this.accepts));···

if (valueType === 'boolean') {
if (!pattern) throw new Error(Errors.unacceptableValueType(valueType, this.accepts));
Branch IfStatement
✗ Positive was not executed (if)
if (valueType === 'boolean') {···
if (pattern.indexOf(value) < 0) throw new Error(Errors.unacceptableBoolean(pattern));
this.value_ = value;
return this.value_;
}
✗ Negative was not executed (else)
}···

if (valueType === 'number') {
if (valueType === 'boolean') {
Branch IfStatement
✗ Positive was not executed (if)
if (pattern.indexOf(value) < 0) throw new Error(Errors.unacceptableBoolean(pattern));
✗ Negative was not executed (else)
if (pattern.indexOf(value) < 0) throw new Error(Errors.unacceptableBoolean(pattern));···
this.value_ = value;
if (pattern.indexOf(value) < 0) throw new Error(Errors.unacceptableBoolean(pattern));
this.value_ = value;
return this.value_;
}
Branch IfStatement
✗ Positive was not executed (if)
if (valueType === 'number') {···
if (value !== parseInt(value)) throw new Error(Errors.unacceptableNumber());
this.value_ = new Array(value + 1).join(' ');
return this.value_;
}
✗ Negative was not executed (else)
}···

if (valueType = 'string') {
if (valueType === 'number') {
Branch IfStatement
✗ Positive was not executed (if)
if (value !== parseInt(value)) throw new Error(Errors.unacceptableNumber());
✗ Negative was not executed (else)
if (value !== parseInt(value)) throw new Error(Errors.unacceptableNumber());···
this.value_ = new Array(value + 1).join(' ');
if (value !== parseInt(value)) throw new Error(Errors.unacceptableNumber());
this.value_ = new Array(value + 1).join(' ');
return this.value_;
}
Branch IfStatement
✗ Positive was not executed (if)
if (valueType = 'string') {···
if (!value.match(pattern)) throw new Error(Errors.unacceptableString(pattern));
this.value_ = value;
return this.value_;
}
✗ Negative was not executed (else)
}···

throw new Error(Errors.implementSetValue(valueType));
if (valueType = 'string') {
Branch IfStatement
✗ Positive was not executed (if)
if (!value.match(pattern)) throw new Error(Errors.unacceptableString(pattern));
✗ Negative was not executed (else)
if (!value.match(pattern)) throw new Error(Errors.unacceptableString(pattern));···
this.value_ = value;
if (!value.match(pattern)) throw new Error(Errors.unacceptableString(pattern));
this.value_ = value;
return this.value_;
}
throw new Error(Errors.implementSetValue(valueType));
},
configurable: true,
enumerable: true
}
});
module.exports = Plugin;
\ No newline at end of file diff --git a/node_modules/csscomb/node_modules/csscomb-core/lib/core.js b/node_modules/csscomb-core/lib/core.js similarity index 51% rename from node_modules/csscomb/node_modules/csscomb-core/lib/core.js rename to node_modules/csscomb-core/lib/core.js index e776822..782c56e 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/lib/core.js +++ b/node_modules/csscomb-core/lib/core.js @@ -9,70 +9,55 @@ var vfs = require('vow-fs'); * @name Comb */ var Comb = function(predefinedOptions) { - var _this = this; + // For unambiguity, use `that` to access public methods + // and `_this` to access private ones. + var that = this; + + /** + * PRIVATE AREA + * Those properties and methods are made available for easy testing. + */ + Object.defineProperty(that, '_', { + enumerable: false, + writable: true, + configurable: true + }); + var _this = that._ = {}; + + /** + * PRIVATE PROPERTIES + */ + + // List of handlers: + _this.handlers = null; // List of supported syntaxes: - var supportedSyntaxes = Array.prototype.slice.call(arguments, 1); + _this.supportedSyntaxes = Array.prototype.slice.call(arguments, 1); // List of file paths that should be excluded from processing: - var exclude; + _this.exclude = null; // List of configured options with values: - var configuredOptions; - // List of handlers: - var handlers; + _this.configuredOptions = null; // Whether lint mode is on: - var lint; + _this.lint = null; // Whether verbose mode is on: - var verbose; + _this.verbose = null; // Map of used options: - var options = {}; + _this.options = {}; // List of option names in exact order they should be processed: - var optionsOrder = []; - var unmetOptions = {}; + _this.optionsOrder = []; + _this.unmetOptions = {}; /** * PRIVATE METHODS + * - addHandler; + * - lintTree; + * - processTree; + * - setValue; + * - shouldProcess; + * - shouldProcessFile; + * - updateOptionOrder; + * - usePredefinedOptions; */ - function usePredefinedOptions() { - if (!predefinedOptions) return; - - predefinedOptions.forEach(function(option) { - _this.use(option); - }); - } - - /** - * @param {Object} option - */ - function updateOptionOrder(option) { - var name = option.name; - var runBefore = option.runBefore; - var runBeforeIndex; - - options[name] = option; - - if (runBefore) { - runBeforeIndex = optionsOrder.indexOf(runBefore); - if (runBeforeIndex > -1) { - optionsOrder.splice(runBeforeIndex, 0, name); - } else { - optionsOrder.push(name); - if (!unmetOptions[runBefore]) unmetOptions[runBefore] = []; - unmetOptions[runBefore].push(name); - } - } else { - optionsOrder.push(name); - } - - var unmet = unmetOptions[name]; - if (unmet) { - unmet.forEach(function(name) { - var i = optionsOrder.indexOf(name); - optionsOrder.splice(i, 1); - optionsOrder.splice( -1, 0, name); - }); - } - } - /** * Adds an option to list of configured options. * @@ -81,13 +66,73 @@ var Comb = function(predefinedOptions) { * @returns {Object} Object with option's name, value and link to * `process()` method */ - function addHandler(option, value) { + _this.addHandler = function addHandler(option, value) { value = option.setValue ? option.setValue(value) : - setValue(option.accepts, value); - handlers.push(option); - configuredOptions[option.name] = value; - } + _this.setValue(option.accepts, value); + _this.handlers.push(option); + _this.configuredOptions[option.name] = value; + }; + + /** + * Processes stylesheet tree node. + * + * @param {Object} tree Parsed tree + * @returns {Array} List of found errors + */ + _this.lintTree = function lintTree(tree) { + var _handlers; + + _handlers = _this.handlers.filter(function(handler) { + var syntax = that.getSyntax(); + return handler.syntax.indexOf(syntax) > -1 && + typeof handler.lint === 'function'; + }).map(function(handler) { + return handler.lint.bind(that); + }); + + // We walk across complete tree for each handler, + // because we need strictly maintain order in which handlers work, + // despite fact that handlers work on different level of the tree. + var errors = []; + _handlers.forEach(function(handler) { + tree.map(function(node) { + var error = handler(node); + if (!error) return; + if (Array.isArray(error)) { + errors = errors.concat(error); + } else { + errors.push(error); + } + }); + }); + return errors; + }; + + /** + * Processes stylesheet tree node. + * + * @param {Array} tree Parsed tree + * @returns {Array} Modified tree + */ + _this.processTree = function processTree(tree) { + var _handlers; + + _handlers = _this.handlers.filter(function(handler) { + var syntax = that.getSyntax(); + return handler.syntax.indexOf(syntax) > -1; + }).map(function(handler) { + return handler.process.bind(that); + }); + + // We walk across complete tree for each handler, + // because we need strictly maintain order in which handlers work, + // despite fact that handlers work on different level of the tree. + _handlers.forEach(function(handler) { + tree.map(handler); + }); + return tree; + }; /** * Processes value and checks if it is acceptable by the option. @@ -98,7 +143,7 @@ var Comb = function(predefinedOptions) { * @param {Object|undefined} value * @returns {Boolean|String} Valid option's value */ - function setValue(acceptableValues, value) { + _this.setValue = function setValue(acceptableValues, value) { if (!acceptableValues) throw new Error('Option\'s module must either' + ' implement `setValue()` method or provide `accepts` object' + ' with acceptable values.'); @@ -130,7 +175,7 @@ var Comb = function(predefinedOptions) { '" you need to implement custom `setValue()` method. See' + ' `lib/options/sort-order.js` for example.'); } - } + }; /** * Checks if path is present in `exclude` list. @@ -139,13 +184,13 @@ var Comb = function(predefinedOptions) { * @returns {Boolean} False if specified path is present in `exclude` list. * Otherwise returns true. */ - function shouldProcess(path) { + _this.shouldProcess = function shouldProcess(path) { path = path.replace(/^\.\//, ''); - for (var i = exclude.length; i--;) { - if (exclude[i].match(path)) return false; + for (var i = _this.exclude.length; i--;) { + if (_this.exclude[i].match(path)) return false; } return true; - } + }; /** * Checks if specified path is not present in `exclude` list and it has one of @@ -155,109 +200,77 @@ var Comb = function(predefinedOptions) { * @returns {Boolean} False if the path either has unacceptable extension or * is present in `exclude` list. True if everything is ok. */ - function shouldProcessFile(path) { + _this.shouldProcessFile = function shouldProcessFile(path) { // Get file's extension: var syntax = path.split('.').pop(); // Check if syntax is supported. If not, ignore the file: - if (supportedSyntaxes.indexOf(syntax) < 0) { + if (_this.supportedSyntaxes.indexOf(syntax) < 0) { return false; } - return shouldProcess(path); - } + return _this.shouldProcess(path); + }; /** - * Processes stylesheet tree node. - * - * @param {Array} tree Parsed tree - * @returns {Array} Modified tree + * @param {Object} option */ - function processTree(tree) { - var _handlers; + _this.updateOptionOrder = function updateOptionOrder(option) { + var name = option.name; + var runBefore = option.runBefore; + var runBeforeIndex; - _handlers = handlers.filter(function(handler) { - var syntax = _this.getSyntax(); - return handler.syntax.indexOf(syntax) > -1; - }).map(function(handler) { - return handler.process; - }); + _this.options[name] = option; - // We walk across complete tree for each handler, - // because we need strictly maintain order in which handlers work, - // despite fact that handlers work on different level of the tree. - _handlers.forEach(function(handler) { - processNode(['tree', tree], 0, handler); - }); - return tree; - } - - /** - * Processes tree node. - * - * @param {Array} node Tree node - * @param {Number} level Indent level - * @param {Object} handler Option's handler - */ - function processNode(node, level, handler) { - node.forEach(function(node) { - if (!Array.isArray(node)) return; + if (runBefore) { + runBeforeIndex = _this.optionsOrder.indexOf(runBefore); + if (runBeforeIndex > -1) { + _this.optionsOrder.splice(runBeforeIndex, 0, name); + } else { + _this.optionsOrder.push(name); + if (!_this.unmetOptions[runBefore]) _this.unmetOptions[runBefore] = []; + _this.unmetOptions[runBefore].push(name); + } + } else { + _this.optionsOrder.push(name); + } - var nodeType = node.shift(); - handler.call(_this, nodeType, node, level); - node.unshift(nodeType); + var unmet = _this.unmetOptions[name]; + if (unmet) { + unmet.forEach(function(name) { + var i = _this.optionsOrder.indexOf(name); + _this.optionsOrder.splice(i, 1); + _this.optionsOrder.splice( -1, 0, name); + }); + } + }; - if (nodeType === 'atrulers' || nodeType === 'block') level++; + _this.usePredefinedOptions = function usePredefinedOptions() { + if (!predefinedOptions) return; - processNode(node, level, handler); + predefinedOptions.forEach(function(option) { + that.use(option); }); - } + }; + /** * PUBLIC INSTANCE METHODS * Methods that depend on certain instance variables, e.g. configuration: - * - use; * - configure; * - getOptionsOrder; - * - getValue; * - getSyntax; - * - processPath; - * - processDirectory; + * - getValue; + * - lintFile; + * - lintDirectory; + * - lintPath; + * - lintString; * - processFile; + * - processDirectory; + * - processPath; * - processString; + * - use; */ - /** - * - * @param {Object} option - * @returns {Object} Comb's object - */ - this.use = function use(option) { - var name; - - if (typeof option !== 'object') { - throw new Error('Can\'t use option because it is not an object'); - } - - name = option.name; - if (typeof name !== 'string' || !name) { - throw new Error('Can\'t use option because it has invalid name: ' + - name); - } - - if (typeof option.accepts !== 'object' && - typeof option.setValue !== 'function') { - throw new Error('Can\'t use option "' + name + '"'); - } - - if (typeof option.process !== 'function') { - throw new Error('Can\'t use option "' + name + '"'); - } - - updateOptionOrder(option); - - return this; - }; - /** * Loads configuration from JSON. * Activates and configures required options. @@ -265,34 +278,38 @@ var Comb = function(predefinedOptions) { * @param {Object} config * @returns {Object} Comb's object (that makes the method chainable). */ - this.configure = function configure(config) { - handlers = []; - configuredOptions = {}; - verbose = config.verbose; - lint = config.lint; - exclude = (config.exclude || []).map(function(pattern) { + that.configure = function configure(config) { + _this.handlers = []; + _this.configuredOptions = {}; + _this.verbose = config.verbose; + _this.lint = config.lint; + _this.exclude = (config.exclude || []).map(function(pattern) { return new minimatch.Minimatch(pattern); }); - optionsOrder.forEach(function(optionName) { + _this.optionsOrder.forEach(function(optionName) { if (config[optionName] === undefined) return; try { - addHandler(options[optionName], config[optionName]); + _this.addHandler(_this.options[optionName], config[optionName]); } catch (e) { // Show warnings about illegal config values only in verbose mode: - if (verbose) { + if (_this.verbose) { console.warn('\nFailed to configure "%s" option:\n%s', optionName, e.message); } } }); - return this; + return that; + }; + + that.getOptionsOrder = function getOptionsOrder() { + return _this.optionsOrder.slice(); }; - this.getOptionsOrder = function getOptionsOrder() { - return optionsOrder.slice(); + that.getSyntax = function getSyntax() { + return that.syntax; }; /** @@ -301,21 +318,48 @@ var Comb = function(predefinedOptions) { * @param {String} optionName * @returns {String|Boolean|undefined} */ - this.getValue = function getValue(optionName) { - return configuredOptions[optionName]; + that.getValue = function getValue(optionName) { + return _this.configuredOptions[optionName]; }; - this.getSyntax = function getSyntax() { - return _this.syntax; + /** + * @param {String} path + * @returns {Promise} + */ + that.lintDirectory = function lintDirectory(path) { + return vfs.listDir(path).then(function(filenames) { + return vow.all(filenames.map(function(filename) { + var fullname = path + '/' + filename; + return vfs.stat(fullname).then(function(stat) { + if (stat.isDirectory()) { + return _this.shouldProcess(fullname) && that.lintDirectory(fullname); + } else { + return that.lintFile(fullname); + } + }); + })).then(function(results) { + return [].concat.apply([], results); + }); + }); }; /** - * Processes directory or file. - * * @param {String} path * @returns {Promise} */ - this.processPath = function processPath(path) { + that.lintFile = function lintFile(path) { + if (!_this.shouldProcessFile(path)) return; + return vfs.read(path, 'utf8').then(function(data) { + var syntax = path.split('.').pop(); + return that.lintString(data, { syntax: syntax, filename: path }); + }); + }; + + /** + * @param {String} path + * @returns {Promise} + */ + that.lintPath = function lintPath(path) { path = path.replace(/\/$/, ''); return vfs.exists(path).then(function(exists) { @@ -325,29 +369,65 @@ var Comb = function(predefinedOptions) { } return vfs.stat(path).then(function(stat) { if (stat.isDirectory()) { - return _this.processDirectory(path); + return that.lintDirectory(path); } else { - return _this.processFile(path); + return that.lintFile(path); } }); }); }; + /** + * @param {String} text + * @param {{context: String, filename: String, syntax: String}} options + * @returns {Array} List of found errors + */ + that.lintString = function lintString(text, options) { + var syntax = options && options.syntax; + var filename = options && options.filename; + var context = options && options.context; + var tree; + + if (!text) return []; + + if (!syntax) syntax = 'css'; + that.syntax = syntax; + + try { + tree = gonzales.parse(text, { syntax: syntax, rule: context }); + } catch (e) { + var version = require('../package.json').version; + var message = filename ? [filename] : []; + message.push(e.message); + message.push('CSScomb Core version: ' + version); + e.stack = e.message = message.join('\n'); + throw e; + } + + var errors = _this.lintTree(tree); + if (filename) { + errors.map(function(error) { + return error.filename = filename; + }) + } + return errors; + }; + /** * Processes directory recursively. * * @param {String} path * @returns {Promise} */ - this.processDirectory = function processDirectory(path) { + that.processDirectory = function processDirectory(path) { return vfs.listDir(path).then(function(filenames) { return vow.all(filenames.map(function(filename) { var fullname = path + '/' + filename; return vfs.stat(fullname).then(function(stat) { if (stat.isDirectory()) { - return shouldProcess(fullname) && _this.processDirectory(fullname); + return _this.shouldProcess(fullname) && that.processDirectory(fullname); } else { - return _this.processFile(fullname); + return that.processFile(fullname); } }); })).then(function(results) { @@ -362,20 +442,20 @@ var Comb = function(predefinedOptions) { * @param {String} path * @returns {Promise} */ - this.processFile = function processFile(path) { - if (!shouldProcessFile(path)) return; + that.processFile = function processFile(path) { + if (!_this.shouldProcessFile(path)) return; return vfs.read(path, 'utf8').then(function(data) { var syntax = path.split('.').pop(); - var processedData = _this.processString(data, { syntax: syntax, filename: path }); + var processedData = that.processString(data, { syntax: syntax, filename: path }); var isChanged = data !== processedData; - var tick = isChanged ? (lint ? '!' : '✓') : ' '; + var tick = isChanged ? (_this.lint ? '!' : '✓') : ' '; var output = function() { - if (verbose) console.log(tick, path); + if (_this.verbose) console.log(tick, path); return isChanged ? 1 : 0; }; - if (!isChanged || lint) { + if (!isChanged || _this.lint) { return output(); } else { return vfs.write(path, processedData, 'utf8').then(output); @@ -383,6 +463,31 @@ var Comb = function(predefinedOptions) { }); }; + + /** + * Processes directory or file. + * + * @param {String} path + * @returns {Promise} + */ + that.processPath = function processPath(path) { + path = path.replace(/\/$/, ''); + + return vfs.exists(path).then(function(exists) { + if (!exists) { + console.warn('Path ' + path + ' was not found.'); + return; + } + return vfs.stat(path).then(function(stat) { + if (stat.isDirectory()) { + return that.processDirectory(path); + } else { + return that.processFile(path); + } + }); + }); + }; + /** * Processes a string. * @@ -390,7 +495,7 @@ var Comb = function(predefinedOptions) { * @param {{context: String, filename: String, syntax: String}} options * @returns {String} Processed string */ - this.processString = function processString(text, options) { + that.processString = function processString(text, options) { var syntax = options && options.syntax; var filename = options && options.filename || ''; var context = options && options.context; @@ -399,10 +504,11 @@ var Comb = function(predefinedOptions) { if (!text) return text; // TODO: Parse different syntaxes - _this.syntax = syntax || 'css'; + syntax = syntax || 'css'; + that.syntax = syntax || 'css'; try { - tree = gonzales.srcToAST({ src: text, syntax: syntax, rule: context }); + tree = gonzales.parse(text, { syntax: syntax, rule: context }); } catch (e) { var version = require('../package.json').version; var message = [filename, @@ -412,11 +518,43 @@ var Comb = function(predefinedOptions) { throw e; } - tree = processTree(tree); - return gonzales.astToSrc({ syntax: syntax, ast: tree }); + tree = _this.processTree(tree); + return tree.toCSS(syntax); + }; + + /** + * + * @param {Object} option + * @returns {Object} Comb's object + */ + that.use = function use(option) { + var name; + + if (typeof option !== 'object') { + throw new Error('Can\'t use option because it is not an object'); + } + + name = option.name; + if (typeof name !== 'string' || !name) { + throw new Error('Can\'t use option because it has invalid name: ' + + name); + } + + if (typeof option.accepts !== 'object' && + typeof option.setValue !== 'function') { + throw new Error('Can\'t use option "' + name + '"'); + } + + if (typeof option.process !== 'function') { + throw new Error('Can\'t use option "' + name + '"'); + } + + _this.updateOptionOrder(option); + + return that; }; - usePredefinedOptions(); + _this.usePredefinedOptions(); }; module.exports = Comb; diff --git a/node_modules/csscomb-core/lib/errors.js b/node_modules/csscomb-core/lib/errors.js new file mode 100644 index 0000000..a1c7ac4 --- /dev/null +++ b/node_modules/csscomb-core/lib/errors.js @@ -0,0 +1,51 @@ +'use strict'; + +var format = require('./format'); + +module.exports = { + implementSetValue: function implementSetValue(valueType) { + if (typeof valueType === 'undefined') throw new Error(); + + return format('If you see this message and you are not\n a developer adding a new option, please open an issue here:\n https://github.com/csscomb/core/issues/new\n\n For option to accept values of type "' + valueType + '"\n you need to implement custom `setValue()` method.'); + }, + + missingName: function missingName() { + return 'Plugin must have a valid `name` property.'; + }, + + missingSetValue: function missingSetValue() { + return format('Plugin must either implemet `setValue()` method\n or provide `accepts` object with acceptable values.'); + }, + + missingSyntax: function missingSyntax() { + return 'Plugin must list supported syntaxes.'; + }, + + twoPluginsWithSameName: function twoPluginsWithSameName(pluginName) { + if (typeof pluginName === 'undefined') throw new Error(); + + return format('You\'re trying to use one plugin twice:\n ' + pluginName + '. Please make sure there are not two different\n plugins with the same name.'); + }, + + unacceptableBoolean: function unacceptableBoolean(pattern) { + if (typeof pattern === 'undefined') throw new Error(); + + return 'Value must be one of the following: ' + pattern.join(', ') + '.'; + }, + + unacceptableNumber: function unacceptableNumber() { + return 'Value must be an integer.'; + }, + + unacceptableString: function unacceptableString(pattern) { + if (typeof pattern === 'undefined') throw new Error(); + + return 'Value must match pattern ' + pattern + '.'; + }, + + unacceptableValueType: function unacceptableValueType(valueType, accepts) { + if (typeof valueType === 'undefined' || typeof accepts === 'undefined') throw new Error(); + + return format('The option does not accept values of type\n ' + valueType + '.\nValue\'s type must be one the following:\n ' + Object.keys(accepts).join(', ') + '.'); + } +}; \ No newline at end of file diff --git a/node_modules/csscomb-core/lib/format.js b/node_modules/csscomb-core/lib/format.js new file mode 100644 index 0000000..a169f64 --- /dev/null +++ b/node_modules/csscomb-core/lib/format.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (string) { + return string.replace(/\n\s*/gm, ' '); +}; \ No newline at end of file diff --git a/node_modules/csscomb-core/lib/plugin.js b/node_modules/csscomb-core/lib/plugin.js new file mode 100644 index 0000000..1491d0f --- /dev/null +++ b/node_modules/csscomb-core/lib/plugin.js @@ -0,0 +1,91 @@ +'use strict'; + +var Errors = require('./errors'); + +var Plugin = function Plugin(methods) { + for (var method in methods) { + this[method] = typeof method === 'function' ? methods[method].bind(this) : methods[method]; + } + + this.validate(); +}; + +Plugin.prototype = Object.defineProperties({ + /** + * Plugin's name. + * @type {String} + */ + name: null, + + /** + * List of supported syntaxes. + * @type {Array} + */ + syntax: null, + + /** + * @type {Object} + */ + accepts: null, + + /** + * @type {Function} + */ + process: null, + + /** + * @type {Function} + */ + lint: null, + + value_: null, + + validate: function validate() { + if (typeof this.name !== 'string' || !this.name) throw new Error(Errors.missingName()); + + if (!Array.isArray(this.syntax) || this.syntax.length === 0) throw new Error(Errors.missingSyntax()); + + if (typeof this.accepts !== 'object' && typeof this.setValue !== 'function') throw new Error(Errors.missingSetValue()); + } +}, { + value: { + get: function get() { + return this.value_; + }, + set: function set(value) { + var valueType = typeof value; + var pattern = this.accepts && this.accepts[valueType]; + + if (this.setValue) { + this.value_ = this.setValue(value); + return this.value_; + } + + if (!pattern) throw new Error(Errors.unacceptableValueType(valueType, this.accepts)); + + if (valueType === 'boolean') { + if (pattern.indexOf(value) < 0) throw new Error(Errors.unacceptableBoolean(pattern)); + this.value_ = value; + return this.value_; + } + + if (valueType === 'number') { + if (value !== parseInt(value)) throw new Error(Errors.unacceptableNumber()); + this.value_ = new Array(value + 1).join(' '); + return this.value_; + } + + if (valueType = 'string') { + if (!value.match(pattern)) throw new Error(Errors.unacceptableString(pattern)); + this.value_ = value; + return this.value_; + } + + throw new Error(Errors.implementSetValue(valueType)); + }, + configurable: true, + enumerable: true + } +}); + +module.exports = Plugin; \ No newline at end of file diff --git a/node_modules/csscomb-core/package.json b/node_modules/csscomb-core/package.json new file mode 100644 index 0000000..1f5b4ee --- /dev/null +++ b/node_modules/csscomb-core/package.json @@ -0,0 +1,77 @@ +{ + "_args": [ + [ + "csscomb-core@3.0.0-3.1", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb" + ] + ], + "_from": "csscomb-core@3.0.0-3.1", + "_id": "csscomb-core@3.0.0-3.1", + "_inCache": true, + "_installable": true, + "_location": "/csscomb-core", + "_nodeVersion": "0.12.4", + "_npmUser": { + "email": "tonyganch+github@gmail.com", + "name": "tonyganch" + }, + "_npmVersion": "2.10.1", + "_phantomChildren": {}, + "_requested": { + "name": "csscomb-core", + "raw": "csscomb-core@3.0.0-3.1", + "rawSpec": "3.0.0-3.1", + "scope": null, + "spec": "3.0.0-3.1", + "type": "version" + }, + "_requiredBy": [ + "/csscomb" + ], + "_resolved": "https://registry.npmjs.org/csscomb-core/-/csscomb-core-3.0.0-3.1.tgz", + "_shasum": "b411c8d7cfe0df3f2fe1df84d1bd64a6f0046c68", + "_shrinkwrap": null, + "_spec": "csscomb-core@3.0.0-3.1", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb", + "bugs": { + "url": "https://github.com/csscomb/core/issues" + }, + "dependencies": { + "gonzales-pe": "3.0.0-28", + "minimatch": "0.2.12", + "vow": "0.4.4", + "vow-fs": "0.3.2" + }, + "description": "Framework for writing postprocessors", + "devDependencies": { + "jscoverage": "0.5.x", + "mocha": "1.20.x" + }, + "directories": {}, + "dist": { + "shasum": "b411c8d7cfe0df3f2fe1df84d1bd64a6f0046c68", + "tarball": "http://registry.npmjs.org/csscomb-core/-/csscomb-core-3.0.0-3.1.tgz" + }, + "gitHead": "d2f98fd10ab2141ab7c87924d39333e85af0e38f", + "homepage": "https://github.com/csscomb/core#readme", + "license": "MIT", + "main": "lib/core.js", + "maintainers": [ + { + "name": "tonyganch", + "email": "tonyganch+github@gmail.com" + } + ], + "name": "csscomb-core", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/csscomb/core.git" + }, + "scripts": { + "cov": "mocha -r jscoverage --covout=html test >> /dev/null && open ./covreporter/index.html", + "test": "mocha" + }, + "version": "3.0.0-3.1" +} diff --git a/node_modules/csscomb-core/test/add_handler.js b/node_modules/csscomb-core/test/add_handler.js new file mode 100644 index 0000000..e494441 --- /dev/null +++ b/node_modules/csscomb-core/test/add_handler.js @@ -0,0 +1,32 @@ +// Depends on: _.setValue() + +var Comb = require('../lib/core'); +var assert = require('assert'); + +describe('_.addHandler()', function() { + it('Option has `setValue` method', function() { + var comb = new Comb(); + comb._.handlers = []; + comb._.configuredOptions = {}; + var option = { + name: 'nani', + setValue: function(value) { return value.toUpperCase(); } + }; + comb._.addHandler(option, 'foo'); + assert.deepEqual([option], comb._.handlers); + assert.equal('FOO', comb._.configuredOptions.nani); + }); + + it('Option has no `setValue` method', function() { + var comb = new Comb(); + comb._.handlers = []; + comb._.configuredOptions = {}; + var option = { + accepts: {string: /^foo$/}, + name: 'nani' + }; + comb._.addHandler(option, 'foo'); + assert.deepEqual([option], comb._.handlers); + assert.equal('foo', comb._.configuredOptions.nani); + }); +}); diff --git a/node_modules/csscomb-core/test/configure.js b/node_modules/csscomb-core/test/configure.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/constructor.js b/node_modules/csscomb-core/test/constructor.js new file mode 100644 index 0000000..1457cc4 --- /dev/null +++ b/node_modules/csscomb-core/test/constructor.js @@ -0,0 +1,22 @@ +var Comb = require('../lib/core'); +var assert = require('assert'); + +describe('constructor', function() { + it('Passing no options to constructor', function() { + var comb = new Comb(); + assert.equal(null, comb._.handlers); + assert.deepEqual([], comb._.optionsOrder); + }); + + it('Passing an empty array of options to constructor', function() { + var comb = new Comb([]); + assert.equal(null, comb._.handlers); + assert.deepEqual([], comb._.optionsOrder); + }); + + it('Passing no options to constructor', function() { + var comb = new Comb(); + assert.equal(null, comb._.handlers); + }); + +}); diff --git a/node_modules/csscomb-core/test/get_options_order.js b/node_modules/csscomb-core/test/get_options_order.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/get_syntax.js b/node_modules/csscomb-core/test/get_syntax.js new file mode 100644 index 0000000..1129cda --- /dev/null +++ b/node_modules/csscomb-core/test/get_syntax.js @@ -0,0 +1,10 @@ +var Comb = require('../lib/core'); +var assert = require('assert'); + +describe('_.getSyntax()', function() { + it('Ok', function() { + var comb = new Comb(); + comb.syntax = 'css'; + assert.equal('css', comb.getSyntax()); + }); +}); diff --git a/node_modules/csscomb-core/test/get_value.js b/node_modules/csscomb-core/test/get_value.js new file mode 100644 index 0000000..bb4ef5c --- /dev/null +++ b/node_modules/csscomb-core/test/get_value.js @@ -0,0 +1,11 @@ +var Comb = require('../lib/core'); +var assert = require('assert'); + +describe('_.getSyntax()', function() { + it('Ok', function() { + var comb = new Comb(); + comb._.configuredOptions = {nani: 'foo'}; + assert.equal('foo', comb.getValue('nani')); + }); +}); + diff --git a/node_modules/csscomb-core/test/lint_directory.js b/node_modules/csscomb-core/test/lint_directory.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/lint_file.js b/node_modules/csscomb-core/test/lint_file.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/lint_path.js b/node_modules/csscomb-core/test/lint_path.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/lint_string.js b/node_modules/csscomb-core/test/lint_string.js new file mode 100644 index 0000000..10c0144 --- /dev/null +++ b/node_modules/csscomb-core/test/lint_string.js @@ -0,0 +1,19 @@ +// Depends on: _.lintTree() + +var Comb = require('../lib/core'); +var assert = require('assert'); + +describe('lintString()', function() { + it('Should lint', function() { + var comb = new Comb(); + var string = 'a{color:red}'; + var error = {line:1, column: 7, message: 'foo'}; + comb._.handlers = [{ + syntax: ['css'], + lint: function(node) { + if (node.content === 'red') return error; + } + }]; + assert.deepEqual([error], comb.lintString(string)); + }); +}); diff --git a/node_modules/csscomb-core/test/lint_tree.js b/node_modules/csscomb-core/test/lint_tree.js new file mode 100644 index 0000000..ef2c335 --- /dev/null +++ b/node_modules/csscomb-core/test/lint_tree.js @@ -0,0 +1,59 @@ +// Depends on: getSyntax(), gonzales + +var Comb = require('../lib/core'); +var assert = require('assert'); +var gonzales = require('gonzales-pe'); + +describe('lintTree()', function() { + it('Skip handlers that do not support given syntax', function() { + var comb = new Comb(); + var ast = {}; + comb.syntax = 'less'; + comb._.handlers = [{ + syntax: ['css'] + }]; + assert.deepEqual([], comb._.lintTree(ast)); + }); + + it('Skip handlers that have no `lint` method', function() { + var comb = new Comb(); + var ast = {}; + comb.syntax = 'css'; + comb._.handlers = [{ + syntax: ['css'] + }]; + assert.deepEqual([], comb._.lintTree(ast)); + }); + + it('Should lint, one error', function() { + var comb = new Comb(); + var ast = originalAST = gonzales.parse('a{color:red}'); + var error = {line:1, column: 7, message: 'foo'}; + comb.syntax = 'css'; + comb._.handlers = [{ + syntax: ['css'], + lint: function(node) { + if (node.content === 'red') return error; + } + }]; + assert.deepEqual([error], comb._.lintTree(ast)); + // Should not modify ast: + assert.deepEqual(originalAST, ast); + }); + + it('Should lint, multiple errors', function() { + var comb = new Comb(); + var ast = originalAST = gonzales.parse('a{color:red}'); + var error = {line:1, column: 7, message: 'foo'}; + comb.syntax = 'css'; + comb._.handlers = [{ + syntax: ['css'], + lint: function(node) { + if (node.content === 'red') return [error, error]; + } + }]; + assert.deepEqual([error, error], comb._.lintTree(ast)); + // Should not modify ast: + assert.deepEqual(originalAST, ast); + }); +}); diff --git a/node_modules/csscomb-core/test/process_directory.js b/node_modules/csscomb-core/test/process_directory.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/process_file.js b/node_modules/csscomb-core/test/process_file.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/process_path.js b/node_modules/csscomb-core/test/process_path.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/process_string.js b/node_modules/csscomb-core/test/process_string.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/process_tree.js b/node_modules/csscomb-core/test/process_tree.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/set_value.js b/node_modules/csscomb-core/test/set_value.js new file mode 100644 index 0000000..3154464 --- /dev/null +++ b/node_modules/csscomb-core/test/set_value.js @@ -0,0 +1,73 @@ +var Comb = require('../lib/core'); +var assert = require('assert'); + +describe('_.setValue()', function() { + it('No options', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.setValue(); + }); + }); + + it('Empty options', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.setValue({}); + }); + }); + + it('Value of unacceptable type', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.setValue({boolean: [true]}, 'nani'); + }); + }); + + it('Not-Ok boolean', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.setValue({boolean: [true]}, false); + }); + }); + + it('Ok boolean', function() { + var comb = new Comb(); + var value = comb._.setValue({boolean: [true]}, true); + assert.equal(true, value); + }); + + it('Not-Ok number', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.setValue({number: true}, 3.6); + }); + }); + + it('Ok number', function() { + var comb = new Comb(); + var value = comb._.setValue({number: true}, 3); + assert.equal(' ', value); + }); + + it('Not-Ok string', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.setValue({string: /^nani$/}, 'foo'); + }); + }); + + it('Ok string', function() { + var comb = new Comb(); + var value = comb._.setValue({string: /^nani$/}, 'nani'); + assert.equal('nani', value); + }); + + it('setValue method not implemented', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.setValue({object: true}, {}); + }); + }); + +}); + diff --git a/node_modules/csscomb-core/test/should_process.js b/node_modules/csscomb-core/test/should_process.js new file mode 100644 index 0000000..7f601bd --- /dev/null +++ b/node_modules/csscomb-core/test/should_process.js @@ -0,0 +1,54 @@ +var Comb = require('../lib/core'); +var assert = require('assert'); +var minimatch = require('minimatch'); + +describe('_.shouldProcess()', function() { + it('No options', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.shouldProcess(); + }); + }); + + it('Empty list of excludes', function() { + var comb = new Comb(); + comb._.exclude = []; + var should = comb._.shouldProcess('/Users/tg/nani'); + assert.equal(true, should); + }); + + it('Not excluded', function() { + var comb = new Comb(); + comb._.exclude = [minimatch.Minimatch('/tmp/*')]; + var should = comb._.shouldProcess('/Users/tg/nani'); + assert.equal(true, should); + }); + + it('Not excluded, 2', function() { + var comb = new Comb(); + comb._.exclude = [minimatch.Minimatch('/tmp/*')]; + var should = comb._.shouldProcess('/tmp/foo/nani'); + assert.equal(true, should); + }); + + it('Excluded', function() { + var comb = new Comb(); + comb._.exclude = [minimatch.Minimatch('/tmp/*')]; + var should = comb._.shouldProcess('/tmp/nani'); + assert.equal(false, should); + }); + + it('Excluded, 2', function() { + var comb = new Comb(); + comb._.exclude = [minimatch.Minimatch('/tmp/**/*')]; + var should = comb._.shouldProcess('/tmp/foo/nani'); + assert.equal(false, should); + }); + + it('Excluded, 3, with slash at the end', function() { + var comb = new Comb(); + comb._.exclude = [minimatch.Minimatch('/tmp/nani')]; + var should = comb._.shouldProcess('/tmp/nani/'); + assert.equal(false, should); + }); +}); diff --git a/node_modules/csscomb-core/test/should_process_file.js b/node_modules/csscomb-core/test/should_process_file.js new file mode 100644 index 0000000..598967c --- /dev/null +++ b/node_modules/csscomb-core/test/should_process_file.js @@ -0,0 +1,27 @@ +var Comb = require('../lib/core'); +var assert = require('assert'); + +describe('_.shouldProcessFile()', function() { + it('No options', function() { + var comb = new Comb(); + assert.throws(function() { + comb._.shouldProcessFile(); + }); + }); + + it('Supported syntax', function() { + var comb = new Comb(); + comb._.supportedSyntaxes = ['css']; + comb._.exclude = []; + var should = comb._.shouldProcessFile('nani.css'); + assert.equal(true, should); + }); + + it('Not supported syntax', function() { + var comb = new Comb(); + comb._.supportedSyntaxes = ['css']; + comb._.exclude = []; + var should = comb._.shouldProcessFile('nani.js'); + assert.equal(false, should); + }); +}); diff --git a/node_modules/csscomb-core/test/update_option_order.js b/node_modules/csscomb-core/test/update_option_order.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb-core/test/use.js b/node_modules/csscomb-core/test/use.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/csscomb/.jscs.json b/node_modules/csscomb/.jscs.json deleted file mode 100644 index 8245a9c..0000000 --- a/node_modules/csscomb/.jscs.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "excludeFiles": [ - "node_modules/**", - "lib-cov/**" - ], - "requireCurlyBraces": [ - "else", - "while", - "do" - ], - "requireSpaceAfterKeywords": [ - "if", - "else", - "for", - "while", - "do", - "switch", - "return", - "catch" - ], - "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionExpression": { "beforeOpeningRoundBrace": true }, - "disallowMultipleVarDecl": true, - "disallowLeftStickedOperators": [ - "?", - "+", - "-", - "/", - "*", - "=", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<=" - ], - "disallowRightStickedOperators": [ - "?", - "+", - "/", - "*", - ":", - ",", - "=", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<=" - ], - "requireRightStickedOperators": ["!"], - "requireLeftStickedOperators": [","], - "disallowImplicitTypeConversion": [ - "numeric", - "boolean", - "binary", - "string" - ], - "disallowKeywords": ["with"], - "disallowKeywordsOnNewLine": ["else", "catch"], - "requireLineFeedAtFileEnd": true, - "validateJSDoc": { - "checkParamNames": true, - "checkRedundantParams": true, - "requireParamTypes": true - }, - "requireSpacesInsideObjectBrackets": "all", - "disallowSpacesInsideArrayBrackets": true, - "disallowSpaceAfterObjectKeys": true, - "disallowQuotedKeysInObjects": true -} diff --git a/node_modules/csscomb/.jshint-groups.js b/node_modules/csscomb/.jshint-groups.js deleted file mode 100644 index 95aa4d7..0000000 --- a/node_modules/csscomb/.jshint-groups.js +++ /dev/null @@ -1,35 +0,0 @@ -module.exports = { - options: { - eqeqeq: true, - evil: true, - expr: true, - forin: true, - immed: true, - indent: 4, - latedef: true, - maxdepth: 5, - maxlen: 120, - maxparams: 4, - newcap: true, - noarg: true, - noempty: true, - nonew: true, - quotmark: 'single', - trailing: true, - undef: true, - unused: true - }, - groups: { - js: { - options: { node: true }, - includes: ['lib/**/*.js'] - }, - test: { - options: { - node: true, - predef: ['describe', 'beforeEach', 'afterEach', 'it'] - }, - includes: ['test/*.js'] - } - } -}; diff --git a/node_modules/csscomb/.npmignore b/node_modules/csscomb/.npmignore deleted file mode 100644 index 4afc62a..0000000 --- a/node_modules/csscomb/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -lib-cov -node_modules -test/test-coverage.html - -.idea -*.iml - -.DS_Store diff --git a/node_modules/csscomb/CHANGELOG.md b/node_modules/csscomb/CHANGELOG.md index 35276a6..794cec0 100644 --- a/node_modules/csscomb/CHANGELOG.md +++ b/node_modules/csscomb/CHANGELOG.md @@ -1,5 +1,63 @@ # Changelog +## 3.1.7 - 2015-06-09 + +- Do not remove units from values starting from zeroes, like `0.5em` (#394) + +## 3.1.6 - 2015-06-09 +- Hotfix for issue when `unitless-zero` crashed on percentages in Less (#389) + +## 3.1.5 - 2015-05-27 +- Fixed dependencies + +## 3.1.4 - 2015-05-24 +- Fixed `space-after-opening-brace` option for empty media queries (#387) + +## 3.1.3 - 2015-05-20 +- Do not add extra space before combinators which go first in selectors (#381) + +## 3.1.2 - 2015-05-20 +- Fixed processing of hashes (#379) + +## 3.1.1 - 2015-05-20 +- Fixed `space-between-declarations` vs. media queries (#378) + +## 3.1.0 - 2015-05-19 +**Thanks to +[@1000ch](https://github.com/1000ch), +[@alexeykuzmin](https://github.com/alexeykuzmin), +[@jonrohan](https://github.com/jonrohan)** +- Used new Gonzales PE API +- Fixed nested properties (#319) +- Added support for symlinked configs +- Added support for configs with any extension + +## 3.0.4 - 2014-11-15 +**Thanks to +[@gonzalocasas](https://github.com/gonzalocasas), +[@tomByrer](https://github.com/tomByrer)** +- Improved docs +- Fixed Gonzales PE version + +## 3.0.3 - 2014-09-29 +**Thanks to +[@kizu](https://github.com/kizu), +[@necolas](https://github.com/necolas)** +- Improved README +- Added non-essential files to npmignore +- Renamed `CONTRIBUTE.md` to `CONTRIBUTING.md` +- Fixed unwanted removal of empty lines between nested rulesets (#317) + +## 3.0.2 - 2014-09-21 +- Fixed Gonzales PE version + +## 3.0.1 - 2014-08-18 +**Thanks to +[@mishanga](https://github.com/mishanga), +[@cust0dian](https://github.com/cust0dian)** +- Added `khtml` to list of vendor prefixes +- Updated docs + ## 3.0.0 - 2014-07-19 **Thanks to [@cvrebert](https://github.com/cvrebert), @@ -15,7 +73,7 @@ New: - Sass support - Leftovers (#160) -- Use [CSScomb Core](https://github/csscomb/core) +- Use [CSScomb Core](https://github.com/csscomb/core) - Plugins API (with `.use()` method) - `sort-order-fallback` (alphabetical sort order) - `space-before-colon` diff --git a/node_modules/csscomb/CONTRIBUTE.md b/node_modules/csscomb/CONTRIBUTE.md deleted file mode 100644 index 93ec341..0000000 --- a/node_modules/csscomb/CONTRIBUTE.md +++ /dev/null @@ -1,65 +0,0 @@ -# Contributing to CSSComb - - -## Pull requests - -1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes: -```bash -# Clone your fork of the repo into the current directory -git clone https://github.com//csscomb.js -# Navigate to the newly cloned directory -cd csscomb.js -# Assign the original repo to a remote called `upstream` -git remote add upstream https://github.com/csscomb/csscomb.js -``` - -2. If you cloned a while ago, get the latest changes from upstream: -```bash -git checkout dev -git pull upstream dev -``` -**IMPORTANT**: We are using `dev` branch for development, not `master`. - -3. Create a topic branch for your feature, change, or fix: -```bash -git checkout -b -``` - -4. Patches and features will not be accepted without tests. - Run `npm test` to check that all tests pass after you've made changes. - -5. Update the `README.md` if there were corresponding changes or new options. - -6. Locally rebase the upstream development branch into your topic branch: -```bash -git pull --rebase upstream dev -``` - -7. Push your topic branch up to your fork: -```bash -git push origin -``` - -8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) to a `dev` branch with a clear title and description. - - -## Maintainers - -### Submitting changes - -1. All non-trivial changes should be put up for review using GitHub Pull Requests. -2. Your change should not be merged into `dev`, without at least one "OK" comment - from another maintainer/collaborator on the project. -3. Once a feature branch has been merged into its target branch, please delete - the feature branch from the remote repository. - -### Releasing a new version - -1. Include all new functional changes in the CHANGELOG. -2. Use a dedicated commit to increment the version. The version needs to be - added to the `CHANGELOG.md` (inc. date) and the `package.json`. -3. The commit message must be of `v0.0.0` format. -4. Merge `dev` into `master`. -5. Create a tag for the version: `git tag v0.0.0`. -6. Push the changes and tags to GitHub: `git push origin dev master v0.0.0`. -7. Publish the new version to npm: `npm publish`. diff --git a/node_modules/csscomb/README.md b/node_modules/csscomb/README.md index 222c3d5..5889592 100644 --- a/node_modules/csscomb/README.md +++ b/node_modules/csscomb/README.md @@ -68,7 +68,7 @@ comb.processPath('assets/css'); ## 4. Contribute Anyone and everyone is welcome to contribute. -Please take a moment to review the [guidelines for contributing](CONTRIBUTE.md). +Please take a moment to review the [guidelines for contributing](CONTRIBUTING.md). ## Authors diff --git a/node_modules/csscomb/doc/configuration.md b/node_modules/csscomb/doc/configuration.md deleted file mode 100644 index 5c30eda..0000000 --- a/node_modules/csscomb/doc/configuration.md +++ /dev/null @@ -1,133 +0,0 @@ -# Configuration - -You must configure CSScomb before use. -There are a number of ways how you can do it. - -## Use one of predefined configs - -There are [several config -files](https://github.com/csscomb/csscomb.js/tree/master/config) -included in this project you can use right away: - -- `csscomb` -- `zen` -- `yandex` - -In CLI, `csscomb` is a default config file that is used unless you provide your -own. -In Node.js, you can pass config's name to constructor: - -```js -var Comb = require('csscomb'); -var comb = new Comb('yandex'); -``` - -Feel free to use predefined configs as examples: copy one of them and modify to -your taste. -Just remember to save the file as `.csscomb.json` in project's root. - -## Create custom config - -You can easily write your own configuration. -The only requirement is that config is valid JSON in order to work correctly. - -Here is an example: - -```json -{ - "exclude": ["node_modules/**"], - "verbose": true, - - "always-semicolon": true, - "color-case": "lower", - "color-shorthand": true, - "element-case": "lower", - "eof-newline": true, - "leading-zero": false, - "quotes": "single", - "remove-empty-rulesets": true, - "strip-spaces": true, - "unitless-zero": true, - "vendor-prefix-align": true -} -``` - -Take a look at [available options](options.md) and choose those you need. - -### Where to put config - -CSScomb will look for a file named `.csscomb.json`. -The best way is to put the file in your project's root. -However, if you want to use one config for several projects, it's fine to put -the file inside a parent folder. -CSScomb will look for a config file recursively up untill it reaches your -`HOME` directory. - -Remember that you can always set custom path. -In CLI: -```bash -csscomb -c path/to/config assets/css -``` - -In Node.js: -```js -var Comb = require('csscomb'); -var config = require('path/to/config'); -var comb = new Comb(config); -``` - -## Generate config from a template - -Instead of configuring all the options one by one, you can use a template file: -CSScomb will detect the coding style and use it as a config. -All existing properties except `sort-order` can be configured this way: - -```bash -csscomb -d example.css > .csscomb.json -``` - -This will create `.csscomb.json` based on options that can be detected in -`example.css` file. - -Let's say your template file has following content: - -```css -.foo -{ - width: #fff; -} -``` - -Generated config wiil then look this way: - -```json -{ - "remove-empty-rulesets": true, - "always-semicolon": true, - "color-case": "lower", - "color-shorthand": true, - "strip-spaces": true, - "eof-newline": true -} -``` - - -## Override template's settings - -You can use template inside existing config and then complete it or override -some of detected settings: - -```json -{ - "template": "example.css", - "leading-zero": false, - "vendor-prefix-align": true -} -``` - -This config will: - -1. detect all the options from the `example.css`, -1. then use `"leading-zero": false` instead of anything detected, -1. then use `"vendor-prefix-align": true` even if there were no prefixed -properties or values inside the `example.css`. diff --git a/node_modules/csscomb/doc/options.md b/node_modules/csscomb/doc/options.md deleted file mode 100644 index 06d7597..0000000 --- a/node_modules/csscomb/doc/options.md +++ /dev/null @@ -1,914 +0,0 @@ -# Configuration options - -There are a number of options you can use, all of them are switched off by -default. -Here is a full list in the same order they are applied while processing css: - -- [remove-empty-rulesets](#remove-empty-rulesets) -- [always-semicolon](#always-semicolon) -- [color-case](#color-case) -- [color-shorthand](#color-shorthand) -- [element-case](#element-case) -- [leading-zero](#leading-zero) -- [quotes](#quotes) -- [strip-spaces](#strip-spaces) -- [eof-newline](#eof-newline) -- [space-after-combinator](#space-after-combinator) -- [space-before-combinator](#space-before-combinator) -- [space-before-colon](#space-before-colon) -- [space-after-colon](#space-after-colon) -- [space-before-opening-brace](#space-before-opening-brace) -- [space-after-opening-brace](#space-after-opening-brace) -- [space-before-selector-delimiter](#space-before-selector-delimiter) -- [space-after-selector-delimiter](#space-after-selector-delimiter) -- [space-after-declaration](#space-after-declaration) -- [block-indent](#block-indent) -- [sort-order-fallback](#sort-order-fallback) -- [sort-order](#sort-order) -- [space-before-closing-brace](#space-before-closing-brace) -- [tab-size](#tab-size) -- [unitless-zero](#unitless-zero) -- [vendor-prefix-align](#vendor-prefix-align) - -Following options are ignored while processing `*.sass` files: - -- always-semicolon -- space-before-opening-brace -- space-after-opening-brace -- space-before-closing-brace -- space-after-declaration - - -## always-semicolon - -Whether to add a semicolon after the last value/mixin. - -Acceptable value: `true`. - -Example: `{ "always-semicolon": true }` - -```css -/* before */ -a { color: red } - -/* after */ -a { color: red; } -``` - -### always-semicolon vs. preprocessors - -In `*.scss` and `*.less` files semicolons are not added after `}` -even if it's part of a value. - -Example: `{ "always-semicolon": true }` - -```scss -// before -div { - color: tomato; - font: { - family: fantasy; - size: 16px - } - } - -// after -div { - color: tomato; - font: { - family: fantasy; - size: 16px; - } - } -``` - -## block-indent - -Set indent for code inside blocks, including media queries and nested rules. - -Acceptable values: - -* `{Number}` — number os whitespaces; -* `{String}` — string with whitespaces and tabs. Note that line breaks are not - allowed here. - -Example: `{ 'block-indent': 4 }` - -```scss -// Before: -a { -top: 0; - p { - color: tomato; -position: happy; - } -} - -// After: -a { - top: 0; - p { - color: tomato; - position: happy; - } - } -``` - -Example: `{ 'block-indent': '' }` - -```scss -// Before: -a { -top: 0; - p { - color: tomato; -position: happy; - } -} - -// After: -a { -top: 0; -p { -color: tomato; -position: happy; -} -} -``` - -## color-case - -Unify case of hexadecimal colors. - -Acceptable values: - -* `lower` — for lowercase, -* `upper` — for uppercase. - -Example: `{ "color-case": "lower" }` - -```css -/* before */ -a { color: #FFF } - -/* after */ -a { color: #fff } -``` - -## color-shorthand - -Whether to expand hexadecimal colors or use shorthands. - -Acceptable values: - -* `true` — use shorthands; -* `false` — expand hexadecimal colors to 6 symbols. - -Example: `{ "color-shorthand": true }` - -```css -/* before */ -b { color: #ffcc00 } - -/* after */ -b { color: #fc0 } -``` - -Example: `{ "color-shorthand": false }` - -```css -/* before */ -b { color: #fc0 } - -/* after */ -b { color: #ffcc00 } -``` - -## element-case - -Unify case of element selectors. - -Acceptable values: - -* `lower` — for lowercase; -* `upper` — for uppercase. - -Example: `{ "element-case": "upper" }` - -```css -/* before */ -li > a { color: red } - -/* after */ -LI > A { color: red } -``` - -## eof-newline - -Add/remove line break at EOF. - -Acceptable values: - -* `true` — add line break; -* `false` – remove line break. - -Example: `{ "eof-newline": true }` - -`a { color: red }` → `a { color: red }\n` - -Example: `{ "eof-newline": false }` - -`a { color: red }\n` → `a { color: red }` - -## exclude - -List files that should be ignored while combing. - -Acceptable value: - -* `{String[]}` — array of - [Ant path patterns](http://ant.apache.org/manual/dirtasks.html#patterns). - -Example: `{ "exclude": ["node_modules/**"] }` — exclude all files and -directories under `node_modules` dir. - -## leading-zero - -Add/remove leading zero in dimensions. - -Acceptable values: - - * `true` — add leading zero; - * `false` — remove leading zero. - -Example: `{ "leading-zero": false }` - -```css -/* before */ -p { padding: 0.5em } - -/* after */ -p { padding: .5em } -``` - -## quotes - -Unify quotes style. - -Acceptable values: - -* `single` — transform all `"` to `'`; -* `double` — transform all `'` to `"`. - -Example: `{ "quotes": "single" }` - -```css -/* before */ -p[href^="https://"]:before { content: "secure" } - -/* after */ -p[href^='https://']:before { content: 'secure' } -``` - -## remove-empty-rulesets - -Remove all rulesets that contain nothing but spaces. - -Acceptable value: `true` - -Example: `{ "remove-empty-rulesets": true }`. - -`a { color: red; } p { /* hey */ } b { }` → `a { color: red; } p { /* hey */ } ` - -## sort-order - -Set sort order. - -**Note**: Use one of [predefined -configs](https://github.com/csscomb/csscomb.js/tree/master/config) -as an example. - -Acceptable values: - -* `{Array}` of rules -* `{Array}` of arrays of rules for groups separation - -Example: `{ "sort-order": [ "margin", "padding" ] }` - -```css -/* before */ -p { - padding: 0; - margin: 0; -} - -/* after */ -p { - margin: 0; - padding: 0; -} -``` - -Example: `{ "sort-order": [ [ "margin", "padding" ], [ "border", "background" ] ] }` - -```css -/* before */ -p { - background: none; - border: 0; - margin: 0; - padding: 0; -} - -/* after */ -p { - margin: 0; - padding: 0; - - border: 0; - background: none; -} -``` - -### sort-order vs. preprocessors - -If you sort properties in `*.scss` or `*.less` files, you can use one of 3 -keywords in your config: - -* `$variable` — for variable declarations (e.g. `$var` in Sass or `@var` in LESS); -* `$include` — for included mixins (e.g. `@include ...` and `@extend ...` in Sass - or `.mixin()` in LESS); -* `$import` — for `@import` rules. - -Example: `{ "sort-order": [ [ "$variable" ], [ "$include" ], [ "top", "padding" ] ] }` - -```scss -/* before */ -p { - padding: 0; - @include mixin($color); - $color: tomato; - top: 0; -} - -/* after */ -p { - $color: tomato; - - @include mixin($color); - - top: 0; - padding: 0; -} -``` - -### sort-order vs. leftovers - -When there are properties that are not mentioned in the `sort-order` option, they are inserted after all the sorted properties in the new group in the same order they were in the source stylesheet. - -You can override this by using a “leftovers” token: `...` — just place it either in its own group, or near other properties in any other group and CSSComb would place all the properties that were not sorted where the `...` was in `sort-order`. - -So, with this value: - -``` json -{ - "sort-order": [ - ["$variable"], - ["position"], - ["...", "border"], - ["$include"], - ["font"] - ] -} -``` - -everything would go into five groups: variables, then group with `position`, then group containing all the leftovers plus the `border`, then group with all includes and then the `font`. - -## sort-order-fallback - -Apply a special sort order for properties that are not specified in `sort-order` -list. -Works great with [leftovers](#sort-order-vs-leftovers). -**Note:** This option is applied only if [sort order](#sort-order) list is -provided. - -Acceptable values: - -* `abc` - sort unknown options alphabetically. - -Example: `{ 'sort-order-fallback': 'abc', 'sort-order': ['top'] }` - -```scss -// Before: -a { - height: 100px; - color: tomato; - top: 0; -} - -// After: -a { - top:0; - - color:tomato; - height: 100px; -} -``` - -Example: `{ 'sort-order-fallback': 'abc', 'sort-order': ['...'] }` - -```scss -// Before: -a { - height: 100px; - color: tomato; - top: 0; -} - -// After: -a { - color:tomato; - height: 100px; - top:0; -} -``` - -## space-after-colon - -Set space after `:` in declarations. - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-after-colon': '' }` - -```scss -// Before: -a { - top: 0; - color: tomato; -} - -// After: -a { - top:0; - color:tomato; -} -``` - -Example: `{ 'space-after-colon': 1 }` - -```scss -// Before: -a { - top:0; - color:tomato; -} - -// After: -a { - top: 0; - color: tomato; -} -``` - -## space-after-combinator - -Set space after combinator (for example, in selectors like `p > a`). - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-after-combinator': 1 }` - -```scss -// Before: -p>a { color: panda; } - -// After: -p> a { color: panda; } -``` - -Example: `{ 'space-after-combinator': '\n ' }` - -```scss -// Before: -p > a { color: panda; } - -// After: -p > - a { color: panda; } -``` - -## space-after-declaration - -Set space after declaration (i.e. `color: tomato`). - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-after-declaration': 1 }` - -```scss -// Before: -a { - color: panda; - top: 0; - /* comment */ - right: 0; - position: absolute - } - -// After: -a { - color: panda; top: 0; /* comment */ - right: 0; position: absolute } -``` - -Example: `{ 'space-after-declaration': '\n ' }` - -```scss -// Before: -a { - color: panda; top: 0; right: 0} - -// After: -a { - color: panda; - top: 0; - right: 0; - } -``` - - -## space-after-opening-brace - -Set space after `{`. - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-after-opening-brace': 1 }` - -```scss -// Before: -a {color: panda;} - -// After: -a { color: panda;} -``` - -Example: `{ 'space-after-opening-brace': '\n' }` - -```scss -// Before: -a{color: panda;} - -// After: -a{ -color: panda;} -``` - -## space-after-selector-delimiter - -Set space after selector delimiter. - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-after-selector-delimiter': 1 }` - -```scss -// Before: -a,b{ - color: panda; - } - -// After: -a, b { - color: panda; - } -``` - -Example: `{ 'space-after-selector-delimiter': '\n' }` - -```scss -// Before: -a, b{ - color: panda; - } - -// After: -a, -b{ - color: panda; - } -``` - -## space-before-closing-brace - -Set space before `}`. - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-before-closing-brace': 1 }` - -```scss -// Before: -a { - top: 0; - color: tomato; -} - -// After: -a { - top: 0; - color: tomato; } -``` - -Example: `{ 'space-before-closing-brace': '\n' }` - -```scss -// Before: -a { - top: 0; - color: tomato;} - -// After: -a { - top: 0; - color: tomato; -} -``` - -## space-before-colon - -Set space before `:` in declarations. - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-before-colon': '' }` - -```scss -// Before: -a { - top : 0; - color : tomato; -} - -// After: -a { - top: 0; - color: tomato; -} -``` - -Example: `{ 'space-before-colon': 1 }` - -```scss -// Before: -a { - top:0; - color:tomato; -} - -// After: -a { - top :0; - color :tomato; -} -``` - -## space-before-combinator - -Set space before combinator (for example, in selectors like `p > a`). - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-before-combinator': 1 }` - -```scss -// Before: -p>a { color: panda; } - -// After: -p >a { color: panda; } -``` - -Example: `{ 'space-before-combinator': '\n' }` - -```scss -// Before: -p > a { color: panda; } - -// After: -p -> a { color: panda; } -``` - -## space-before-opening-brace - -Set space before `{`. - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-before-opening-brace': 1 }` - -```scss -// Before: -a{ - color: panda; - } - -// After: -a { - color: panda; - } -``` - -Example: `{ 'space-before-opening-brace': '\n' }` - -```scss -// Before: -a{ - color: panda; - } - -// After: -a -{ - color: panda; - } -``` - -## space-before-selector-delimiter - -Set space before selector delimiter. - -Acceptable values: - -* `{Number}` — number of whitespaces; -* `{String}` — string with whitespaces, tabs or line breaks. - -Example: `{ 'space-before-selector-delimiter': 0 }` - -```scss -// Before: -a , b{ - color: panda; - } - -// After: -a, b { - color: panda; - } -``` - -Example: `{ 'space-before-selector-delimiter': '\n' }` - -```scss -// Before: -a, b{ - color: panda; - } - -// After: -a -,b{ - color: panda; - } -``` - -## strip-spaces - -Whether to trim trailing spaces. - -Acceptable value: `true`. - -Example: `{ "strip-spaces": true }` - -`a { color: red } \n \n \n` → `a { color: red }\n` - -`a { color: red }\t` → `a { color: red }` - -## tab-size - -Set tab size (number of spaces to replace hard tabs). - -Acceptable values: - -* `{Number}` — number of whitespaces; - -Example: `{ 'tab-size': 2 }` - -```scss -// Before: -a{ - color: panda; - } - -// After: -a { - color: panda; - } -``` - -## template - -**Note:** See [configuration docs](configuration.md#override-templates-settings) -for more information. - -Acceptable value: - -* `{String}` — path to the `.css` file. - -Example: `{ "template": "example.css" }` - -## unitless-zero - -Whether to remove units in zero-valued dimensions. - -Acceptable value: `true`. - -Example: `{ "unitless-zero": true }` - -```css -/* before */ -img { border: 0px } - -/* after */ -img { border: 0 } -``` - -## vendor-prefix-align - -Whether to align prefixes in properties and values. - -Acceptable value: `true`. - -Example: `{ "vendor-prefix-align": true }` - -```css -/* before */ -a -{ - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - background: -webkit-linear-gradient(top, #fff 0, #eee 100%); - background: -moz-linear-gradient(top, #fff 0, #eee 100%); - background: linear-gradient(to bottom, #fff 0, #eee 100%); -} - -/* after */ -a -{ - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - background: -webkit-linear-gradient(top, #fff 0, #eee 100%); - background: -moz-linear-gradient(top, #fff 0, #eee 100%); - background: linear-gradient(to bottom, #fff 0, #eee 100%); -} -``` - -## verbose - -Whether to use `--verbose` option in CLI. - -Acceptable value: `true`. - -Example: `{ "verbose": true }` - -```bash -csscomb ./test - -✓ test/integral.origin.css - test/integral.expect.css - -2 files processed -1 file fixed -96 ms spent -``` diff --git a/node_modules/csscomb/doc/plugins.md b/node_modules/csscomb/doc/plugins.md deleted file mode 100644 index 87ed30c..0000000 --- a/node_modules/csscomb/doc/plugins.md +++ /dev/null @@ -1,6 +0,0 @@ -# Plugins - -## Using external plugins - -## Writing your own plugins - diff --git a/node_modules/csscomb/doc/usage-cli.md b/node_modules/csscomb/doc/usage-cli.md deleted file mode 100644 index 3435e36..0000000 --- a/node_modules/csscomb/doc/usage-cli.md +++ /dev/null @@ -1,101 +0,0 @@ -# Command Line usage - -To run `csscomb`: - -```bash -csscomb path[ path[...]] -``` - -`path` can be either a directory or a file: - -```bash -csscomb assets/css public/styles.css -``` - -If you installed the package locally, use local bin file instead: - -```bash -./node_modules/.bin/csscomb assets/css public/styles.css -``` - -## Options - -### help - -If you run `csscomb -h`, it will show some helpful information: - -```bash -csscomb -h - - Usage: csscomb [options] - - Options: - - -h, --help output usage information - -V, --version output the version number - -v, --verbose verbose mode - -c, --config [path] configuration file path - -d, --detect detect mode (would return detected options) - -l, --lint in case some fixes needed returns an error -``` - -### config - -If you want to use custom config instead of predefined `csscomb.json` just -put a file named `.csscomb.json` to project's root (see [configuration -docs](configuration.md#where-to-put-config) for more information). -However, if for some reason you would like to use custom path, do it this way: - -```bash -csscomb -c path/to/config styles.css -``` - -### detect - -If you want to generate a config file based on a template file, run: - -```bash -csscomb -d example.css > .csscomb.json -``` - -See [configuration docs](configuration.md#generate-config-from-a-template) for -more information. - -### lint - -CSScomb can be used as a linter, i.e. telling you what should be changed instead -of modifying anything. -This option should be combined with `--verbose`: - -```bash -csscomb -lv assets/css - - assets/css/main.scss -! assets/css/main.scss -! assets/css/main.scss -! assets/css/main.scss - -4 files processed -0 files fixed -spent: 30ms -``` - -Exclamation mark is a sign that something is wrong with the file. - -### verbose - -If you are curious or you just like a lot of output info, `--verbose` is your -good friend: - -```bash -csscomb -v assets/css - - assets/css/main.scss -✓ assets/css/main.scss -✓ assets/css/main.scss -✓ assets/css/main.scss - -4 files processed -3 files fixed -spent: 33ms -``` diff --git a/node_modules/csscomb/doc/usage-node.md b/node_modules/csscomb/doc/usage-node.md deleted file mode 100644 index 0d28fb3..0000000 --- a/node_modules/csscomb/doc/usage-node.md +++ /dev/null @@ -1,228 +0,0 @@ -# Node.js module usage - -CSScomb can be used in Node.js projects: inside a plugin or as a dev tool. - -Workflow can look like this: - -```js -// Require: -var Comb = require('csscomb'); -var config = require('path/to/config'); - -// Configure: -var comb = new Comb(config); - -// Use: -comb.processPath('style.css'); -``` - -## new Comb(config) - -Create instance's prototype. - -Parameters: - -* `{String|Object} config` — config that should be used after creating - instance. Should be JSON or one of predefined config's name. Optional. - -Example: Create CSScomb instance and configure it using predefined `yandex` sort -order - -```js -var comb = new Comb('yandex'); - -// This is shortcut for: -var comb = new Comb(); -var config = Comb.getConfig('yandex'); -comb.configure(config); -``` - -Example: Create CSScomb instance and configure it using config object - -```js -var config = require('path/to/config'); -var comb = new Comb(config); - -// This is shortcut for: -var comb = new Comb(); -comb.configure(config); -``` - -## Comb.getConfig(name) - -Get one of predefined configs. - -Note that this is a static method. - -Parameters: - -* `{String} name` — config's name. Should be one of the following: - `csscomb`, `zen` or `yandex`. - -Example: Configure CSScomb using predefined `zen` sort order that is slightly -modified. - -```js -var config = Comb.getConfig('zen'); -config['always-semicolon'] = true; -comb.configure(config); -``` - -## Comb.detectInFile(path, options) - -Get config options that can be detected in a file. - -Note that this is a static method. - -Parameters: - -* `{String} path` — path to stylesheet -* `{Array} options` — list of options to detect. Optional. By default tries - to detect all available options. - -Example: Configure CSScomb using template file - -```js -var config = comb.detectInFile('template.css'); -comb.configure(config); -``` - -## Comb.detectInString(string, options) - -Get config options that can be detected in a string. - -Note that this is a static method. - -Parameters: - -* `{String} string` — stylesheet -* `{Array} options` — list of options to detect. Optional. By default tries - to detect all available options. - -Example: Configure CSScomb using template stylesheet - -```js -var css = 'a {top: 0; left: 0}'; -var config = comb.detectInString(css); -comb.configure(config); -``` - -## configure(config) - -Configure CSScomb. - -Parameters: - -* `{Object} config` — valid JSON object. - -Example: Create and pass a config object to the method - -```js -var config = { 'always-semicolon': true }; -comb.configure(config); -``` - -Example: Use config stored in a file - -```js -var config = require('path/to/.csscomb.json'); -comb.configure(config); -``` - -See [configuration docs](configuration.md) for more information. - -## getValue(optionName) - -Get value of a given option. - -Parameters: - -* `{String} optionName` — name of option which value you want to get - -Example: Get configured sort order - -```js -comb.getValue('sort-order'); -``` - -## processPath(path) - -Comb a file or a directory. - -Parameters: - -* `{String} path` — path to file or directory - -**Warning:** This method rewrites the file. - -Example: Process one file - -```js -comb.processPath('main.scss'); -``` - -Example: Process whole directory - -```js -comb.processPath('assets/css'); -``` - -## processDirectory(path) - -Comb all supported files in a directory. - -Parameters: - -* `{String} path` — path to a directory - -**Warning:** This method rewrites the files. - -Example: - -```js -comb.processDirectory('public/css'); -``` - -## processFile(path) - -Comb one file. - -Parameters: - -* `{String} path` — path to a file - -If file's syntax is not supported, the file will be ignored. - -**Warning:** This method rewrites the file. - -Example: - -```js -comb.processFile('print.less'); -``` - -## processString(string, syntax, filename) - -Comb a stylesheet. - -Parameters: - -* `{String} text` — stylesheet that should be combed. -* `{String} syntax` — style's syntax. Optional. Default value is `css`. -* `{String} filename` — file's name that is used to print possible errors. - Optional. - -Example: Comb a css string - -```js -var css = 'a {top: 0; left: 0}'; -var combedCSS = comb.processString(css); -``` - -Example: Comb a less string - -```js -var less = '@color: tomato; a {color: @color}'; -var combedLESS = comb.processString(less, 'less'); -``` - diff --git a/node_modules/csscomb/lib/csscomb.js b/node_modules/csscomb/lib/csscomb.js index aeeac16..94b4f76 100644 --- a/node_modules/csscomb/lib/csscomb.js +++ b/node_modules/csscomb/lib/csscomb.js @@ -17,7 +17,7 @@ function cssToAST(text, syntax, filename) { var tree; try { - tree = gonzales.srcToAST({ syntax: syntax, src: text }); + tree = gonzales.parse(text, { syntax: syntax }); } catch (e) { throw new Error('Parsing error' + fileInfo + ': ' + e.message); } @@ -56,22 +56,16 @@ function getHandler(optionName) { * @param {Object} detectedOptions */ function detectInNode(node, level, handler, detectedOptions) { - node.forEach(function(node) { - if (!Array.isArray(node)) return; - - var nodeType = node.shift(); - var detected = handler.detect(nodeType, node, level); + node.map(function(tree) { + var detected = handler.detect(tree); var variants = detectedOptions[handler.name]; if (typeof detected === 'object') { variants.push.apply(variants, detected); } else if (typeof detected !== 'undefined') { variants.push(detected); } - node.unshift(nodeType); - - if (nodeType === 'atrulers' || nodeType === 'block') level++; - detectInNode(node, level, handler, detectedOptions); + //if (nodeType === 'atrulers' || nodeType === 'block') level++; }); } @@ -91,7 +85,7 @@ function detectInTree(tree, handlers) { handlers.forEach(function(handler) { detectedOptions[handler.name] = []; // TODO: Pass all parameters as one object? - detectInNode(['tree', tree], 0, handler, detectedOptions); + detectInNode(tree, 0, handler, detectedOptions); }); return detectedOptions; } @@ -187,26 +181,36 @@ var CSScomb = function(config) { */ /** - * Gets one of configuration files from `config` directory. + * Gets one of configuration files from configs' directory. * - * @param {String} name Config's name: 'csscomb', 'zen' or 'yandex' + * @param {String} name Config's name, e.g. 'yandex' * @returns {Object} Configuration object */ CSScomb.getConfig = function getConfig(name) { - // Names of predefined configs: - var CONFIGS = ['csscomb', 'zen', 'yandex']; - name = name || 'csscomb'; + var DEFAULT_CONFIG_NAME = 'csscomb'; + name = name || DEFAULT_CONFIG_NAME; if (typeof name !== 'string') { throw new Error('Config name must be a string.'); } - if (CONFIGS.indexOf(name) < 0) { + var CONFIG_DIR_PATH = '../config'; + var availableConfigsNames = fs.readdirSync(__dirname + '/' + CONFIG_DIR_PATH) + .map(function(configFileName) { + return configFileName.split('.')[0]; // strip file extension(s) + }); + + if (availableConfigsNames.indexOf(name) < 0) { + var configsNamesAsString = availableConfigsNames + .map(function(configName) { + return '\'' + configName + '\''; + }) + .join(', '); throw new Error('"' + name + '" is not a valid config name. Try one of ' + - 'the following: \'csscomb\', \'zen\' or \'yandex\'.'); + 'the following: ' + configsNamesAsString + '.'); } - return require('../config/' + name + '.json'); + return require(CONFIG_DIR_PATH + '/' + name + '.json'); }; /** @@ -221,7 +225,7 @@ CSScomb.getCustomConfig = function getCustomConfig(configPath) { configPath = configPath || CSScomb.getCustomConfigPath(); try { - config = require(configPath); + config = JSON.parse(fs.readFileSync(configPath, 'utf8')); } catch (e) { config = null; } @@ -243,7 +247,7 @@ CSScomb.getCustomConfigPath = function getCustomConfigPath(configPath) { configPath = configPath || path.join(process.cwd(), '.csscomb.json'); // If we've finally found a config, return its path: - if (fs.existsSync(configPath)) return configPath; + if (fs.existsSync(configPath)) return fs.realpathSync(configPath); // If we are in HOME dir already and yet no config file, return a default // one from our package. diff --git a/node_modules/csscomb/lib/format.js b/node_modules/csscomb/lib/format.js new file mode 100644 index 0000000..851e8d9 --- /dev/null +++ b/node_modules/csscomb/lib/format.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (string) { + return string.replace(/\n\s+/gm, ' '); +}; \ No newline at end of file diff --git a/node_modules/csscomb/lib/gonzales.js b/node_modules/csscomb/lib/gonzales.js new file mode 100644 index 0000000..3bb1525 --- /dev/null +++ b/node_modules/csscomb/lib/gonzales.js @@ -0,0 +1,4 @@ +// jscs:disable +'use strict'; + +module.exports = require('../node_modules/csscomb-core/node_modules/gonzales-pe'); \ No newline at end of file diff --git a/node_modules/csscomb/lib/options/always-semicolon.js b/node_modules/csscomb/lib/options/always-semicolon.js index 4c5853c..e84716d 100644 --- a/node_modules/csscomb/lib/options/always-semicolon.js +++ b/node_modules/csscomb/lib/options/always-semicolon.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'always-semicolon', @@ -7,77 +9,65 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType === 'block') { - for (var i = node.length; i--;) { - var currentNode = node[i]; - var currentNodeType = currentNode[0]; - var nodeWithoutSemicolon; - - // Skip nodes that already have `;` at the end: - if (currentNodeType === 'declDelim') break; + process: function(node) { + var nodeWithoutSemicolon; - // Add semicolon only after declarations and includes. - // If current node is include, insert semicolon right into it. - // If it's declaration, look for value node: - if (currentNodeType === 'include') { - nodeWithoutSemicolon = currentNode; - } else if (currentNodeType === 'declaration') { - for (var k = currentNode.length; k--;) { - if (currentNode[k][0] === 'value') { - nodeWithoutSemicolon = currentNode[k]; - break; - } - } - } else { - continue; - } + if (!node.is('block')) return; - var space = []; - var isBlock = false; + mainLoop: + for (var i = node.length; i--;) { + var currentNode = node.get(i); - // Check if there are spaces and comments at the end of the node: - for (var j = nodeWithoutSemicolon.length; j--;) { - var lastNode = nodeWithoutSemicolon[j][0]; - // If the node's last child is block, do not add semicolon: - // TODO: Add syntax check and run the code only for scss - if (lastNode === 'block') { - isBlock = true; - break; - } else if (['s', 'commentML', 'commentSL'].indexOf(lastNode) === -1) break; + // Skip nodes that already have `;` at the end: + if (currentNode.is('declarationDelimiter')) break; - space.unshift(nodeWithoutSemicolon[j]); - } + // Add semicolon only after declarations and includes. + // If current node is include, insert semicolon right into it. + // If it's declaration, look for value node: + if (currentNode.is('include')) { + nodeWithoutSemicolon = currentNode; + } else if (currentNode.is('declaration')) { + nodeWithoutSemicolon = currentNode.last('value'); + } else { + continue; + } - if (isBlock) break; + // Check if there are spaces and comments at the end of the node: + for (var j = nodeWithoutSemicolon.length; j--; ) { + var lastNode = nodeWithoutSemicolon.get(j); - // Temporarily remove last spaces and comments and insert `;` - // before them: - nodeWithoutSemicolon.splice(nodeWithoutSemicolon.length - space.length); - node.splice.apply(node, [i + 1, 0, ['declDelim']].concat(space)); - break; + // If the node's last child is block, do not add semicolon: + // TODO: Add syntax check and run the code only for scss + if (lastNode.is('block')) { + break mainLoop; + } else if (!lastNode.is('space') && + !lastNode.is('multilineComment') && + !lastNode.is('singlelineComment')) { + j++; + break; + } } + + var declDelim = gonzales.createNode({ type: 'declarationDelimiter', content: ';' }); + nodeWithoutSemicolon.insert(j, declDelim); + break; } }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType === 'block') { - for (var i = node.length; i--;) { - var nodeItem = node[i]; - var type = nodeItem[0]; - if (type === 'declDelim') return true; + detect: function(node) { + if (!node.is('block')) return; - if (type === 'declaration') return false; - } + for (var i = node.length; i--;) { + var nodeItem = node.get(i); + if (nodeItem.is('declarationDelimiter')) return true; + if (nodeItem.is('declaration')) return false; } } }; diff --git a/node_modules/csscomb/lib/options/block-indent.js b/node_modules/csscomb/lib/options/block-indent.js index 4cc9e05..3bc12aa 100644 --- a/node_modules/csscomb/lib/options/block-indent.js +++ b/node_modules/csscomb/lib/options/block-indent.js @@ -1,21 +1,29 @@ module.exports = (function() { - function processStylesheet(node) { - var spaces; - var whitespaceNode; - var i; + var syntax; + var value; - for (i = node.length; i--;) { - whitespaceNode = node[i]; + function processNode(node, level) { + level = level || 0; - if (whitespaceNode[0] !== 's') continue; + // XXX: Hack for braces + if (node.is('braces') || node.is('id')) return; - spaces = whitespaceNode[1].replace(/\n[ \t]+/gm, '\n'); + for (var i = 0; i < node.length; i++) { + var n = node.get(i); + if (!n) continue; - if (spaces === '') { - node.splice(i, 1); - } else { - whitespaceNode[1] = spaces; + if (syntax === 'sass' && n.is('block')) { + processSassBlock(n, level, value); } + + // Continue only with space nodes inside {...}: + if (syntax !== 'sass' && level !== 0 && n.is('space')) { + processSpaceNode(n, level, value); + } + + if (n.is('block') || n.is('atrulers')) level++; + + processNode(n, level); } } @@ -25,15 +33,15 @@ module.exports = (function() { var i; for (i = node.length; i--;) { - whitespaceNode = node[i]; + whitespaceNode = node.get(i); - if (whitespaceNode[0] !== 's') continue; + if (!whitespaceNode.is('space')) continue; - if (whitespaceNode[1] === '\n') continue; + if (whitespaceNode.content === '\n') continue; - spaces = whitespaceNode[1].replace(/[ \t]/gm, ''); + spaces = whitespaceNode.content.replace(/[ \t]/gm, ''); spaces += new Array(level + 2).join(value); - whitespaceNode[1] = spaces; + whitespaceNode.content = spaces; } } @@ -41,12 +49,12 @@ module.exports = (function() { var spaces; // Remove all whitespaces and tabs, leave only new lines: - spaces = node[0].replace(/[ \t]/gm, ''); + spaces = node.content.replace(/[ \t]/gm, ''); if (!spaces) return; spaces += new Array(level + 1).join(value); - node[0] = spaces; + node.content = spaces; } return { @@ -64,55 +72,61 @@ module.exports = (function() { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node - * @param {Number} level */ - process: function process(nodeType, node, level) { - var syntax = this.getSyntax(); - var value = this.getValue('block-indent'); + process: function process(node) { + var spaces; + var whitespaceNode; + var i; - if (nodeType === 'stylesheet') { - return processStylesheet(node); - } + if (!node.is('stylesheet')) return; - if (syntax === 'sass' && nodeType === 'block') { - return processSassBlock(node, level, value); - } + syntax = this.getSyntax(); + value = this.getValue('block-indent'); - // Continue only with space nodes inside {...}: - if (syntax !== 'sass' && level !== 0 && nodeType === 's') { - processSpaceNode(node, level, value); + + for (i = node.length; i--;) { + whitespaceNode = node.get(i); + + if (!whitespaceNode.is('space')) continue; + + spaces = whitespaceNode.content.replace(/\n[ \t]+/gm, '\n'); + + if (spaces === '') { + node.remove(i); + } else { + whitespaceNode.content = spaces; + } } + + processNode(node); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node - * @param {Number} level */ - detect: function(nodeType, node, level) { + detect: function(node) { var result = []; // Continue only with non-empty {...} blocks: - if (nodeType !== 'atrulers' && nodeType !== 'block' || !node.length) return; + if (!node.is('atrulers') && !node.is('block') || !node.length) + return; for (var i = node.length; i--;) { - var whitespaceNode = node[i]; - if (whitespaceNode[0] !== 's') continue; + var whitespaceNode = node.get(i); + if (!whitespaceNode.is('space')) continue; - var spaces = whitespaceNode[1]; + var spaces = whitespaceNode.content; var lastIndex = spaces.lastIndexOf('\n'); // Do not continue if there is no line break: if (lastIndex < 0) continue; // Number of spaces from beginning of line: - var spacesLength = spaces.slice(lastIndex + 1).length; - var arrayLength = Math.floor(spacesLength / (level + 1)) + 1; - result.push(new Array(arrayLength).join(' ')); + var spacesLength = spaces.slice(lastIndex + 1).length + 1; + result.push(new Array(spacesLength).join(' ')); } return result; diff --git a/node_modules/csscomb/lib/options/color-case.js b/node_modules/csscomb/lib/options/color-case.js index 239a178..ef1345c 100644 --- a/node_modules/csscomb/lib/options/color-case.js +++ b/node_modules/csscomb/lib/options/color-case.js @@ -7,33 +7,28 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - var value = this.getValue('color-case'); - if (nodeType === 'vhash') { - if (value === 'lower') { - node[0] = node[0].toLowerCase(); - } else if (value === 'upper') { - node[0] = node[0].toUpperCase(); - } - } + process: function(node) { + if (!node.is('color')) return; + + node.content = this.getValue('color-case') === 'lower' ? + node.content.toLowerCase() : + node.content.toUpperCase(); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType === 'vhash') { - if (node[0].match(/^[^A-F]*[a-f][^A-F]*$/)) { - return 'lower'; - } else if (node[0].match(/^[^a-f]*[A-F][^a-f]*$/)) { - return 'upper'; - } + detect: function(node) { + if (!node.is('color')) return; + + if (node.content.match(/^[^A-F]*[a-f][^A-F]*$/)) { + return 'lower'; + } else if (node.content.match(/^[^a-f]*[A-F][^a-f]*$/)) { + return 'upper'; } } }; diff --git a/node_modules/csscomb/lib/options/color-shorthand.js b/node_modules/csscomb/lib/options/color-shorthand.js index 14fdcc5..4e723bd 100644 --- a/node_modules/csscomb/lib/options/color-shorthand.js +++ b/node_modules/csscomb/lib/options/color-shorthand.js @@ -7,32 +7,28 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType === 'vhash') { - if (this.getValue('color-shorthand')) { - node[0] = node[0].replace(/(\w)\1(\w)\2(\w)\3/i, '$1$2$3'); - } else { - node[0] = node[0].replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3'); - } - } + process: function(node) { + if (!node.is('color')) return; + + node.content = this.getValue('color-shorthand') ? + node.content.replace(/(\w)\1(\w)\2(\w)\3/i, '$1$2$3') : + node.content.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3'); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType === 'vhash') { - if (node[0].match(/^\w{3}$/)) { - return true; - } else if (node[0].match(/^(\w)\1(\w)\2(\w)\3$/)) { - return false; - } + detect: function(node) { + if (!node.is('color')) return; + + if (node.content.match(/^\w{3}$/)) { + return true; + } else if (node.content.match(/^(\w)\1(\w)\2(\w)\3$/)) { + return false; } } }; diff --git a/node_modules/csscomb/lib/options/element-case.js b/node_modules/csscomb/lib/options/element-case.js index dae90e4..ab8b0fb 100644 --- a/node_modules/csscomb/lib/options/element-case.js +++ b/node_modules/csscomb/lib/options/element-case.js @@ -7,48 +7,43 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'selector' && - nodeType !== 'arguments') return; - - for (var x = node.length; x--;) { - var selector = node[x]; - if (selector[0] !== 'simpleselector') continue; - - for (var i = selector.length; i--;) { - var simpleselector = selector[i]; - if (!Array.isArray(simpleselector) || - simpleselector[0] !== 'ident') continue; - - simpleselector[1] = this.getValue('element-case') === 'lower' ? - simpleselector[1].toLowerCase() : - simpleselector[1].toUpperCase(); - } - } + process: function(node) { + if (!node.is('selector') && + !node.is('arguments')) return; + + var value = this.getValue('element-case'); + + node.forEach('simpleSelector', function(selector) { + selector.forEach('ident', function(ident) { + ident.content = value === 'lower' ? + ident.content.toLowerCase() : + ident.content.toUpperCase(); + }); + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'simpleselector') return; + detect: function(node) { + if (!node.is('selector') && + !node.is('arguments')) return; var variants = []; - for (var i = node.length; i--;) { - var nodeItem = node[i]; - if (nodeItem[0] !== 'ident') continue; - if (nodeItem[1].match(/^[a-z]+$/)) { - variants.push('lower'); - } else if (nodeItem[1].match(/^[A-Z]+$/)) { - variants.push('upper'); - } - } + + node.forEach('simpleSelector', function(selector) { + selector.forEach('ident', function(ident) { + if (ident.content.match(/^[a-z]+$/)) { + variants.push('lower'); + } else if (ident.content.match(/^[A-Z]+$/)) { + variants.push('upper'); + } + }); + }); return variants; } }; diff --git a/node_modules/csscomb/lib/options/eof-newline.js b/node_modules/csscomb/lib/options/eof-newline.js index fa8d34e..7b914c9 100644 --- a/node_modules/csscomb/lib/options/eof-newline.js +++ b/node_modules/csscomb/lib/options/eof-newline.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'eof-newline', @@ -7,34 +9,33 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType === 'stylesheet') { - var lastChild = node[node.length - 1]; - if (lastChild[0] !== 's') { - lastChild = ['s', '']; - node.push(lastChild); - } - lastChild[1] = lastChild[1].replace(/\n$/, ''); - if (this.getValue('eof-newline')) lastChild[1] += '\n'; + process: function(node) { + if (!node.is('stylesheet')) return; + + var lastChild = node.last(); + if (!lastChild.is('space')) { + lastChild = gonzales.createNode({ type: 'space', content: '' }); + node.content.push(lastChild); } + lastChild.content = lastChild.content.replace(/\n$/, ''); + if (this.getValue('eof-newline')) lastChild.content += '\n'; }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType === 'stylesheet') { - if (node[node.length - 1][0] === 's' && node[node.length - 1][1].indexOf('\n') !== -1) { - return true; - } else { - return false; - } + detect: function(node) { + if (!node.is('stylesheet')) return; + + var lastChild = node.last(); + if (lastChild.is('space') && lastChild.content.indexOf('\n') !== -1) { + return true; + } else { + return false; } } }; diff --git a/node_modules/csscomb/lib/options/leading-zero.js b/node_modules/csscomb/lib/options/leading-zero.js index 07c9de8..bf98236 100644 --- a/node_modules/csscomb/lib/options/leading-zero.js +++ b/node_modules/csscomb/lib/options/leading-zero.js @@ -7,33 +7,31 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType === 'number') { - if (this.getValue('leading-zero')) { - if (node[0][0] === '.') - node[0] = '0' + node[0]; - } else { - node[0] = node[0].replace(/^0+(?=\.)/, ''); - } + process: function(node) { + if (!node.is('number')) return; + + if (this.getValue('leading-zero')) { + if (node.content[0] === '.') + node.content = '0' + node.content; + } else { + node.content = node.content.replace(/^0+(?=\.)/, ''); } }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType === 'number') { - if (node.toString().match(/^\.[0-9]+/)) { - return false; - } else if (node.toString().match(/^0\.[0-9]+/)) { - return true; - } + detect: function(node) { + if (!node.is('number')) return; + + if (node.content.match(/^\.[0-9]+/)) { + return false; + } else if (node.content.match(/^0\.[0-9]+/)) { + return true; } } }; diff --git a/node_modules/csscomb/lib/options/quotes.js b/node_modules/csscomb/lib/options/quotes.js index 1c8b979..ee657c6 100644 --- a/node_modules/csscomb/lib/options/quotes.js +++ b/node_modules/csscomb/lib/options/quotes.js @@ -7,40 +7,39 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { + process: function(node) { + if (!node.is('string')) return; + var value = this.getValue('quotes'); - if (nodeType === 'string') { - if (node[0][0] === '"' && value === 'single') { - node[0] = node[0] - .replace(/\\"/g, '"') // unescape all escaped double quotes - .replace(/([^\\])'/g, '$1\\\'') // escape all the single quotes - .replace(/^"|"$/g, '\''); // replace the first and the last quote - - } else if (node[0][0] === '\'' && value === 'double') { - node[0] = node[0] - .replace(/\\'/g, '\'') // unescape all escaped single quotes - .replace(/([^\\])"/g, '$1\\\"') // escape all the double quotes - .replace(/^'|'$/g, '"'); // replace the first and the last quote - } + + if (node.content[0] === '"' && value === 'single') { + node.content = node.content + .replace(/\\"/g, '"') // unescape all escaped double quotes + .replace(/([^\\])'/g, '$1\\\'') // escape all the single quotes + .replace(/^"|"$/g, '\''); // replace the first and the last quote + + } else if (node.content[0] === '\'' && value === 'double') { + node.content = node.content + .replace(/\\'/g, '\'') // unescape all escaped single quotes + .replace(/([^\\])"/g, '$1\\\"') // escape all the double quotes + .replace(/^'|'$/g, '"'); // replace the first and the last quote } }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType === 'string') { - if (node[0][0] === '"') { - return 'double'; - } else if (node[0][0] === '\'') { - return 'single'; - } + detect: function(node) { + if (!node.is('string')) return; + + if (node.content[0] === '"') { + return 'double'; + } else if (node.content[0] === '\'') { + return 'single'; } } }; diff --git a/node_modules/csscomb/lib/options/remove-empty-rulesets.js b/node_modules/csscomb/lib/options/remove-empty-rulesets.js index 9573283..180e230 100644 --- a/node_modules/csscomb/lib/options/remove-empty-rulesets.js +++ b/node_modules/csscomb/lib/options/remove-empty-rulesets.js @@ -1,77 +1,44 @@ module.exports = (function() { - function processStylesheetContent(nodeContent) { - removeEmptyRulesets(nodeContent); - mergeAdjacentWhitespace(nodeContent); + function processNode(node) { + removeEmptyRulesets(node); + mergeAdjacentWhitespace(node); } - function removeEmptyRulesets(nodeContent) { - var i = nodeContent.length; - // Loop through node and try to find a ruleset: - while (i--) { - var node = nodeContent[i]; - if (!isRuleset(node)) continue; - // If a ruleset is found, try to find its nested rulesets and remove - // all empty ones: - var j = node.length; - while (j--) { - // Nested rulesets are located inside blocks, that's why look - // for blocks only: - var blockNode = node[j]; - if (blockNode[0] !== 'block') continue; - blockNode.shift(); - processStylesheetContent(blockNode); - blockNode.unshift('block'); - node[j] = blockNode; - } - // If after removing all empty nested rulesets the parent has also - // become empty, remove it too: - if (isEmptyRuleset(node)) { - nodeContent.splice(i, 1); - } - } + function removeEmptyRulesets(stylesheet) { + stylesheet.forEach('ruleset', function(ruleset, i) { + var block = ruleset.first('block'); + processNode(block); + if (isEmptyBlock(block)) stylesheet.remove(i); + }); } /** - * Removing ruleset nodes from tree may result in two adjacent whitespace nodes which is not correct AST: + * Removing ruleset nodes from tree may result in two adjacent whitespace + * nodes which is not correct AST: * [space, ruleset, space] => [space, space] - * To ensure correctness of further processing we should merge such nodes into one. + * To ensure correctness of further processing we should merge such nodes + * into one: * [space, space] => [space] */ - function mergeAdjacentWhitespace(nodeContent) { - var i = nodeContent.length - 1; + function mergeAdjacentWhitespace(node) { + var i = node.content.length - 1; while (i-- > 0) { - if (isWhitespace(nodeContent[i]) && isWhitespace(nodeContent[i + 1])) { - nodeContent[i][1] += nodeContent[i + 1][1]; - nodeContent.splice(i + 1, 1); + if (node.get(i).is('space') && node.get(i + 1).is('space')) { + node.get(i).content += node.get(i + 1).content; + node.remove(i + 1); } } } - function isEmptyRuleset(ruleset) { - return ruleset.filter(isBlock).every(isEmptyBlock, this); - } - /** * Block is considered empty when it has nothing but spaces. */ function isEmptyBlock(node) { - return node.length === 1 || !node.some(isNotWhitespace); - } - - function isRuleset(node) { - return node[0] === 'ruleset'; - } + if (!node.length) return true; - function isBlock(node) { - return node[0] === 'block'; - } - - function isWhitespace(node) { - return node[0] === 's'; - } - - function isNotWhitespace(node) { - return typeof node === 'object' && node[0] !== 's'; + return !node.content.some(function(node) { + return !node.is('space'); + }); } return { @@ -86,29 +53,28 @@ module.exports = (function() { /** * Remove rulesets with no declarations. * - * @param {String} nodeType - * @param {Array} nodeContent + * @param {String} node */ - process: function(nodeType, nodeContent) { - if (nodeType === 'stylesheet') { - processStylesheetContent(nodeContent); - } + process: function(node) { + if (!node.is('stylesheet')) return; + + processNode(node); }, + detectDefault: true, + /** * Detects the value of an option at the tree node. * This option is treated as `true` by default, but any trailing space would invalidate it. * - * @param {String} nodeType * @param {node} node */ - detectDefault: true, + detect: function(node) { + if (!node.is('atrulers') && !node.is('block')) return; - detect: function(nodeType, node) { - if (nodeType === 'atrulers' || nodeType === 'block') { - if (node.length === 0 || (node.length === 1 && node[0][0] === 's')) { - return false; - } + if (node.length === 0 || + (node.length === 1 && node.first().is('space'))) { + return false; } } }; diff --git a/node_modules/csscomb/lib/options/sort-order.js b/node_modules/csscomb/lib/options/sort-order.js index fc25767..03adb28 100644 --- a/node_modules/csscomb/lib/options/sort-order.js +++ b/node_modules/csscomb/lib/options/sort-order.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'sort-order', @@ -33,16 +35,15 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { + process: function(node) { var _this = this; // Types of nodes that can be sorted: - var NODES = ['atruleb', 'atruler', 'atrules', 'commentML', 'commentSL', - 'declaration', 's', 'include']; + var NODES = ['atruleb', 'atruler', 'atrules', 'multilineComment', 'singlelineComment', + 'declaration', 'space', 'include']; // Spaces and comments: - var SC = ['commentML', 'commentSL', 's']; + var SC = ['multilineComment', 'singlelineComment', 'space']; var currentNode; // Sort order of properties: @@ -68,6 +69,14 @@ module.exports = { var j; var nl; + /** + * Remove empty lines in space node. + * @param {node} node Space node. + */ + var removeEmptyLines = function(node) { + node.content = node.content.replace(/\n[\s\t\n\r]*\n/, '\n'); + }; + /** * Check if there are any comments or spaces before * the declaration/@-rule. @@ -80,21 +89,16 @@ module.exports = { var d = []; for (; i < l; i++) { - currentNode = node[i]; + currentNode = node.get(i); // If there is no node left, // stop and do nothing with previously found spaces/comments: if (!currentNode) { return false; } - // Remove any empty lines: - if (currentNode[0] === 's') { - currentNode[1] = currentNode[1].replace(/\n[\s\t\n\r]*\n/, '\n'); - } - // If the node is declaration or @-rule, stop and return all // found nodes with spaces and comments (if there are any): - if (SC.indexOf(currentNode[0]) === -1) break; + if (SC.indexOf(currentNode.type) === -1) break; sc.push(currentNode); d.push(i); @@ -121,22 +125,17 @@ module.exports = { // Check every next node: for (; i < l; i++) { - currentNode = node[i + 1]; + currentNode = node.get(i + 1); // If there is no node, or it is nor spaces neither comment, stop: - if (!currentNode || SC.indexOf(currentNode[0]) === -1) break; - - // Remove any empty lines: - if (currentNode[0] === 's') { - currentNode[1] = currentNode[1].replace(/\n[\s\t\n\r]*\n/, '\n'); - } + if (!currentNode || SC.indexOf(currentNode.type) === -1) break; - if (['commentML', 'commentSL'].indexOf(currentNode[0]) > -1) { + if (currentNode.is('multilineComment') || currentNode.is('singlelineComment')) { sc.push(currentNode); d.push(i + 1); continue; } - lbIndex = currentNode[1].indexOf('\n'); + lbIndex = currentNode.content.indexOf('\n'); // If there are any line breaks in a node with spaces, stop and // split the node into two: one with spaces before line break @@ -144,8 +143,10 @@ module.exports = { // Combine the first one with declaration/@-rule's node: if (lbIndex > -1) { // TODO: Don't push an empty array - sc.push(['s', currentNode[1].substring(0, lbIndex)]); - currentNode[1] = currentNode[1].substring(lbIndex); + var s = currentNode.content.substring(0, lbIndex); + var space = gonzales.createNode({ type: 's', content: s }); + sc.push(space); + currentNode.content = currentNode.content.substring(lbIndex); break; } @@ -164,8 +165,8 @@ module.exports = { * @returns {Object} Extended node */ var extendNode = function() { - currentNode = node[i]; - var nextNode = node[i + 1]; + currentNode = node.get(i); + var nextNode = node.get(i + 1); // Object containing current node, all corresponding spaces, // comments and other information: var extendedNode; @@ -197,13 +198,13 @@ module.exports = { extendedNode.sc1 = checkSC1(); if (extendedNode.sc1.length) { - currentNode = node[i]; - nextNode = node[i + 1]; + currentNode = node.get(i); + nextNode = node.get(i + 1); } // If there is `;` right after the declaration, save it with the // declaration and mark it for removing from parent node: - if (currentNode && nextNode && nextNode[0] === 'declDelim') { + if (currentNode && nextNode && nextNode.is('declarationDelimiter')) { extendedNode.delim.push(nextNode); deleted.push(i + 1); i++; @@ -231,8 +232,8 @@ module.exports = { var prefixesRegExp = /^(-webkit-|-moz-|-ms-|-o-)(.*)$/; // Get property name (i.e. `color`, `-o-animation`): - a = a.node[1][1][1]; - b = b.node[1][1][1]; + a = a.node.get(0).get(0).content; + b = b.node.get(0).get(0).content; // Get prefix and unprefixed part. For example: // ['-o-animation', '-o-', 'animation'] @@ -254,7 +255,7 @@ module.exports = { // TODO: Think it through! // Sort properties only inside blocks: - if (nodeType !== 'block') return; + if (!node.is('block')) return; // Check every child node. // If it is declaration (property-value pair, e.g. `color: tomato`), @@ -262,7 +263,7 @@ module.exports = { // combine it with spaces, semicolon and comments and move them from // current node to a separate list for further sorting: for (i = 0, l = node.length; i < l; i++) { - if (NODES.indexOf(node[i][0]) === -1) continue; + if (NODES.indexOf(node.get(i).type) === -1) continue; // Save preceding spaces and comments, if there are any, and mark // them for removing from parent node: @@ -270,7 +271,7 @@ module.exports = { if (!sc0) continue; // If spaces/comments are the last nodes, stop and go to sorting: - if (!node[i]) { + if (!node.get(i)) { deleted.splice(deleted.length - sc0.length, deleted.length + 1); break; } @@ -281,17 +282,19 @@ module.exports = { // If not, proceed with the next node: propertyName = null; // Look for includes: - if (node[i][0] === 'include') { + if (node.get(i).is('include')) { propertyName = '$include'; } else { - for (j = 1, nl = node[i].length; j < nl; j++) { - currentNode = node[i][j]; - if (currentNode[0] === 'property') { - propertyName = currentNode[1][0] === 'variable' ? - '$variable' : currentNode[1][1]; + for (j = 0, nl = node.get(i).length; j < nl; j++) { + currentNode = node.get(i).get(j); + if (!currentNode) continue; + + if (currentNode.is('property')) { + propertyName = currentNode.get(0).is('variable') ? + '$variable' : currentNode.get(0).content; break; - } else if (currentNode[0] === 'atkeyword' && - currentNode[1][1] === 'import') { // Look for imports + } else if (currentNode.is('atkeyword') && + currentNode.get(0).content === 'import') { // Look for imports propertyName = '$import'; break; } @@ -312,7 +315,7 @@ module.exports = { // Remove all nodes, that were moved to a `sorted` list, from parent node: for (i = deleted.length - 1; i > -1; i--) { - node.splice(deleted[i], 1); + node.content.splice(deleted[i], 1); } // Sort declarations saved for sorting: @@ -349,31 +352,35 @@ module.exports = { var sc1 = currentNode.sc1; var sc2 = currentNode.sc2; - sc0.reverse(); - sc1.reverse(); - sc2.reverse(); + sc0.reverse().map(removeEmptyLines); + sc1.reverse().map(removeEmptyLines); + sc2.reverse().map(removeEmptyLines); // Divide declarations from different groups with an empty line: if (prevNode && currentNode.groupIndex > prevNode.groupIndex) { - if (sc0[0] && sc0[0][0] === 's' && + if (sc0[0] && sc0[0].is('space') && (this.syntax === 'sass' || - sc0[0][1].match(/\n/g) && - sc0[0][1].match(/\n/g).length < 2)) { - sc0[0][1] = '\n' + sc0[0][1]; + sc0[0].content.match(/\n/g) && + sc0[0].content.match(/\n/g).length < 2)) { + sc0[0].content = '\n' + sc0[0].content; } } for (j = 0, nl = sc2.length; j < nl; j++) { - node.unshift(sc2[j]); + node.content.unshift(sc2[j]); + } + if (currentNode.delim.length > 0) { + var delim = this.syntax === 'sass' ? '\n' : ';'; + var declDelim = gonzales.createNode({ type: 'declarationDelimiter', content: delim }); + node.content.unshift(declDelim); } - if (currentNode.delim.length > 0) node.unshift(['declDelim']); for (j = 0, nl = sc1.length; j < nl; j++) { - node.unshift(sc1[j]); + node.content.unshift(sc1[j]); } - node.unshift(currentNode.node); + node.content.unshift(currentNode.node); for (j = 0, nl = sc0.length; j < nl; j++) { - node.unshift(sc0[j]); + node.content.unshift(sc0[j]); } } } diff --git a/node_modules/csscomb/lib/options/space-after-colon.js b/node_modules/csscomb/lib/options/space-after-colon.js index d1466b1..86fab0e 100644 --- a/node_modules/csscomb/lib/options/space-after-colon.js +++ b/node_modules/csscomb/lib/options/space-after-colon.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'space-after-colon', @@ -13,23 +15,23 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'declaration') return; + process: function(node) { + if (!node.is('declaration')) return; var value = this.getValue('space-after-colon'); for (var i = node.length; i--;) { - if (node[i][0] !== 'propertyDelim') continue; + if (!node.get(i).is('propertyDelimiter')) continue; - if (this.getSyntax() === 'sass' && !node[i - 1]) break; + if (this.getSyntax() === 'sass' && !node.get(i - 1)) break; // Remove any spaces after colon: - if (node[i + 1][0] === 's') node.splice(i + 1, 1); + if (node.get(i + 1).is('space')) node.remove(i + 1); // If the value set in config is not empty, add spaces: - if (value !== '') node.splice(i + 1, 0, ['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + if (value !== '') node.insert(i + 1, space); break; } @@ -38,17 +40,16 @@ module.exports = { /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'declaration') return; + detect: function(node) { + if (!node.is('declaration')) return; for (var i = node.length; i--;) { - if (node[i][0] !== 'propertyDelim') continue; + if (!node.get(i).is('propertyDelimiter')) continue; - if (node[i + 1][0] === 's') { - return node[i + 1][1]; + if (node.get(i + 1).is('space')) { + return node.get(i + 1).content; } else { return ''; } diff --git a/node_modules/csscomb/lib/options/space-after-combinator.js b/node_modules/csscomb/lib/options/space-after-combinator.js index 804c5b9..7d1d54a 100644 --- a/node_modules/csscomb/lib/options/space-after-combinator.js +++ b/node_modules/csscomb/lib/options/space-after-combinator.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'space-after-combinator', @@ -13,51 +15,44 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'selector') return; + process: function(node) { + if (!node.is('selector')) return; var value = this.getValue('space-after-combinator'); - for (var i = node.length; i--;) { - var subSelector = node[i]; - for (var j = subSelector.length; j--;) { - if (subSelector[j][0] !== 'combinator') continue; - - if (subSelector[j + 1][0] === 's') { - subSelector[j + 1][1] = value; + node.forEach('simpleSelector', function(simpleSelector) { + simpleSelector.forEach('combinator', function(combinator, i) { + if (simpleSelector.get(i + 1).is('space')) { + simpleSelector.get(i + 1).content = value; } else { - subSelector.splice(j + 1, 0, ['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + simpleSelector.insert(i + 1, space); } - } - } + }); + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'selector') return; + detect: function(node) { + if (!node.is('selector')) return; var variants = []; - for (var i = node.length; i--;) { - var subSelector = node[i]; - for (var j = subSelector.length; j--;) { - if (subSelector[j][0] !== 'combinator') continue; - - if (subSelector[j + 1][0] === 's') { - variants.push(subSelector[j + 1][1]); + node.forEach('simpleSelector', function(simpleSelector) { + simpleSelector.forEach('combinator', function(combinator, i) { + if (simpleSelector.get(i + 1).is('space')) { + variants.push(simpleSelector.get(i + 1).content); } else { variants.push(''); } - } - } + }); + }); return variants; } diff --git a/node_modules/csscomb/lib/options/space-after-opening-brace.js b/node_modules/csscomb/lib/options/space-after-opening-brace.js index 90f30df..f41f562 100644 --- a/node_modules/csscomb/lib/options/space-after-opening-brace.js +++ b/node_modules/csscomb/lib/options/space-after-opening-brace.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'space-after-opening-brace', @@ -13,33 +15,33 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { + process: function(node) { // If found block node stop at the next one for space check - if (nodeType !== 'block' && nodeType !== 'atrulers') return; + if (!node.is('block') && !node.is('atrulers')) return; var value = this.getValue('space-after-opening-brace'); - if (node[0][0] === 's') { - node[0][1] = value; + if (node.first() && + node.first().is('space')) { + node.first().content = value; } else if (value !== '') { - node.unshift(['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + node.insert(0, space); } }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'block' && nodeType !== 'atrulers') return; + detect: function(node) { + if (!node.is('block') && !node.is('atrulers')) return; - if (node[0][0] === 's') { - return node[0][1]; + if (node.first().is('space')) { + return node.first().content; } else { return ''; } diff --git a/node_modules/csscomb/lib/options/space-after-selector-delimiter.js b/node_modules/csscomb/lib/options/space-after-selector-delimiter.js index bf9c333..e35bfdd 100644 --- a/node_modules/csscomb/lib/options/space-after-selector-delimiter.js +++ b/node_modules/csscomb/lib/options/space-after-selector-delimiter.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'space-after-selector-delimiter', @@ -13,47 +15,47 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'selector') return; + process: function(node) { + if (!node.is('selector')) return; var value = this.getValue('space-after-selector-delimiter'); - for (var i = node.length; i--;) { - if (node[i][0] !== 'delim') continue; + node.forEach('delimiter', function(delimiter, i) { + var nextNode = node.get(i + 1); - if (node[i + 1][0] === 's') { - node[i + 1][1] = value; - } else if (node[i + 1][1][0] === 's') { - node[i + 1][1][1] = value; + if (nextNode.is('space')) { + nextNode.content = value; + } else if (nextNode.first().is('space')) { + nextNode.first().content = value; } else { - node[i + 1].splice(1, 0, ['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + nextNode.insert(0, space); } - } + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'selector') return; + detect: function(node) { + if (!node.is('selector')) return; var variants = []; - for (var i = node.length; i--;) { - if (node[i][0] !== 'delim') continue; - - if (node[i + 1][1][0] === 's') { - variants.push(node[i + 1][1][1]); + node.forEach('delimiter', function(delimiter, i) { + var nextNode = node.get(i + 1); + if (nextNode && nextNode.is('space')) { + variants.push(nextNode.content); + } else if (nextNode.first() && nextNode.first().is('space')) { + variants.push(nextNode.first().content); } else { variants.push(''); } - } + }); return variants; } diff --git a/node_modules/csscomb/lib/options/space-before-closing-brace.js b/node_modules/csscomb/lib/options/space-before-closing-brace.js index 321a2dc..ff81b26 100644 --- a/node_modules/csscomb/lib/options/space-before-closing-brace.js +++ b/node_modules/csscomb/lib/options/space-before-closing-brace.js @@ -1,13 +1,58 @@ +var gonzales = require('gonzales-pe'); + module.exports = (function() { + var valueFromSettings; + var blockIndent; + function getLastWhitespaceNode(node) { - var lastNode = node[node.length - 1]; + var lastNode = node.last(); + + if (!lastNode || !lastNode.content) return null; - if (typeof lastNode !== 'object' || lastNode[0] === 'block') return null; - if (lastNode[0] === 's') return lastNode; + if (lastNode.is('block')) return null; + if (lastNode.is('space')) return lastNode; return getLastWhitespaceNode(lastNode); } + function processBlock(x, level) { + level = level || 0; + + // XXX: Hack for braces + if (x.is('braces') || x.is('id')) return; + + x.forEach(function(node) { + if (!node.is('block') && + !node.is('atrulers')) return processBlock(node, level); + + level++; + + var value = valueFromSettings; + if (value.indexOf('\n') > -1) { + // TODO: Check that it works for '' block indent value + if (blockIndent) { + value += new Array(level).join(blockIndent); + } + } + + // If found block node stop at the next one for space check + // For the pre-block node, find its last (the deepest) child + var whitespaceNode = getLastWhitespaceNode(node); + + // If it's spaces, modify this node + // If it's something different from spaces, add a space node to the end + if (whitespaceNode) { + whitespaceNode.content = value; + } else if (value !== '') { + var space = gonzales.createNode({ type: 'space', content: value }); + node.content.push(space); + } + + processBlock(node, level); + }); + } + + return { name: 'space-before-closing-brace', @@ -22,57 +67,33 @@ module.exports = (function() { /** * Processes tree node. - * @param {String} nodeType * @param {node} node - * @param {Number} level */ - process: function(nodeType, node, level) { - if (nodeType !== 'block' && nodeType !== 'atrulers') return; - - var value = this.getValue('space-before-closing-brace'); - - // If found block node stop at the next one for space check - // For the pre-block node, find its last (the deepest) child - var whitespaceNode = getLastWhitespaceNode(node); - - if (value.indexOf('\n') > -1) { - var blockIndent = this.getValue('block-indent'); - // TODO: Check that it works for '' block indent value - if (blockIndent) value += new Array(level + 1).join(blockIndent); - } + process: function(node) { + valueFromSettings = this.getValue('space-before-closing-brace'); + blockIndent = this.getValue('block-indent'); - // If it's spaces, modify this node - // If it's something different from spaces, add a space node to the end + if (!node.is('stylesheet')) return; - if (whitespaceNode) { - whitespaceNode[1] = value; - } else if (value !== '') { - node.push(['s', value]); - } + processBlock(node); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - var variants = []; + detect: function(node) { + if (!node.is('block') && !node.is('atrulers')) return; - // Loop through node from the end to the beginning: - for (var i = node.length; i--;) { - // If found block node stop for space check: - if (node[i][0] !== 'block' && node[i][0] !== 'atrulers') continue; - - // For the block node, find its last (the deepest) child - var whitespaceNode = getLastWhitespaceNode(node[i]); + var variants = []; - if (whitespaceNode) { - variants.push(whitespaceNode[1]); - } else { - variants.push(''); - } + // For the block node, find its last (the deepest) child + var whitespaceNode = getLastWhitespaceNode(node); + if (whitespaceNode) { + variants.push(whitespaceNode.content); + } else { + variants.push(''); } return variants; diff --git a/node_modules/csscomb/lib/options/space-before-colon.js b/node_modules/csscomb/lib/options/space-before-colon.js index a960819..ed332f4 100644 --- a/node_modules/csscomb/lib/options/space-before-colon.js +++ b/node_modules/csscomb/lib/options/space-before-colon.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'space-before-colon', @@ -13,48 +15,46 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'declaration') return; + process: function(node) { + if (!node.is('declaration')) return; var value = this.getValue('space-before-colon'); + var syntax = this.getSyntax(); - for (var i = node.length; i--;) { - if (node[i][0] !== 'propertyDelim') continue; - - if (this.getSyntax() === 'sass' && !node[i - 1]) break; + node.forEach('propertyDelimiter', function(delimiter, i) { + if (syntax === 'sass' && !node.get(i - 1)) return; // Remove any spaces before colon: - if (node[i - 1][0] === 's') { - node.splice(i - 1, 1); - i--; + if (node.get(i - 1).is('space')) { + node.remove(--i); } - // If the value set in config is not empty, add spaces: - if (value !== '') node.splice(i, 0, ['s', value]); - break; - } + // If the value set in config is not empty, add spaces: + var space = gonzales.createNode({ type: 'space', content: value }); + if (value !== '') node.insert(i, space); + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'declaration') return; + detect: function(node) { + if (!node.is('declaration')) return; - for (var i = node.length; i--;) { - if (node[i][0] !== 'propertyDelim') continue; + var result; - if (node[i - 1][0] === 's') { - return node[i - 1][1]; + node.forEach('propertyDelimiter', function(delimiter, i) { + if (node.get(i - 1).is('space')) { + result = node.get(i - 1).content; } else { - return ''; + result = ''; } - } + }); + + return result; } }; diff --git a/node_modules/csscomb/lib/options/space-before-combinator.js b/node_modules/csscomb/lib/options/space-before-combinator.js index c73bb12..1046092 100644 --- a/node_modules/csscomb/lib/options/space-before-combinator.js +++ b/node_modules/csscomb/lib/options/space-before-combinator.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'space-before-combinator', @@ -13,50 +15,52 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'selector') return; + process: function(node) { + if (!node.is('selector')) return; var value = this.getValue('space-before-combinator'); - for (var i = node.length; i--;) { - var subSelector = node[i]; - for (var j = subSelector.length; j--;) { - if (subSelector[j][0] !== 'combinator') continue; - if (subSelector[j - 1][0] === 's') { - subSelector[j - 1][1] = value; + node.forEach(function(simpleSelector) { + var notFirst = false; + + simpleSelector.forEach(function(n, i) { + if (!n.is('space') && !n.is('combinator')) notFirst = true; + + // If combinator is the first thing in selector, + // do not add extra spaces: + if (!n.is('combinator') || !notFirst) return; + + if (simpleSelector.get(i - 1).is('space')) { + simpleSelector.get(i - 1).content = value; } else { - subSelector.splice(j, 0, ['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + simpleSelector.insert(i, space); } - } - } + }); + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'selector') return; + detect: function(node) { + if (!node.is('selector')) return; var variants = []; - for (var i = node.length; i--;) { - var subSelector = node[i]; - for (var j = subSelector.length; j--;) { - if (subSelector[j][0] !== 'combinator') continue; - - if (subSelector[j - 1][0] === 's') { - variants.push(subSelector[j - 1][1]); + node.forEach(function(simpleSelector) { + simpleSelector.forEach('combinator', function(combinator, i) { + if (simpleSelector.get(i - 1).is('space')) { + variants.push(simpleSelector.get(i - 1).content); } else { variants.push(''); } - } - } + }); + }); return variants; } diff --git a/node_modules/csscomb/lib/options/space-before-opening-brace.js b/node_modules/csscomb/lib/options/space-before-opening-brace.js index 3aecb14..4d0622b 100644 --- a/node_modules/csscomb/lib/options/space-before-opening-brace.js +++ b/node_modules/csscomb/lib/options/space-before-opening-brace.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = (function() { /** * Gets the last (the deepest) whitespace node. @@ -8,9 +10,9 @@ module.exports = (function() { */ function getLastWhitespaceNode(node) { if (typeof node !== 'object') return; - if (node[0] === 's') return node; + if (node.is('space')) return node; - return getLastWhitespaceNode(node[node.length - 1]); + return getLastWhitespaceNode(node.last()); } return { @@ -28,59 +30,68 @@ module.exports = (function() { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { + process: function(node) { var value = this.getValue('space-before-opening-brace'); - // Loop through node from the end to the beginning: - for (var i = node.length; i--;) { + // XXX: Hack for braces + if (node.is('braces') || node.is('id')) return; + + node.forEach(function(block, i) { // If found block node stop at the next one for space check: - if (node[i][0] !== 'block' && node[i][0] !== 'atrulers') continue; + if (!block.is('block') && !block.is('atrulers')) return; // For the pre-block node, find its last (the deepest) child: // TODO: Exclude nodes with braces (for example, arguments) - var whitespaceNode = getLastWhitespaceNode(node[i - 1]); + var previousNode = node.get(i - 1); + var whitespaceNode = getLastWhitespaceNode(previousNode); // If it's spaces, modify this node. // If it's something different from spaces, add a space node to // the end: if (whitespaceNode) { - whitespaceNode[1] = value; + whitespaceNode.content = value; } else if (value !== '') { - if (node[i - 1][0] === 'atrulerq') { - node[i - 1].push(['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + if (previousNode && previousNode.is('atrulerq')) { + previousNode.content.push(space); } else { - node.splice(i, 0, ['s', value]); + node.insert(i, space); } } - } + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { + detect: function(node) { var variants = []; - // Loop through node from the end to the beginning: - for (var i = node.length; i--;) { + // XXX: Hack for braces + if (node.is('braces') || node.is('id')) return []; + + node.forEach(function(block, i) { // If found block node stop at the next one for space check: - if (node[i][0] !== 'block' && node[i][0] !== 'atrulers') continue; + if (!block.is('block') && !block.is('atrulers')) return; - // For the pre-block node, find its last (the deepest) child - var whitespaceNode = getLastWhitespaceNode(node[i - 1]); + // For the pre-block node, find its last (the deepest) child: + // TODO: Exclude nodes with braces (for example, arguments) + var previousNode = node.get(i - 1); + var whitespaceNode = getLastWhitespaceNode(previousNode); + // If it's spaces, modify this node. + // If it's something different from spaces, add a space node to + // the end: if (whitespaceNode) { - variants.push(whitespaceNode[1]); + variants.push(whitespaceNode.content); } else { variants.push(''); } - } + }); return variants; } diff --git a/node_modules/csscomb/lib/options/space-before-selector-delimiter.js b/node_modules/csscomb/lib/options/space-before-selector-delimiter.js index 0a89a5d..21204d0 100644 --- a/node_modules/csscomb/lib/options/space-before-selector-delimiter.js +++ b/node_modules/csscomb/lib/options/space-before-selector-delimiter.js @@ -1,3 +1,5 @@ +var gonzales = require('gonzales-pe'); + module.exports = { name: 'space-before-selector-delimiter', @@ -13,47 +15,42 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'selector') return; + process: function(node) { + if (!node.is('selector')) return; var value = this.getValue('space-before-selector-delimiter'); - for (var i = node.length; i--;) { - if (node[i][0] !== 'delim') continue; - - var previousNode = node[i - 1]; - if (previousNode[previousNode.length - 1][0] === 's') { - previousNode[previousNode.length - 1][1] = value; + node.forEach('delimiter', function(delim, i) { + var previousNode = node.get(i - 1); + if (previousNode.last().is('space')) { + previousNode.last().content = value; } else { - previousNode.push(['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + previousNode.content.push(space); } - } + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'selector') return; + detect: function(node) { + if (!node.is('selector')) return; var variants = []; - for (var i = node.length; i--;) { - if (node[i][0] !== 'delim') continue; - - var previousNode = node[i - 1]; - if (previousNode[previousNode.length - 1][0] === 's') { - variants.push(previousNode[previousNode.length - 1][1]); + node.forEach('delimiter', function(delim, i) { + var previousNode = node.get(i - 1); + if (previousNode.last().is('space')) { + variants.push(previousNode.last().content); } else { variants.push(''); } - } + }); return variants; } diff --git a/node_modules/csscomb/lib/options/space-between-declarations.js b/node_modules/csscomb/lib/options/space-between-declarations.js index 1b7a832..cc0819d 100644 --- a/node_modules/csscomb/lib/options/space-between-declarations.js +++ b/node_modules/csscomb/lib/options/space-between-declarations.js @@ -1,20 +1,22 @@ +var gonzales = require('gonzales-pe'); + module.exports = (function() { function getDeclarationEnd(node, i) { for (;i < node.length; i++) { - if (!node[i + 1]) { + if (!node.get(i + 1) || typeof node.get(i + 1) === 'string') { return 0; - } else if (node[i + 1][0] === 's') { - if (node[i + 1][1].indexOf('\n') > -1) { - if (node[i + 2] && node[i + 2][0] === 'declaration') { + } else if (node.get(i + 1).is('space')) { + if (node.get(i + 1).content.indexOf('\n') > -1) { + if (node.get(i + 2) && node.get(i + 2).is('declaration')) { return i; } else { return 0; } - } else if (node[i + 2] && node[i + 2][0] === 'commentML') { - if (node[i + 3] && node[i + 3][0] === 'declaration') { + } else if (node.get(i + 2) && node.get(i + 2).is('multilineComment')) { + if (node.get(i + 3) && node.get(i + 3).is('declaration')) { return i + 2; - } else if (node[i + 3] && node[i + 3][0] === 's') { - if (node[i + 4] && node[i + 4][0] === 'declaration') { + } else if (node.get(i + 3) && node.get(i + 3).is('space')) { + if (node.get(i + 4) && node.get(i + 4).is('declaration')) { return i + 2; } else { return 0; @@ -22,16 +24,16 @@ module.exports = (function() { } else { return 0; } - } else if (node[i + 2] && node[i + 2][0] === 'declaration') { + } else if (node.get(i + 2) && node.get(i + 2).is('declaration')) { return i; } - } else if (node[i + 1][0] === 'declaration') { + } else if (node.get(i + 1).is('declaration')) { return i; - } else if (node[i + 1][0] === 'commentML') { - if (node[i + 2] && node[i + 2][0] === 'declaration') { + } else if (node.get(i + 1).is('multilineComment')) { + if (node.get(i + 2) && node.get(i + 2).is('declaration')) { return i + 1; - } else if (node[i + 2] && node[i + 2][0] === 's') { - if (node[i + 3] && node[i + 3][0] === 'declaration') { + } else if (node.get(i + 2) && node.get(i + 2).is('space')) { + if (node.get(i + 3) && node.get(i + 3).is('declaration')) { return i + 1; } } else { @@ -58,18 +60,17 @@ module.exports = (function() { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { + process: function(node) { var value = this.getValue('space-between-declarations'); // TODO: Limit nodes to blocks, stylesheet, etc. + // XXX: Hack for braces + if (node.is('braces') || node.is('id')) return; for (var i = 0, l = node.length; i < l; i++) { - var currentNode = node[i]; - - if (currentNode[0] !== 'declDelim') continue; + if (!node.get(i) || !node.get(i).is('declarationDelimiter')) continue; // Grom user's point of view "declaration" includes semicolons // and comments placed on the same line. @@ -81,13 +82,14 @@ module.exports = (function() { i = declarationEnd; } - var nextNode = node[i + 1]; - if (nextNode[0] === 's') { - nextNode[1] = value; + var nextNode = node.get(i + 1); + if (nextNode.is('space')) { + nextNode.content = value; } else { i++; l++; - node.splice(i, 0, ['s', value]); + var space = gonzales.createNode({ type: 'space', content: value }); + node.insert(i, space); } } } diff --git a/node_modules/csscomb/lib/options/strip-spaces.js b/node_modules/csscomb/lib/options/strip-spaces.js index 81967e9..36f3f83 100644 --- a/node_modules/csscomb/lib/options/strip-spaces.js +++ b/node_modules/csscomb/lib/options/strip-spaces.js @@ -2,11 +2,11 @@ module.exports = (function() { /** * Trim trailing spaces on each line. * @private - * @param {String} s Spaceful string + * @param {String} string Spaceful string * @returns {String} */ - function trim(s) { - return s.replace(/[ \t]+\n/g, '\n'); + function trim(string) { + return string.replace(/[ \t]+\n/g, '\n'); } return { @@ -18,41 +18,38 @@ module.exports = (function() { /** * Processes tree node. - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType === 's') { - node[0] = trim(node[0]); - } - if (nodeType === 'stylesheet') { - var lastChild = node[node.length - 1]; - if (lastChild[0] === 's') { - lastChild[1] = trim(lastChild[1]) + process: function(node) { + if (node.is('space')) { + node.content = trim(node.content); + } else if (node.is('stylesheet')) { + var lastChild = node.last(); + if (lastChild.is('space')) { + lastChild.content = trim(lastChild.content) .replace(/[ \t]+$/, '') .replace(/[\n]+/g, '\n'); } } }, + detectDefault: true, + /** * Detects the value of an option at the tree node. * This option is treated as `true` by default, but any trailing space would invalidate it. * - * @param {String} nodeType * @param {node} node */ - detectDefault: true, - - detect: function(nodeType, node) { - if (nodeType === 's') { - if (node[0].match(/[ \t]\n/)) { - return false; - } - } - if (nodeType === 'stylesheet') { - var lastChild = node[node.length - 1]; - if (lastChild[0] === 's' && lastChild[1] !== '\n' && lastChild[1].match(/^[ \n\t]+$/)) { + detect: function(node) { + if (node.is('space') && + node.content.match(/[ \t]\n/)) { + return false; + } else if (node.is('stylesheet')) { + var lastChild = node.last(); + if (lastChild.is('space') && + lastChild.content !== '\n' && + lastChild.content.match(/^[ \n\t]+$/)) { return false; } } diff --git a/node_modules/csscomb/lib/options/tab-size.js b/node_modules/csscomb/lib/options/tab-size.js index d8e641d..1ab2935 100644 --- a/node_modules/csscomb/lib/options/tab-size.js +++ b/node_modules/csscomb/lib/options/tab-size.js @@ -10,11 +10,10 @@ module.exports = { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 's') return; - node[0] = node[0].replace(/\t/, this.getValue('tab-size')); + process: function(node) { + if (!node.is('space')) return; + node.content = node.content.replace(/\t/, this.getValue('tab-size')); } }; diff --git a/node_modules/csscomb/lib/options/unitless-zero.js b/node_modules/csscomb/lib/options/unitless-zero.js index a581e20..a712efa 100644 --- a/node_modules/csscomb/lib/options/unitless-zero.js +++ b/node_modules/csscomb/lib/options/unitless-zero.js @@ -7,54 +7,76 @@ module.exports = { /** * Processes tree node. - * @param {String} nodeType + * * @param {node} node */ - process: function(nodeType, node) { - if (nodeType === 'value' || nodeType === 'braces') { - node.forEach(function(child, index) { - if ( - (child[0] === 'percentage' || - child[0] === 'dimension' && ['cm', 'em', 'ex', 'pt', 'px'].indexOf(child[2][1]) !== -1) && - child[1][1] === '0') { - node[index] = child[1]; + process: function(node) { + var UNITS = ['cm', 'em', 'ex', 'pt', 'px']; + + if (!node.is('value') && !node.is('braces')) return; + + node.forEach(function(value) { + if (typeof value === 'string') return; + + if (value.is('dimension')) { + var unit = value.first('ident').content; + if (value.first('number').content === '0' && + UNITS.indexOf(unit) !== -1) { + value.remove(1); } - }); - } + } else if (value.is('percentage')) { + // XXX(tonyganch): There is a bug in Gonzales when in Less, + // percentage's content is not wrapped as an array but actually + // type of node's content is object. This bug has already been + // fixed in newer versions of Gonzales so the issue should be + // gone after update of dependencies and csscomb@4.0 release. + // This hack is here as a hotfix for csscomb@3.1 and must be + // removed once csscom@4.0 is released. See #389. + var number; + if (!Array.isArray(value.content) && + value.content.is('number')) { + number = value.content; + } else { + number = value.first('number').content; + } + + if (number === '0') { + value.type = 'number'; + value.content = number; + } + } + }); }, /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - var result = null; + detect: function(node) { + var result; // If we see a zero with unit and it is not degree, then we don’t have an option - if ( - nodeType === 'percentage' && node[0][1] === '0' || - nodeType === 'dimension' && node[0][1] === '0' && node[1][1] !== 'deg' - ) { + + if (node.is('percentage') && node.first('number').content[1] === '0') { + result = false; + } else if (node.is('dimension') && + node.first('number').content === '0' && + node.first('ident').content !== 'deg') { result = false; } // If we see a zero and previous node is not percentage or dimension, then we have an option - if ( - nodeType === 'number' && - node[0] === '0' && + if (node.is('number') && + node.content === '0' && this._prev !== 'percentage' && - this._prev !== 'dimension' - ) { + this._prev !== 'dimension') { result = true; } // Store the previous nodeType - this._prev = nodeType; + this._prev = node.type; - if (result !== null) { - return result; - } + return result; } }; diff --git a/node_modules/csscomb/lib/options/vendor-prefix-align.js b/node_modules/csscomb/lib/options/vendor-prefix-align.js index 84eeced..39d15d3 100644 --- a/node_modules/csscomb/lib/options/vendor-prefix-align.js +++ b/node_modules/csscomb/lib/options/vendor-prefix-align.js @@ -1,7 +1,10 @@ +var gonzales = require('gonzales-pe'); + module.exports = (function() { // Vendor prefixes list: var PREFIXES = [ 'webkit', + 'khtml', 'moz', 'ms', 'o' @@ -72,30 +75,27 @@ module.exports = (function() { for (var i = nodes.length; i--;) { node = nodes[i]; - if (!Array.isArray(node)) - continue; - - if (!node[1]) { + if (!node.content) { crPos = -1; } else { - crPos = node[1].lastIndexOf('\n'); - tabPos = node[1].lastIndexOf('\t'); + crPos = node.content.lastIndexOf('\n'); + tabPos = node.content.lastIndexOf('\t'); if (tabPos > crPos) crPos = tabPos; } if (crPos !== -1) oneline = false; - if (node[0] === 's') { - result += node[1].length - crPos - 1; + if (node.is('space')) { + result += node.content.length - crPos - 1; if (crPos !== -1) break; } - if (node[0] === 'commentML') { + if (node.is('multilineComment')) { if (crPos === -1) { - result += node[1].length + 4 /* comment symbols length */ ; + result += node.content.length + 4 /* comment symbols length */ ; } else { - result += node[1].length - crPos + 1 /* only last comment symbols length - 1(not count \n)*/; + result += node.content.length - crPos + 1 /* only last comment symbols length - 1(not count \n)*/; break; } } @@ -113,9 +113,9 @@ module.exports = (function() { function extraIndentProperty(nodes, i) { var subset = []; while (i--) { - if (!nodes[i] || nodes[i][0] === 'declDelim') + if (!nodes.get(i) || nodes.get(i).is('declarationDelimiter')) break; - subset.unshift(nodes[i]); + subset.unshift(nodes.get(i)); } return extraIndent(subset); } @@ -128,15 +128,16 @@ module.exports = (function() { */ function extraIndentVal(nodes, i) { var subset = []; - var declaration = nodes[i]; + var declaration = nodes.get(i); + if (!declaration.is('declaration')) return; for (var x = declaration.length; x--;) { - if (declaration[x][0] !== 'value') continue; + if (!declaration.get(x).is('value')) continue; x--; - while (declaration[x][0] !== 'propertyDelim') { - subset.push(declaration[x]); + while (!declaration.get(x).is('propertyDelimiter')) { + subset.push(declaration.get(x)); x--; } @@ -160,11 +161,10 @@ module.exports = (function() { function walk(args) { args.node.forEach(function(item, i) { var name = args.selector(item); - var info = name && getPrefixInfo( - name, - args.namespaceSelector && makeNamespace(args.namespaceSelector(item)), - args.getExtraSymbols(args.node, i) - ); + var namespace = args.namespaceSelector && makeNamespace(args.namespaceSelector(item)); + var extraSymbols = args.getExtraSymbols(args.node, i); + + var info = name && getPrefixInfo(name, namespace, extraSymbols); if (!info) return; args.payload(info, i); }); @@ -180,9 +180,9 @@ module.exports = (function() { * @returns {String|undefined} */ function getPropertyName(node) { - if (node[0] !== 'declaration') return; + if (!node.is('declaration')) return; // TODO: Check that it's not a variable - return node[1][1][1]; + return node.get(0).get(0).content; } /** @@ -197,21 +197,11 @@ module.exports = (function() { * @returns {String|undefined} */ function getValName(node) { - if (node[0] !== 'declaration') return; - - var valueNode; - var value; - - for (var i = node.length; i--;) { - valueNode = node[i]; + if (!node.is('declaration')) return; - if (valueNode[0] !== 'value') continue; - - value = valueNode[1]; - - if (value[0] === 'ident') return value[1]; - if (value[0] === 'function') return value[1][1]; - } + var value = node.first('value'); + if (value.get(0).is('ident')) return value.get(0).content; + if (value.get(0).is('function')) return value.get(0).get(0).content; } /** @@ -270,11 +260,10 @@ module.exports = (function() { /** * Processes tree node. * - * @param {String} nodeType * @param {node} node */ - process: function(nodeType, node) { - if (nodeType !== 'block') return; + process: function(node) { + if (!node.is('block')) return; oneline = true; var dict = {}; @@ -308,16 +297,17 @@ module.exports = (function() { namespaceSelector: getPropertyName, getExtraSymbols: extraIndentVal, payload: function(info, i) { - for (var x = node[i].length; x--;) { - if (node[i][x][0] === 'value') break; + for (var x = node.get(i).length; x--;) { + if (node.get(i).get(x).is('value')) break; } - if (node[i][x - 1][0] !== 's') { - node[i].splice(x, 0, ['s', '']); + if (!node.get(i).get(x - 1).is('space')) { + var space = gonzales.createNode({ type: 'space', content: '' }); + node.get(i).insert(x, space); ++x; } - node[i][x - 1][1] = updateIndent(info, dict, node[i][x - 1][1]); + node.get(i).get(x - 1).content = updateIndent(info, dict, node.get(i).get(x - 1).content); } }); @@ -328,15 +318,15 @@ module.exports = (function() { selector: getPropertyName, getExtraSymbols: extraIndentProperty, payload: function(info, i) { - // `node[i - 1]` can be either space or comment: - var whitespaceNode = node[i - 1]; + // `node.get(i - 1)` can be either space or comment: + var whitespaceNode = node.get(i - 1); if (!whitespaceNode) return; // If it's a comment, insert an empty space node: - if (whitespaceNode[0] !== 's') { - whitespaceNode = ['s', '']; - node.splice(i - 1, 0, whitespaceNode); + if (!whitespaceNode.is('space')) { + whitespaceNode = gonzales.createNode({ type: 'space', content: '' }); + node.insert(i - 1, whitespaceNode); } - whitespaceNode[1] = updateIndent(info, dict, whitespaceNode[1]); + whitespaceNode.content = updateIndent(info, dict, whitespaceNode.content); } }); }, @@ -344,16 +334,15 @@ module.exports = (function() { /** * Detects the value of an option at the tree node. * - * @param {String} nodeType * @param {node} node */ - detect: function(nodeType, node) { - if (nodeType !== 'block') return; + detect: function(node) { + if (!node.is('block')) return; var result = { - true: 0, - false: 0 - }; + true: 0, + false: 0 + }; var maybePrefix = false; var prevPrefixLength = false; @@ -410,8 +399,9 @@ module.exports = (function() { selector: getPropertyName, getExtraSymbols: extraIndentProperty, payload: function(info, i) { - if (node[i - 1] && node[i - 1][1]) { - var sum = node[i - 1][1].replace(/^[ \t]*\n+/, '').length + info.prefixLength; + if (node.get(i - 1) && node.get(i - 1).content) { + var sum = node.get(i - 1).content. + replace(/^[ \t]*\n+/, '').length + info.prefixLength; getResult(node, sum, info, i); } } @@ -422,12 +412,13 @@ module.exports = (function() { selector: getValName, getExtraSymbols: extraIndentVal, payload: function(info, i) { - for (var x = node[i].length; x--;) { - if (node[i][x][0] === 'value') break; + for (var x = node.get(i).length; x--;) { + if (node.get(i).get(x).is('value')) break; } - if (node[i][x - 1][1]) { - var sum = node[i][x - 1][1].replace(/^[ \t]*\n+/, '').length + info.prefixLength; + if (node.get(i).get(x - 1)) { + var sum = node.get(i).get(x - 1).content + .replace(/^[ \t]*\n+/, '').length + info.prefixLength; getResult(node, sum, info, i); } } diff --git a/node_modules/csscomb/logo.png b/node_modules/csscomb/logo.png deleted file mode 100644 index 04fa74dcd9a102b3468ac182613177b0107b9e23..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4254 zcmV;P5Ml3$P)<^IRt_bjsy42uXT zAZ~2A;C8h%m(<$fZPqolTrd(fEi=trOG6115L`e-kpV$gS#%f% z24+2TX3m`L|DGA{t)A}xW|mNc6FY4x}9em_h>}`tu(P=r{;qGBv<30pKzv;HhT7QVjse zRDgg2kP#RV6_LQ$Xw1MdF40T7Kk3qQ*mh0yAYiE~0+h)JJdPIh8zfK%g!--{N|)~3 zFz{Dx=$3Dg9jqSmY%;_! zAb1fy82~s--K(voS=&WS1|UKHPhjF+LyCwASzkt3c|CHR1c*$_GlI{ZIJ6To4e%Il zEOK?&aiuC`A;fV2IP@Ko0631$6aOMu2^51+=C%uZ0>T6l`8Lm>9TD)n;4>@Zl_&xL zaCI!8Jnje#;_pBR%#_8>2qNF%kBNH;E141}0EUxF%E1?tas(>yfb)t#;3ZfAKy-?i z6@9VEBPDSXxd7vu%JXn4@?b9Gy5phVy1;XUkI;V}aZf;H3S>&R#$`6@NmABJ0u>OL z$oo}=NOG1HfY*b}%!xp)C4kG}1uTbjMBnE*mQV&L>7>C?=yR|Cx`Oa02bcs(C;%q# zTIa3OGRQf40f-||8vvuTs$d*z7#1TiRi`#hQcjgn+2t_ z4nUhJ;AND5CTu6D$g8R5Qau#tScs_r?-hJzmP{`qP!Cd5rGlWtCOWT_Ia-opWn^B3 z>x{Y0!>iQj#*j~Q$lwI;e!y&OIqY$|0Zn<)_u!uei%bkr>Jd3D-CACT33N~31LXlP zsVXUoRAZ51DkTAKlv6H@_sD3OBBSm$hCe)1Ga#>m&M_H0yi5*}#nFukIFO6tOxo=_ zD3g;Y1h78?RstnZfrDyKM@=a%PzV%NFP8V4zSBKeq%Mox&)Vh&f(#hbFF7uZ=ta)A z5%O=&U3R!94p0opEq7$KnixSTm+~-Dn8%R9-dPU2{h)aFJ}V_7Lb^x*>uN2>0UIlb zG8Faxz~Lnymhvf!Kp76mF&><~;VF^{AmZT%Lg~~)joBkY?JGSp`R8Z!fSx=gU`SpK zead8HM7aW@n?+dzxfX9}pJg>Ry@}l&DgwoThIO}=5`gU?iloo%QhE}6(INr{6##_{ z0Lp{83iU4IgM&0(v&yL>UMoF$#^?}BT81t2p+4AJMuBh0EO0s|Bq|5y)w(iGMi)>c zALbd9)^It%XzM!ckAor~f?@yyy^f1q4?!S&O87yM;@nR@T2V<+$fl&I!gJ1^H44u> zpqTnYHNS;(;*UQ&xw|2Sb&It`Qk=f!xcX(YkMr zo^ESjI!d|Za4o&ELErR`rBk8|X?kMsFtX!EZKQh1=`yG3{wUbLqJ^tEaM641``YS- z*zZ*oM~VW>qeta3THv8iO%a8>1SnM~76p?61qbaB>6{Cerg4MSv6ovE-`uKp4t;h) zm~!_y>bsuM{9e~6McQ}y4)cn!fvXN0@g)s4jwLIn#~M?LJUfTT>4NZR)v`i;J6+l0 z&iLM8o&LrA=WN*T0>wcffSxkQi!l<)YzW6oLRDL^`vg~JIkmY zJuva~*CywzW3A?tWnCj~OI_L>!AgORJroF+VBl@1CS`>RUme^Gr=BC<5eE zX0ao?Zy-B2Dn^mH=V)EyqOs~%^KI%6Zd5RnUKpvtQ%mq2eF9|r`^4$q-IH<1J10`UPi1DR>6Jtc5qMiMy^vd}d zeLf1&amj7=vc+VVPamo2wy%Ib78kC1JuW`<_`cIr{cDp#-#K1md$YXQ^yunYz40|C zYCjEWsXfteV8rr0dCuk?Y48I`zNe@E_Ih(s%8Mf--Z+Ns z?auF;t6v!mJ~~Bf7hJt$n)TjTt!itda(%eRc{Vv-_f}RVL5J8J!twT&d8(iQaNw2a zg*#f-_)QOW91xMBFiPxHQ}p$ryf5k{Rkd0YlwGH+?M9mz+gDSXS?D%Q9iUuPD+XMX-&fZ$``jh!sm-(E6kk->HW6lf#__iH zC%HFkC`DA;2{{?W3Vay?jh1>zpQ;Gf>#I;wxktSxx|rc6g@Q_S z=hWjzBjosux7B-ZQFH*)_*Wm zd3aBob8>!W#dEX5xrmfH=Nm6h9&dlMU;ipmS{?kCwHWp*P%;SM-qtQ2hoMa1l~F+O zN4!r_#t$uldQq(xQDa<#U>-Prucdkoo`YyC=Ss(*gW@ZfWMPPG@$jOW*tuLcWTFasTW6a6(RON_7RZ^21-=CXa9{l_$ z#o*mnz1yITe*J-gK^dtT&Vt4F2Y*@QfeW*<8415%4hoZMK|;Gx~$y2hu>Z0^rH4bTB85<+<*uKINu)Tsy$lHIo;t< zrbEHQ{im~+d_eLe99^uTnijPhD4eTt{-AVIkBuA>TEDLl6g)X1WX)|swm!eW8u8}C zy3uKR<|EujrTqQ=po3fUou^lh=#rh@>X>%9#5QS07jEcV7wQ*3`_ydahYf3MTphOG z1ogubDg@ySbJU(FWgV_COrb+2_9st|Tkx%!Bv97Fqs6BO+_dsVC~;FWN2y1jtRcP@ z?ab^cBf~4UpR(pmkB6IYiQw(*v!;mEQ^Uq=ylPuvscrdk>ElWJ(=OODSM&zwZ_Bm+ zDh4rJ>WWwQj2@b7;Cu;Ryt6?G?!2y}8uImm2ZUp?0Mw6izWhqNd4%XUJ&6OU^XJkp z*smw|g8hY{pc92xSUBfF-Grmn>=sw!tp(EuD{gGhqcWf9E$nVpYnSB~^Up}mf)Sib{J|-bF>(Nkt)BU2+)H- zG4PX*-l(QK>KiHd@Dbe__vf>PgSxOwS*?6m?wKaxrP0dA_Eva5v^6_lo;Rguaay5x ze0nT#_$CDNzRzgvwslI^C%s(0QW}MLh&H6)sMvli@`M_9$<*OrA1KYfCxQbZS_T^?flSd`o&hgS|OE z<)kHE8FJ;i*h=B?fW;SR0!`- z&0oOgU$)n&6lf)f*7r2UN!`CMkFqGI(smEH<>arHR#+`hj|q76aFHd=Qg3=}&g97U zPtSU6-yKg-1(T;U^C{ z*K!|Q4bGYKABi?^I$`{NY_M&QvRAj|`+w}f*WRyq?K1;-rlP1hb@|AU^CyjpQ|?w* z!g-f%E=iESRCrgD$Pb=tzxpTGB*-*;)}sO z!w#LfPTF6Y7`*s!HS?~avSrTmBh@Y2uB*Qt9nAcI>%iiSav9h@z1NC;jn?@U6>S?C z694CC#pS6BASsec#UC>LFS7ygf(1i+q`Y&qd1ZB}oke}CZ~7-SDUn)lzY+0DO?nAm zkf`I{(CUQU2Qpe(mQM^>cCeOS)>vhkzj9WR;p2Sk7eh&Bo}#;E-pO-D^_&Q}^t~F( z40DT(TBOuA5Gs`~XW#XVR~o+)2ykA%h|Q}GH?69#b+8(>RMdFjv_YViv;8Iv4bo;_ zF&D<$?-ec9IA>!);Ezp=zH^XkRhuWx>;ul-1+_n5hrOPo1o_`=}G5agr$9p}(H zf(^l%L8Q(Nx`nbJE`|YpyQ}xM8N4XK+#o1`0MgjT<3ec+fW&bF1B0_mJI+VDP2VIY zN37g)y4ARGgl2n&pqX7<%fBponU8l>)qUbHm{7wb+_jJXYE0i$R{e|7MT5yDuNCEm z8WK~F>B|p@j8p=~KOO~gAS8{A52(s6v!8vSCv(!-T{$NG8olj};Zf`6rt2R|4i4>D zojjyTYMk%Il$vO_{k%&Qz!%qBi_qIg(XP4FqO%QSAGv zmmBR%yxjU;QF4++xl&rv$S|1jNRm>Pcg*#CSi zAh6)+w5n#w;6P zJOkzo8L)9@Nd-N_1y=VBW4hR^UU0Hq@m-F?zU{q%$rb?b9pLYJ4kq=o67b>)W4C>k zm20VL;g>jgSes=rz4Tg4Uymr>aXWg~+y4nL0GR+N>)?sm9{>OV07*qoM6N<$f|*oA Ae*gdg diff --git a/node_modules/csscomb/node_modules/commander/package.json b/node_modules/csscomb/node_modules/commander/package.json deleted file mode 100644 index 583b5b3..0000000 --- a/node_modules/csscomb/node_modules/commander/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "commander", - "version": "2.0.0", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt", - "stdin" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "repository": { - "type": "git", - "url": "https://github.com/visionmedia/commander.js.git" - }, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.6.x" - }, - "bugs": { - "url": "https://github.com/visionmedia/commander.js/issues" - }, - "_id": "commander@2.0.0", - "dist": { - "shasum": "d1b86f901f8b64bd941bdeadaf924530393be928", - "tarball": "http://registry.npmjs.org/commander/-/commander-2.0.0.tgz" - }, - "_from": "commander@2.0.0", - "_npmVersion": "1.2.25", - "_npmUser": { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - } - ], - "directories": {}, - "_shasum": "d1b86f901f8b64bd941bdeadaf924530393be928", - "_resolved": "https://registry.npmjs.org/commander/-/commander-2.0.0.tgz", - "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineapple');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineapple\n -b, --bbq Add bbq sauce\n -c, --cheese Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] ')\n .option('-i, --integer ', 'An integer argument', parseInt)\n .option('-f, --float ', 'A float argument', parseFloat)\n .option('-r, --range ..', 'A range', range)\n .option('-l, --list ', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .outputHelp()\n\n Output help information without exiting.\n\n## .help()\n\n Output help information and exit immediately.\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "homepage": "https://github.com/visionmedia/commander.js" -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/LICENSE b/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/LICENSE deleted file mode 100644 index 05a4010..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. - -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/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/package.json b/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/package.json deleted file mode 100644 index d70041d..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "lru-cache", - "description": "A cache object that deletes the least-recently-used items.", - "version": "2.5.0", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me" - }, - "scripts": { - "test": "tap test --gc" - }, - "main": "lib/lru-cache.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-lru-cache.git" - }, - "devDependencies": { - "tap": "", - "weak": "" - }, - "license": { - "type": "MIT", - "url": "http://github.com/isaacs/node-lru-cache/raw/master/LICENSE" - }, - "readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n , options = { max: 500\n , length: function (n) { return n * 2 }\n , dispose: function (key, n) { n.close() }\n , maxAge: 1000 * 60 * 60 }\n , cache = LRU(options)\n , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset() // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum size of the cache, checked by applying the length\n function to all values in the cache. Not setting this is kind of\n silly, since that's the whole purpose of this lib, but it defaults\n to `Infinity`.\n* `maxAge` Maximum age in ms. Items are not pro-actively pruned out\n as they age, but if you try to get an item that is too old, it'll\n drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n items. If you're storing strings or buffers, then you probably want\n to do something like `function(n){return n.length}`. The default is\n `function(n){return 1}`, which is fine if you want to store `n`\n like-sized things.\n* `dispose` Function that is called on items when they are dropped\n from the cache. This can be handy if you want to close file\n descriptors or do other cleanup tasks when items are no longer\n accessible. Called with `key, value`. It's called *before*\n actually removing the item from the internal cache, so if you want\n to immediately put it back in, you'll have to do that in a\n `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n stale items out of the cache when you `get(key)`. (That is, it's\n not pre-emptively doing a `setTimeout` or anything.) If you set\n `stale:true`, it'll return the stale value before deleting it. If\n you don't set this, then it'll return `undefined` when you try to\n get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n Both of these will update the \"recently used\"-ness of the key.\n They do what you think.\n\n* `peek(key)`\n\n Returns the key value (or `undefined` if not found) without\n updating the \"recently used\"-ness of the key.\n\n (If you find yourself using this a lot, you *might* be using the\n wrong sort of data structure, but there are some use cases where\n it's handy.)\n\n* `del(key)`\n\n Deletes a key out of the cache.\n\n* `reset()`\n\n Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n Check if a key is in the cache, without updating the recent-ness\n or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n Just like `Array.prototype.forEach`. Iterates over all the keys\n in the cache, in order of recent-ness. (Ie, more recently used\n items are iterated over first.)\n\n* `keys()`\n\n Return an array of the keys in the cache.\n\n* `values()`\n\n Return an array of the values in the cache.\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/isaacs/node-lru-cache/issues" - }, - "homepage": "https://github.com/isaacs/node-lru-cache", - "_id": "lru-cache@2.5.0", - "_from": "lru-cache@>=2.0.0-0 <3.0.0-0" -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/foreach.js b/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/foreach.js deleted file mode 100644 index eefb80d..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +++ /dev/null @@ -1,52 +0,0 @@ -var test = require('tap').test -var LRU = require('../') - -test('forEach', function (t) { - var l = new LRU(5) - for (var i = 0; i < 10; i ++) { - l.set(i.toString(), i.toString(2)) - } - - var i = 9 - l.forEach(function (val, key, cache) { - t.equal(cache, l) - t.equal(key, i.toString()) - t.equal(val, i.toString(2)) - i -= 1 - }) - - // get in order of most recently used - l.get(6) - l.get(8) - - var order = [ 8, 6, 9, 7, 5 ] - var i = 0 - - l.forEach(function (val, key, cache) { - var j = order[i ++] - t.equal(cache, l) - t.equal(key, j.toString()) - t.equal(val, j.toString(2)) - }) - - t.end() -}) - -test('keys() and values()', function (t) { - var l = new LRU(5) - for (var i = 0; i < 10; i ++) { - l.set(i.toString(), i.toString(2)) - } - - t.similar(l.keys(), ['9', '8', '7', '6', '5']) - t.similar(l.values(), ['1001', '1000', '111', '110', '101']) - - // get in order of most recently used - l.get(6) - l.get(8) - - t.similar(l.keys(), ['8', '6', '9', '7', '5']) - t.similar(l.values(), ['1000', '110', '1001', '111', '101']) - - t.end() -}) diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/package.json b/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/package.json deleted file mode 100644 index 23ceea0..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "sigmund", - "version": "1.0.0", - "description": "Quick and dirty signatures for Objects.", - "main": "sigmund.js", - "directories": { - "test": "test" - }, - "dependencies": {}, - "devDependencies": { - "tap": "~0.3.0" - }, - "scripts": { - "test": "tap test/*.js", - "bench": "node bench.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/sigmund" - }, - "keywords": [ - "object", - "signature", - "key", - "data", - "psychoanalysis" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "BSD", - "readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached)\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocain-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `sys.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/isaacs/sigmund/issues" - }, - "homepage": "https://github.com/isaacs/sigmund", - "_id": "sigmund@1.0.0", - "_from": "sigmund@>=1.0.0-0 <1.1.0-0" -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/LICENSE b/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/LICENSE deleted file mode 100644 index 0c44ae7..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/package.json b/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/package.json deleted file mode 100644 index c552a22..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.1", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inherits" - }, - "license": "ISC", - "scripts": { - "test": "node test" - }, - "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/isaacs/inherits/issues" - }, - "homepage": "https://github.com/isaacs/inherits", - "_id": "inherits@2.0.1", - "_from": "inherits@>=2.0.0-0 <3.0.0-0" -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/package.json b/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/package.json deleted file mode 100644 index 561b24b..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "node-uuid", - "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", - "url": "http://github.com/broofa/node-uuid", - "keywords": [ - "uuid", - "guid", - "rfc4122" - ], - "author": { - "name": "Robert Kieffer", - "email": "robert@broofa.com" - }, - "contributors": [ - { - "name": "Christoph Tavan", - "email": "dev@tavan.de" - } - ], - "lib": ".", - "main": "./uuid.js", - "repository": { - "type": "git", - "url": "https://github.com/broofa/node-uuid.git" - }, - "version": "1.4.0", - "readme": "# node-uuid\n\nSimple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.\n\nFeatures:\n\n* Generate RFC4122 version 1 or version 4 UUIDs\n* Runs in node.js and all browsers.\n* Cryptographically strong random # generation on supporting platforms\n* 1.1K minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! )\n* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html)\n\n## Getting Started\n\nInstall it in your browser:\n\n```html\n\n```\n\nOr in node.js:\n\n```\nnpm install node-uuid\n```\n\n```javascript\nvar uuid = require('node-uuid');\n```\n\nThen create some ids ...\n\n```javascript\n// Generate a v1 (time-based) id\nuuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'\n\n// Generate a v4 (random) id\nuuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'\n```\n\n## API\n\n### uuid.v1([`options` [, `buffer` [, `offset`]]])\n\nGenerate and return a RFC4122 v1 (timestamp-based) UUID.\n\n* `options` - (Object) Optional uuid state to apply. Properties may include:\n\n * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.\n * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.\n * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used.\n * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.\n\n* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.\n* `offset` - (Number) Starting index in `buffer` at which to begin writing.\n\nReturns `buffer`, if specified, otherwise the string form of the UUID\n\nNotes:\n\n1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)\n\nExample: Generate string UUID with fully-specified options\n\n```javascript\nuuid.v1({\n node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],\n clockseq: 0x1234,\n msecs: new Date('2011-11-01').getTime(),\n nsecs: 5678\n}); // -> \"710b962e-041c-11e1-9234-0123456789ab\"\n```\n\nExample: In-place generation of two binary IDs\n\n```javascript\n// Generate two ids in an array\nvar arr = new Array(32); // -> []\nuuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15]\nuuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]\n\n// Optionally use uuid.unparse() to get stringify the ids\nuuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'\nuuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'\n```\n\n### uuid.v4([`options` [, `buffer` [, `offset`]]])\n\nGenerate and return a RFC4122 v4 UUID.\n\n* `options` - (Object) Optional uuid state to apply. Properties may include:\n\n * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values\n * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values.\n\n* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.\n* `offset` - (Number) Starting index in `buffer` at which to begin writing.\n\nReturns `buffer`, if specified, otherwise the string form of the UUID\n\nExample: Generate string UUID with fully-specified options\n\n```javascript\nuuid.v4({\n random: [\n 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,\n 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36\n ]\n});\n// -> \"109156be-c4fb-41ea-b1b4-efe1671c5836\"\n```\n\nExample: Generate two IDs in a single buffer\n\n```javascript\nvar buffer = new Array(32); // (or 'new Buffer' in node.js)\nuuid.v4(null, buffer, 0);\nuuid.v4(null, buffer, 16);\n```\n\n### uuid.parse(id[, buffer[, offset]])\n### uuid.unparse(buffer[, offset])\n\nParse and unparse UUIDs\n\n * `id` - (String) UUID(-like) string\n * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used\n * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0\n\nExample parsing and unparsing a UUID string\n\n```javascript\nvar bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> \nvar string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10'\n```\n\n### uuid.noConflict()\n\n(Browsers only) Set `uuid` property back to it's previous value.\n\nReturns the node-uuid object.\n\nExample:\n\n```javascript\nvar myUuid = uuid.noConflict();\nmyUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'\n```\n\n## Deprecated APIs\n\nSupport for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version.\n\n### uuid([format [, buffer [, offset]]])\n\nuuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary).\n\n### uuid.BufferClass\n\nThe class of container created when generating binary uuid data if no buffer argument is specified. This is expected to go away, with no replacement API.\n\n## Testing\n\nIn node.js\n\n```\n> cd test\n> node test.js\n```\n\nIn Browser\n\n```\nopen test/test.html\n```\n\n### Benchmarking\n\nRequires node.js\n\n```\nnpm install uuid uuid-js\nnode benchmark/benchmark.js\n```\n\nFor a more complete discussion of node-uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/node-uuid/wiki/Benchmark)\n\nFor browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance).\n\n## Release notes\n\nv1.4\n* Improved module context detection\n* Removed public RNG functions\n\nv1.3.2:\n* Improve tests and handling of v1() options (Issue #24)\n* Expose RNG option to allow for perf testing with different generators\n\nv1.3:\n* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!\n* Support for node.js crypto API\n* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code\n", - "_id": "node-uuid@1.4.0", - "dist": { - "shasum": "07f9b2337572ff6275c775e1d48513f3a45d7a65", - "tarball": "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.0.tgz" - }, - "maintainers": [ - { - "name": "broofa", - "email": "robert@broofa.com" - } - ], - "directories": {}, - "_shasum": "07f9b2337572ff6275c775e1d48513f3a45d7a65", - "_from": "node-uuid@1.4.0", - "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.0.tgz", - "bugs": { - "url": "https://github.com/broofa/node-uuid/issues" - }, - "homepage": "https://github.com/broofa/node-uuid" -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/package.json b/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/package.json deleted file mode 100644 index 6b7b449..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "vow-queue", - "author": { - "name": "Dmitry Filatov", - "email": "dfilatov@yandex-team.ru" - }, - "description": "Vow-based task queue", - "version": "0.3.1", - "contributors": [ - { - "name": "Dmitry Filatov", - "email": "dfilatov@yandex-team.ru" - } - ], - "engines": { - "node": ">= 0.8.0" - }, - "main": "lib/queue", - "dependencies": { - "vow": "~0.4.0" - }, - "devDependencies": { - "vow": "~0.4.0", - "jshint": "2.1.3", - "mocha": "1.11.0", - "chai": "*", - "jscs": "1.0.0", - "istanbul": "0.1.39", - "mocha-istanbul": "*" - }, - "scripts": { - "test": "make validate", - "lint": "make lint", - "coverage": "make coverage", - "clean": "make clean" - }, - "repository": { - "type": "git", - "url": "http://github.com/dfilatov/vow-queue.git" - }, - "bugs": { - "url": "https://github.com/dfilatov/vow-queue/issues" - }, - "homepage": "https://github.com/dfilatov/vow-queue", - "_id": "vow-queue@0.3.1", - "dist": { - "shasum": "598c51a15b0a81a6d5fc05f4761ceb462de1e868", - "tarball": "http://registry.npmjs.org/vow-queue/-/vow-queue-0.3.1.tgz" - }, - "_from": "vow-queue@0.3.1", - "_npmVersion": "1.3.21", - "_npmUser": { - "name": "dfilatov", - "email": "dfilatov@yandex-team.ru" - }, - "maintainers": [ - { - "name": "dfilatov", - "email": "dfilatov@yandex-team.ru" - } - ], - "directories": {}, - "_shasum": "598c51a15b0a81a6d5fc05f4761ceb462de1e868", - "_resolved": "https://registry.npmjs.org/vow-queue/-/vow-queue-0.3.1.tgz", - "readme": "vow-queue [![NPM version](https://badge.fury.io/js/vow-queue.png)](http://badge.fury.io/js/vow-queue) [![Build Status](https://secure.travis-ci.org/dfilatov/vow-queue.png)](http://travis-ci.org/dfilatov/vow-queue)\n===============\n\nvow-queue is a module for task queue with weights and priorities\n\nInstallation\n------------\n\nModule can be installed using `npm`:\n\n```\nnpm install vow-queue\n```\n\nor `bower`:\n\n```\nbower install vow-queue\n```\n\nUsage\n-----\n\n````javascript\nvar Queue = require('vow-queue'),\n queue = new Queue({ weightLimit : 10 });\n \nqueue.enqueue(function() { // simple function\n return 2 * 2;\n});\n\nqueue.enqueue(function() { // function returns a promise\n // do job\n return promise;\n});\n\nqueue.enqueue( // task with custom priority and weight\n function() {\n // do job\n },\n {\n priority : 3, // this task will be started before the previous two\n weight : 5\n });\n \nqueue.start(); // starts tasks processing\n\nqueue.enqueue(function() { }); // and enqueue yet another task\n````\n", - "readmeFilename": "README.md" -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/package.json b/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/package.json deleted file mode 100644 index 9069d3b..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "vow-fs", - "version": "0.3.2", - "description": "File I/O by Vow", - "homepage": "https://github.com/dfilatov/vow-fs", - "keywords": [ - "vow", - "promise", - "file system" - ], - "author": { - "name": "Dmitry Filatov", - "email": "dfilatov@yandex-team.ru" - }, - "contributors": [ - { - "name": "Dmitry Filatov", - "email": "dfilatov@yandex-team.ru" - } - ], - "repository": { - "type": "git", - "url": "http://github.com/dfilatov/vow-fs.git" - }, - "dependencies": { - "node-uuid": "1.4.0", - "vow": "0.4.4", - "vow-queue": "0.3.1", - "glob": "3.2.8" - }, - "devDependencies": { - "nodeunit": "", - "istanbul": "" - }, - "main": "lib/fs", - "engines": { - "node": ">= 0.6.0" - }, - "scripts": { - "test": "./node_modules/istanbul/lib/cli.js test test/runner.js" - }, - "bugs": { - "url": "https://github.com/dfilatov/vow-fs/issues" - }, - "_id": "vow-fs@0.3.2", - "dist": { - "shasum": "ea2b034d85e1db8c277eb2e9a86d1c15f5d38e7a", - "tarball": "http://registry.npmjs.org/vow-fs/-/vow-fs-0.3.2.tgz" - }, - "_from": "vow-fs@0.3.2", - "_npmVersion": "1.3.21", - "_npmUser": { - "name": "dfilatov", - "email": "dfilatov@yandex-team.ru" - }, - "maintainers": [ - { - "name": "dfilatov", - "email": "dfilatov@yandex-team.ru" - } - ], - "directories": {}, - "_shasum": "ea2b034d85e1db8c277eb2e9a86d1c15f5d38e7a", - "_resolved": "https://registry.npmjs.org/vow-fs/-/vow-fs-0.3.2.tgz", - "readme": "vow-fs [![NPM version](https://badge.fury.io/js/vow-fs.png)](http://badge.fury.io/js/vow-fs) [![Build Status](https://secure.travis-ci.org/dfilatov/vow-fs.png)](http://travis-ci.org/dfilatov/vow-fs)\n======\n\n[Vow](https://github.com/dfilatov/vow)-based file I/O for Node.js\n\nRequirements\n------------\nVow-fs works with Node.js 0.6, 0.8 and 0.10.\n\nGetting Started\n---------------\nYou can install vow-fs using Node Package Manager (npm):\n\n npm install vow-fs\n\n####Usage####\n````javascript\nvar fs = require('vow-fs');\n````\n\nAPI\n---\n####read(path, [encoding=utf8])####\nReturns a promise for the file's content at a given ````path````.\n####write(path, data, [encoding=utf8])####\nWrites ````data```` to file at a given ````path````. Returns a promise for the completion of the operation.\n####append(path, data, [encoding=utf8])####\nAppends````data```` to file's content at a given ````path````. Returns a promise for the completion of the operation.\n####remove(path)####\nRemoves a file at a given ````path````. Returns a promise for the completion of the operation.\n####copy(sourcePath, targetPath)####\nCopies a file from ````sourcePath```` to ````targetPath````. Returns a promise for the completion of the operation.\n####move(sourcePath, targetPath)####\nMoves a file or directory from ````sourcePath```` to ````targetPath````. Returns a promise for the completion of the operation.\n####stat(path)####\nReturns a promise for the metadata about the given ````path```` as a [Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) object.\n####exists(path)####\nReturns a promise for whether the given ````path```` exists.\n####link(sourcePath, targetPath)####\nCreates a hard link from the ````sourcePath```` to ````targetPath````.\n####symLink(sourcePath, targetPath, [type=file])####\nCreates a symbolic link from the ````sourcePath```` to ````targetPath````.\n####chown(path, uid, gid)####\nChanges the owner of a given ````path````.\n####chmod(path, mode)####\nChanges the mode of a given ````path```` to ````mode````.\n####absolute(path)####\n####isFile(path)####\nReturns a promise for whether the given ````path```` is a file.\n####isDir(path)####\nReturns a promise for whether the given ````path```` is a directory.\n####isSocket(path)####\nReturns a promise for whether the given ````path```` is a socket.\n####isSymLink(path)####\nReturns a promise for whether the given ````path```` is a symbolic link.\n####makeTmpFile([options])####\nMakes a temporary file. Returns a promise with generated path to file.\nThe ````options````:\n * prefix (absent by default)\n * dir (operating system's directory for temp files by default)\n * ext (````.tmp```` by default)\n\n####listDir(path)####\nReturns a promise for a list of files and directories in directory at the given ````path````.\n####makeDir(path, [mode=0777], [failIfExist=false])####\nMakes a directory at a given ````path```` and any necessary subdirectories (like ````mkdir -p````). Returns a promise for the completion of the operation.\n####removeDir(path)####\nRecursively removes a directory at a given path (like ````remove -rf````). Returns a promise for the completion of the operation.\n####glob(pattern, [options])####\nMatches files using the patterns. See https://github.com/isaacs/node-glob for details.\n", - "readmeFilename": "README.md" -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/package.json b/node_modules/csscomb/node_modules/csscomb-core/package.json deleted file mode 100644 index f410090..0000000 --- a/node_modules/csscomb/node_modules/csscomb-core/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "csscomb-core", - "version": "2.0.2", - "description": "Framework for writing postprocessors", - "dependencies": { - "gonzales-pe": "~3.0.0", - "minimatch": "0.2.12", - "vow": "0.4.4", - "vow-fs": "0.3.2" - }, - "main": "lib/core.js", - "maintainers": [ - { - "name": "Tony Ganch", - "email": "tonyganch+github@gmail.com", - "url": "http://tonyganch.com/" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/csscomb/core" - }, - "readme": "# CSScomb Core\n\nCSScomb Core is a framework for writing postprocessors. \nIt provides you with a nice set of features:\n\n1. Parser with support of preprocessors\n1. API to create and use options\n1. API to process files and directories\n\n\n## Usage\n\n```js\nvar Comb = require('csscomb-core');\n// Constructor accepts a list of options to use and list of acceptable syntaxes.\nvar comb = new Comb(options, 'css');\n```\n\nFor a simple example of usage take a look [at a template project](https://github.com/csscomb/core-template). \nFeel free to fork it and modify.\n\n## List of public methods\n\nThere are a number of methods that become available once you create an instance.\n\n### comb.use(option)\n\nUse a plugin.\n\n- Params: *{Object}* Option's plugin\n- Return: *{CombCore}* Instance's object\n\n### comb.configure(config)\n\nLoad configuration from JSON. \nActivate and configure needed options.\n\n- Params: *{Object}* Config\n- Return: *{CombCore}* Instance's object\n\n### comb.getOptionsOrder()\n\nGet list of available options in exact order they will be processed. \nCan be used for testing purpose.\n\n- Return: *{Array}* List of options' names\n\n### comb.getValue(optionName)\n\nGet option's value. \nCan be used inside plugin's `process` method.\n\n- Params: *{String}* Option's name\n- Return: Value set by user for this option\n\n### comb.getSyntax()\n\nGet name of syntax that is currently being used. \nCan be used inside plugin's `process` method.\n\n- Return: *{String}* Syntax name\n\n### comb.processPath(path)\n\nProcess a file or a directory.\n\n- Params: *{String}* Path to file or directory\n- Return: *{Promise}*\n\n### comb.processDirectory(path)\n\nProcess all files in a directory.\n\n- Params: *{String}* Path to directory\n- Return: *{Promise}*\n\n### comb.processFile(path)\n\nProcess a single file.\n\n- Params: *{String}* Path to file\n- Return: *{Promise}*\n\n### comb.processString(string, options)\n\nProcess a string.\n\n- Params: \n *{String}* Code to process \n *{{context: String, filename: String, syntax: String}}* Options (optional)\n where *context* is\n Gonzales PE rule, *filename* is a file's name that is used to display errors and\n *syntax* is syntax name with `css` being a default value. \n- Return: *{String}* Processed string\n\n## Writing a plugin\n\nA plugin is a JavaScript object that has methods to set value and process AST\nnodes. \nTake a look at [Flip Comb](https://github.com/csscomb/core-template/blob/master/lib/options/flip-comments.js) for an example. \nThere are some fields you should take care of.\n\n### name\n\nOption's name as it should be used in config.\n\n- Required: yes\n- Acceptable value: *{String}*\n- Example: `\"flip-comments\"`\n\n### syntax\n\nList of syntaxes the option supports. \nThis depends on parser possibilities. \nCurrently the following work fine: `css`, `less`, `sass` and `scss`.\n\n- Required: yes\n- Acceptable value: *{Array}*\n- Example: `['css']`\n\n### accepts\n\nIn order to tell CSScomb Core which values are acceptable, plugin should have\neither `accepts` or `setValue` field. \n`accepts` should be used to provide patterns, while `setValue` is good for\nmodifying value before using it.\n\nYou can use one or several of the following: \n– `boolean: [true]` \n– `boolean: [false]` \n– `boolean: [true, false]` \n– `string: /regexp/` \n– `number: true`\n\n- Required: no, but if this field is missed, `setValue` must be set\n- Acceptable value: *{Object}*\n- Example: `{ boolean: [true] }`\n\n### setValue\n\nFunction to modify option's value before using it. \nThis field overrides `accepts` field if it's set in the plugin too.\n\n- Required: no, but if this field is missed, `accepts` must be set\n- Acceptable value: *{Function}*\n- Example: ` function(value) { return value * 4; }`\n\n### runBefore\n\nRun the plugin before another option. \n\n- Required: no\n- Acceptable value: *{String}* Another option's name\n- Example: `\"block-indent\"`\n\n### process\n\nModify AST nodes.\n\n- Required: yes\n- Acceptable value: *{Function}*\n- Example:
function(nodeType, nodeContent) {\n        if (nodeType === 'commentML') node[0] = ' (╯°□°)╯︵ ┻━┻ ';\n}
\n", - "readmeFilename": "README.md", - "gitHead": "dec99b7e4998ae8b11f8776770042a57277ca3dc", - "bugs": { - "url": "https://github.com/csscomb/core/issues" - }, - "homepage": "https://github.com/csscomb/core", - "_id": "csscomb-core@2.0.2", - "scripts": {}, - "_shasum": "a4defe2368b0a7528f6552e147029f82cc938745", - "_from": "csscomb-core@>=2.0.0-0 <2.1.0-0" -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/README.md b/node_modules/csscomb/node_modules/gonzales-pe/README.md deleted file mode 100644 index 7319a3f..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/README.md +++ /dev/null @@ -1,102 +0,0 @@ -Gonzales is a fast CSS parser. -Gonzales PE is a rework with support of preprocessors. - -Currently those are supported: SCSS, Sass, LESS. - -For a plan of future work see [issue #4](https://github.com/tonyganch/gonzales-pe/issues/4). - -## Install - -To install globally: - - npm install gonzales-pe -g - -To install as a project dependency: - - npm install gonzales-pe - -To install dev branch: - - npm install git://github.com/tonyganch/gonzales-pe.git#dev - -To clone from github: - - git clone git@github.com:tonyganch/gonzales-pe.git - -## Build - -If you installed/cloned the repo from GitHub, make sure to build library files -first. -It can be done by running `make` in the module's root directory. -`make` will build both Node.js and web versions (all files are comments-free -but not compressed). -If you need a minified version for production, feel free to use uglifier of -your choice. - -## Use - -Require Gonzales in your project: - - var gonzales = require('gonzales-pe'); - -Do something: - - var css = 'a { color: tomato }'; - console.log(gonzales.cssToAST(css)); - -You can learn more about available methods on [Gonzales usage](doc/Gonzales-Usage.md) page. - -AST is described on [Gonzales AST description](doc/AST-Description.md) page. - -You can also invoke gonzales via a shell command (if you globally install it via `npm install gonzales-pe -g`) - -``` -gonzales myFile.css -``` - -Outputs the AST for that file. Example output: - -``` -['stylesheet', - ['atrules', - ['atkeyword', - ['ident', 'import']], - ['s', ' -']]] -``` - -## Test - -To run tests: - - npm test - -This command will build library files from sources and run tests on all files -in syntax directories. - -Every test has 3 files: source stylesheet, expected AST and expected string -compiled back from AST to css. - -If some tests fail, you can find information in test logs: - -- `log/test.log` contains all information from stdout; -- `log/expected.txt` contains only expected text; -- `log/result.txt` contains only result text. - -The last two are made for your convenience: you can use any diff app to see -the defference between them. - -If you want to test one specific string or get a general idea of how Gonzales -works, you can use `test/ast.js` file. -Simply change the first two strings (`css` and `syntax` vars) and run: - - node test/ast.js - -Please remember to also run `make` every time you modify any source files. - -## Report - -If you find a bug or want to add a feature, welcome to [Issues](https://github.com/tonyganch/gonzales-pe/issues). - -If you are shy but have a question, feel free to [drop me a -line](mailto:tonyganch+gonzales@gmail.com). diff --git a/node_modules/csscomb/node_modules/gonzales-pe/bin/gonzales.js b/node_modules/csscomb/node_modules/gonzales-pe/bin/gonzales.js deleted file mode 100755 index adfe102..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/bin/gonzales.js +++ /dev/null @@ -1,11 +0,0 @@ -var gonzales = require('../lib/gonzales'), - fs = require('fs'), - filename = process.argv[2]; - -if (!filename) { - console.log('Please supply a filename. Usage "gonzales file"'); - process.exit(); -} - -console.log(gonzales.astToTree(gonzales.cssToAST(fs.readFileSync(filename).toString()))); - diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-src.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-src.js deleted file mode 100644 index ced440a..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-src.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = function astToSrc(options) { - var ast, syntax, stringify; - - ast = typeof options === 'string' ? options : options.ast; - syntax = options.syntax || 'css'; - - try { - stringify = require('./' + syntax + '/stringify'); - } catch (e) { - return console.error('Syntax "' + syntax + '" is not supported yet, sorry'); - } - - return stringify(ast); -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-string.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-string.js deleted file mode 100644 index 9409119..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/ast-to-string.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = (function() { - function dummySpaces(num) { - return ' ' - .substr(0, num * 2); - } - - return function astToString(tree, level) { - level = level || 0; - var spaces, string; - - if (level) { - spaces = dummySpaces(level); - string = '\n' + spaces + '['; - } else { - string = '['; - } - - tree.forEach(function(node) { - if (typeof node.ln !== 'undefined') return; - string += Array.isArray(node) ? - astToString(node, level + 1) : - ('\'' + node.toString() + '\''); - string += ', '; - }); - - return string.substr(0, string.length - 2) + ']'; - }; -})(); diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/mark.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/css/mark.js deleted file mode 100644 index 426b97e..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/mark.js +++ /dev/null @@ -1,117 +0,0 @@ -var TokenType = require('../token-types'); - -module.exports = (function() { - /** - * Mark whitespaces and comments - */ - function markSC(tokens) { - var tokensLength = tokens.length; - var ws = -1, // flag for whitespaces - sc = -1, // flag for whitespaces and comments - t; // current token - - // For every token in the token list, mark spaces and line breaks - // as spaces (set both `ws` and `sc` flags). Mark multiline comments - // with `sc` flag. - // If there are several spaces or tabs or line breaks or multiline - // comments in a row, group them: take the last one's index number - // and save it to the first token in the group as a reference - // (e.g., `ws_last = 7` for a group of whitespaces or `sc_last = 9` - // for a group of whitespaces and comments): - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - - if (ws === -1) ws = i; - if (sc === -1) sc = i; - - break; - case TokenType.CommentML: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - - t.sc = true; - - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - } - - /** - * Pair brackets - */ - function markBrackets(tokens) { - var tokensLength = tokens.length; - var ps = [], // parenthesis - sbs = [], // square brackets - cbs = [], // curly brackets - t; // current token - - // For every token in the token list, if we meet an opening (left) - // bracket, push its index number to a corresponding array. - // If we then meet a closing (right) bracket, look at the corresponding - // array. If there are any elements (records about previously met - // left brackets), take a token of the last left bracket (take - // the last index number from the array and find a token with - // this index number) and save right bracket's index as a reference: - for (var i = 0; i < tokens.length; i++) { - t = tokens[i]; - switch(t.type) { - case TokenType.LeftParenthesis: - ps.push(i); - break; - case TokenType.RightParenthesis: - if (ps.length) { - t.left = ps.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftSquareBracket: - sbs.push(i); - break; - case TokenType.RightSquareBracket: - if (sbs.length) { - t.left = sbs.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftCurlyBracket: - cbs.push(i); - break; - case TokenType.RightCurlyBracket: - if (cbs.length) { - t.left = cbs.pop(); - tokens[t.left].right = i; - } - break; - } - } - } - - return function(tokens) { - // Mark paired brackets: - markBrackets(tokens); - // Mark whitespaces and comments: - markSC(tokens); - } -})(); diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/node-types.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/css/node-types.js deleted file mode 100644 index b9d74c7..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/node-types.js +++ /dev/null @@ -1,49 +0,0 @@ -module.exports = { - ArgumentsType: 'arguments', - AtkeywordType: 'atkeyword', - AtrulebType: 'atruleb', - AtrulerType: 'atruler', - AtrulerqType: 'atrulerq', - AtrulersType: 'atrulers', - AtrulesType: 'atrules', - AttribType: 'attrib', - AttrselectorType: 'attrselector', - BlockType: 'block', - BracesType: 'braces', - ClassType: 'class', - CombinatorType: 'combinator', - CommentMLType: 'commentML', - DeclarationType: 'declaration', - DeclDelimType: 'declDelim', - DelimType: 'delim', - DimensionType: 'dimension', - FilterType: 'filter', - FiltervType: 'filterv', - FunctionType: 'function', - FunctionExpressionType: 'functionExpression', - IdentType: 'ident', - ImportantType: 'important', - NamespaceType: 'namespace', - NthType: 'nth', - NthselectorType: 'nthselector', - NumberType: 'number', - OperatorType: 'operator', - PercentageType: 'percentage', - ProgidType: 'progid', - PropertyType: 'property', - PropertyDelimType: 'propertyDelim', - PseudocType: 'pseudoc', - PseudoeType: 'pseudoe', - RawType: 'raw', - RulesetType: 'ruleset', - SType: 's', - SelectorType: 'selector', - ShashType: 'shash', - SimpleselectorType: 'simpleselector', - StringType: 'string', - StylesheetType: 'stylesheet', - UnaryType: 'unary', - UriType: 'uri', - ValueType: 'value', - VhashType: 'vhash' -}; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/rules.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/css/rules.js deleted file mode 100644 index 6fac5c6..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/rules.js +++ /dev/null @@ -1,2514 +0,0 @@ -var TokenType = require('../token-types'); -var NodeType = require('./node-types'); - -module.exports = (function() { - var tokens, tokensLength, pos; - - var rules = { - 'arguments': function() { return checkArguments(pos) && getArguments(); }, - 'atkeyword': function() { return checkAtkeyword(pos) && getAtkeyword(); }, - 'atruleb': function() { return checkAtruleb(pos) && getAtruleb(); }, - 'atruler': function() { return checkAtruler(pos) && getAtruler(); }, - 'atrulerq': function() { return checkAtrulerq(pos) && getAtrulerq(); }, - 'atrulers': function() { return checkAtrulers(pos) && getAtrulers(); }, - 'atrules': function() { return checkAtrules(pos) && getAtrules(); }, - 'attrib': function() { return checkAttrib(pos) && getAttrib(); }, - 'attrselector': function() { return checkAttrselector(pos) && getAttrselector(); }, - 'block': function() { return checkBlock(pos) && getBlock(); }, - 'braces': function() { return checkBraces(pos) && getBraces(); }, - 'class': function() { return checkClass(pos) && getClass(); }, - 'combinator': function() { return checkCombinator(pos) && getCombinator(); }, - 'commentML': function() { return checkCommentML(pos) && getCommentML(); }, - 'declaration': function() { return checkDeclaration(pos) && getDeclaration(); }, - 'declDelim': function() { return checkDeclDelim(pos) && getDeclDelim(); }, - 'delim': function() { return checkDelim(pos) && getDelim(); }, - 'dimension': function() { return checkDimension(pos) && getDimension(); }, - 'filter': function() { return checkFilter(pos) && getFilter(); }, - 'filterv': function() { return checkFilterv(pos) && getFilterv(); }, - 'functionExpression': function() { return checkFunctionExpression(pos) && getFunctionExpression(); }, - 'function': function() { return checkFunction(pos) && getFunction(); }, - 'ident': function() { return checkIdent(pos) && getIdent(); }, - 'important': function() { return checkImportant(pos) && getImportant(); }, - 'namespace': function() { return checkNamespace(pos) && getNamespace(); }, - 'nth': function() { return checkNth(pos) && getNth(); }, - 'nthselector': function() { return checkNthselector(pos) && getNthselector(); }, - 'number': function() { return checkNumber(pos) && getNumber(); }, - 'operator': function() { return checkOperator(pos) && getOperator(); }, - 'percentage': function() { return checkPercentage(pos) && getPercentage(); }, - 'progid': function() { return checkProgid(pos) && getProgid(); }, - 'property': function() { return checkProperty(pos) && getProperty(); }, - 'propertyDelim': function() { return checkPropertyDelim(pos) && getPropertyDelim(); }, - 'pseudoc': function() { return checkPseudoc(pos) && getPseudoc(); }, - 'pseudoe': function() { return checkPseudoe(pos) && getPseudoe(); }, - 'ruleset': function() { return checkRuleset(pos) && getRuleset(); }, - 's': function() { return checkS(pos) && getS(); }, - 'selector': function() { return checkSelector(pos) && getSelector(); }, - 'shash': function() { return checkShash(pos) && getShash(); }, - 'simpleselector': function() { return checkSimpleSelector(pos) && getSimpleSelector(); }, - 'string': function() { return checkString(pos) && getString(); }, - 'stylesheet': function() { return checkStylesheet(pos) && getStylesheet(); }, - 'unary': function() { return checkUnary(pos) && getUnary(); }, - 'uri': function() { return checkUri(pos) && getUri(); }, - 'value': function() { return checkValue(pos) && getValue(); }, - 'vhash': function() { return checkVhash(pos) && getVhash(); } - }; - - /** - * Stop parsing and display error - * @param {Number=} i Token's index number - */ - function throwError(i) { - var ln = i ? tokens[i].ln : tokens[pos].ln; - - throw {line: ln, syntax: 'css'}; - } - - /** - * @param {Object} exclude - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkExcluding(exclude, i) { - var start = i; - - while(i < tokensLength) { - if (exclude[tokens[i++].type]) break; - } - - return i - start - 2; - } - - /** - * @param {Number} start - * @param {Number} finish - * @returns {String} - */ - function joinValues(start, finish) { - var s = ''; - - for (var i = start; i < finish + 1; i++) { - s += tokens[i].value; - } - - return s; - } - - /** - * @param {Number} start - * @param {Number} num - * @returns {String} - */ - function joinValues2(start, num) { - if (start + num - 1 >= tokensLength) return; - - var s = ''; - - for (var i = 0; i < num; i++) { - s += tokens[start + i].value; - } - - return s; - } - - -///////////////////////////////////// -///////////////////////////////////// -///////////////////////////////////// - - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAny(i) { - return checkBraces(i) || - checkString(i) || - checkPercentage(i) || - checkDimension(i) || - checkNumber(i) || - checkUri(i) || - checkFunctionExpression(i) || - checkFunction(i) || - checkIdent(i) || - checkClass(i) || - checkUnary(i); - } - - /** - * @returns {Array} - */ - function getAny() { - if (checkBraces(pos)) return getBraces(); - else if (checkString(pos)) return getString(); - else if (checkPercentage(pos)) return getPercentage(); - else if (checkDimension(pos)) return getDimension(); - else if (checkNumber(pos)) return getNumber(); - else if (checkUri(pos)) return getUri(); - else if (checkFunctionExpression(pos)) return getFunctionExpression(); - else if (checkFunction(pos)) return getFunction(); - else if (checkIdent(pos)) return getIdent(); - else if (checkClass(pos)) return getClass(); - else if (checkUnary(pos)) return getUnary(); - } - - /** - * Check if token is part of an @-word (e.g. `@import`, `@include`) - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAtkeyword(i) { - var l; - - // Check that token is `@`: - if (i >= tokensLength || - tokens[i++].type !== TokenType.CommercialAt) return 0; - - return (l = checkIdent(i)) ? l + 1 : 0; - } - - /** - * Get node with @-word - * @returns {Array} `['atkeyword', ['ident', x]]` where `x` is - * an identifier without - * `@` (e.g. `import`, `include`) - */ - function getAtkeyword() { - var startPos = pos, - x; - - pos++; - - x = [NodeType.AtkeywordType, getIdent()]; - - return x; - } - - /** - * Check if token is part of an attribute selector (e.g. `[attr]`, - * `[attr='panda']`) - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAttrib(i) { - if (i >= tokensLength || - tokens[i].type !== TokenType.LeftSquareBracket || - !tokens[i].right) return 0; - - return tokens[i].right - i + 1; - } - - /** - * Get node with an attribute selector - * @returns {Array} `['attrib', ['ident', x], ['attrselector', y]*, [z]*]` - * where `x` is attribute's name, `y` is operator (if there is any) - * and `z` is attribute's value (if there is any) - */ - function getAttrib() { - if (checkAttrib1(pos)) return getAttrib1(); - if (checkAttrib2(pos)) return getAttrib2(); - } - - /** - * Check if token is part of an attribute selector of the form `[attr='value']` - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAttrib1(i) { - var start = i, - l; - - if (i++ >= tokensLength) return 0; - - if (l = checkSC(i)) i += l; - - if (l = checkIdent(i)) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - - if (l = checkAttrselector(i)) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - - if (l = checkIdent(i) || checkString(i)) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - - return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; - } - - /** - * Get node with an attribute selector of the form `[attr='value']` - * @returns {Array} `['attrib', ['ident', x], ['attrselector', y], [z]]` - * where `x` is attribute's name, `y` is operator and `z` is attribute's - * value - */ - function getAttrib1() { - var startPos = pos, - x; - - pos++; - - x = [NodeType.AttribType] - .concat(getSC()) - .concat([getIdent()]) - .concat(getSC()) - .concat([getAttrselector()]) - .concat(getSC()) - .concat([checkString(pos)? getString() : getIdent()]) - .concat(getSC()); - - pos++; - - return x; - } - - /** - * Check if token is part of an attribute selector of the form `[attr]` - * Attribute can not be empty, e.g. `[]`. - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAttrib2(i) { - var start = i, - l; - - if (i++ >= tokensLength) return 0; - - if (l = checkSC(i)) i += l; - - if (l = checkIdent(i)) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - - return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; - } - - /** - * Get node with an attribute selector of the form `[attr]` - * @returns {Array} `['attrib', ['ident', x]]` where `x` is attribute's name - */ - function getAttrib2() { - var startPos = pos, - x; - - pos++; - - x = [NodeType.AttribType] - .concat(getSC()) - .concat([getIdent()]) - .concat(getSC()); - - pos++; - - return x; - } - - /** - * Check if token is part of an attribute selector operator (`=`, `~=`, - * `^=`, `$=`, `*=` or `|=`) - * @param {Number} i Token's index number - * @returns {Number} Length of operator (`0` if token is not part of an - * operator, `1` or `2` if it is). - */ - function checkAttrselector(i) { - if (i >= tokensLength) return 0; - - if (tokens[i].type === TokenType.EqualsSign) return 1; - - // TODO: Add example or remove - if (tokens[i].type === TokenType.VerticalLine && - (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign)) - return 1; - - if (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign) return 0; - - switch(tokens[i].type) { - case TokenType.Tilde: - case TokenType.CircumflexAccent: - case TokenType.DollarSign: - case TokenType.Asterisk: - case TokenType.VerticalLine: - return 2; - } - - return 0; - } - - /** - * Get node with an attribute selector operator (`=`, `~=`, `^=`, `$=`, - * `*=` or `|=`) - * @returns {Array} `['attrselector', x]` where `x` is an operator. - */ - function getAttrselector() { - var startPos = pos, - s = tokens[pos++].value, - x; - - if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) s += tokens[pos++].value; - - x = [NodeType.AttrselectorType, s]; - - return x; - } - - /** - * Check if token is a part of an @-rule - * @param {Number} i Token's index number - * @returns {Number} Length of @-rule - */ - function checkAtrule(i) { - var l; - - if (i >= tokensLength) return 0; - - // If token already has a record of being part of an @-rule, - // return the @-rule's length: - if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l; - - // If token is part of an @-rule, save the rule's type to token: - if (l = checkAtruler(i)) tokens[i].atrule_type = 1; // @-rule with ruleset - else if (l = checkAtruleb(i)) tokens[i].atrule_type = 2; // block @-rule - else if (l = checkAtrules(i)) tokens[i].atrule_type = 3; // single-line @-rule - else return 0; - - // If token is part of an @-rule, save the rule's length to token: - tokens[i].atrule_l = l; - - return l; - } - - /** - * Get node with @-rule - * @returns {Array} - */ - function getAtrule() { - switch (tokens[pos].atrule_type) { - case 1: return getAtruler(); // @-rule with ruleset - case 2: return getAtruleb(); // block @-rule - case 3: return getAtrules(); // single-line @-rule - } - } - - /** - * Check if token is part of a block @-rule - * @param {Number} i Token's index number - * @returns {Number} Length of the @-rule - */ - function checkAtruleb(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkAtkeyword(i)) i += l; - else return 0; - - if (l = checkTsets(i)) i += l; - - if (l = checkBlock(i)) i += l; - else return 0; - - return i - start; - } - - /** - * Get node with a block @-rule - * @returns {Array} `['atruleb', ['atkeyword', x], y, ['block', z]]` - */ - function getAtruleb() { - var startPos = pos, - x; - - x = [NodeType.AtrulebType, getAtkeyword()] - .concat(getTsets()) - .concat([getBlock()]); - - return x; - } - - /** - * Check if token is part of an @-rule with ruleset - * @param {Number} i Token's index number - * @returns {Number} Length of the @-rule - */ - function checkAtruler(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkAtkeyword(i)) i += l; - else return 0; - - if (l = checkAtrulerq(i)) i += l; - - if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++; - else return 0; - - if (l = checkAtrulers(i)) i += l; - - if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++; - else return 0; - - return i - start; - } - - /** - * Get node with an @-rule with ruleset - * @returns {Array} ['atruler', ['atkeyword', x], y, z] - */ - function getAtruler() { - var startPos = pos, - x; - - x = [NodeType.AtrulerType, getAtkeyword(), getAtrulerq()]; - - pos++; - - x.push(getAtrulers()); - - pos++; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAtrulerq(i) { - return checkTsets(i); - } - - /** - * @returns {Array} `['atrulerq', x]` - */ - function getAtrulerq() { - var startPos = pos, - x; - - x = [NodeType.AtrulerqType].concat(getTsets()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAtrulers(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkSC(i)) i += l; - - while (l = checkRuleset(i) || checkAtrule(i) || checkSC(i)) { - i += l; - } - - tokens[i].atrulers_end = 1; - - if (l = checkSC(i)) i += l; - - return i - start; - } - - /** - * @returns {Array} `['atrulers', x]` - */ - function getAtrulers() { - var startPos = pos, - x; - - x = [NodeType.AtrulersType].concat(getSC()); - - while (!tokens[pos].atrulers_end) { - if (checkSC(pos)) x = x.concat(getSC()); - else if (checkAtrule(pos)) x.push(getAtrule()); - else if (checkRuleset(pos)) x.push(getRuleset()); - } - - x = x.concat(getSC()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkAtrules(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkAtkeyword(i)) i += l; - else return 0; - - if (l = checkTsets(i)) i += l; - - return i - start; - } - - /** - * @returns {Array} `['atrules', ['atkeyword', x], y]` - */ - function getAtrules() { - var startPos = pos, - x; - - x = [NodeType.AtrulesType, getAtkeyword()].concat(getTsets()); - - return x; - } - - /** - * Check if token is part of a block (e.g. `{...}`). - * @param {Number} i Token's index number - * @returns {Number} Length of the block - */ - function checkBlock(i) { - return i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket ? - tokens[i].right - i + 1 : 0; - } - - /** - * Get node with a block - * @returns {Array} `['block', x]` - */ - function getBlock() { - var startPos = pos, - end = tokens[pos].right, - x = [NodeType.BlockType]; - - pos++; - - - while (pos < end) { - if (checkBlockdecl(pos)) x = x.concat(getBlockdecl()); - else throwError(); - } - - pos = end + 1; - - return x; - } - - /** - * Check if token is part of a declaration (property-value pair) - * @param {Number} i Token's index number - * @returns {Number} Length of the declaration - */ - function checkBlockdecl(i) { - var l; - - if (i >= tokensLength) return 0; - - if (l = checkBlockdecl1(i)) tokens[i].bd_type = 1; - else if (l = checkBlockdecl2(i)) tokens[i].bd_type = 2; - else if (l = checkBlockdecl3(i)) tokens[i].bd_type = 3; - else if (l = checkBlockdecl4(i)) tokens[i].bd_type = 4; - else return 0; - - return l; - } - - /** - * @returns {Array} - */ - function getBlockdecl() { - switch (tokens[pos].bd_type) { - case 1: return getBlockdecl1(); - case 2: return getBlockdecl2(); - case 3: return getBlockdecl3(); - case 4: return getBlockdecl4(); - } - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkBlockdecl1(i) { - var start = i, - l; - - if (l = checkSC(i)) i += l; - - if (l = checkFilter(i)) tokens[i].bd_kind = 1; - else if (l = checkDeclaration(i)) tokens[i].bd_kind = 2; - else if (l = checkAtrule(i)) tokens[i].bd_kind = 3; - else return 0; - - i += l; - - if (l = checkSC(i)) i += l; - - if (i < tokensLength && (l = checkDeclDelim(i))) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - else return 0; - - return i - start; - } - - /** - * sc*:s0 (atrule | ruleset | filter | declaration):x declDelim:y sc*:s1 -> concat(s0, [x], [y], s1) - * @returns {Array} - */ - function getBlockdecl1() { - var sc = getSC(), - x; - - switch (tokens[pos].bd_kind) { - case 1: - x = getFilter(); - break; - case 2: - x = getDeclaration(); - break; - case 3: - x = getAtrule(); - break; - } - - return sc - .concat([x]) - .concat(getSC()) - .concat([getDeclDelim()]) - .concat(getSC()); - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkBlockdecl2(i) { - var start = i, - l; - - if (l = checkSC(i)) i += l; - - if (l = checkFilter(i)) tokens[i].bd_kind = 1; - else if (l = checkDeclaration(i)) tokens[i].bd_kind = 2; - else if (l = checkAtrule(i)) tokens[i].bd_kind = 3; - else return 0; - - i += l; - - if (l = checkSC(i)) i += l; - - return i - start; - } - - /** - * @returns {Array} - */ - function getBlockdecl2() { - var sc = getSC(), - x; - - switch (tokens[pos].bd_kind) { - case 1: - x = getFilter(); - break; - case 2: - x = getDeclaration(); - break; - case 3: - x = getAtrule(); - break; - } - - return sc - .concat([x]) - .concat(getSC()); - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkBlockdecl3(i) { - var start = i, - l; - - if (l = checkSC(i)) i += l; - - if (l = checkDeclDelim(i)) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - - return i - start; - } - - /** - * @returns {Array} `[s0, ['declDelim'], s1]` where `s0` and `s1` are - * are optional whitespaces. - */ - function getBlockdecl3() { - return getSC() - .concat([getDeclDelim()]) - .concat(getSC()); - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkBlockdecl4(i) { - return checkSC(i); - } - - /** - * @returns {Array} - */ - function getBlockdecl4() { - return getSC(); - } - - /** - * Check if token is part of text inside parentheses or square brackets - * (e.g. `(1)`) - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkBraces(i) { - if (i >= tokensLength || - (tokens[i].type !== TokenType.LeftParenthesis && - tokens[i].type !== TokenType.LeftSquareBracket)) return 0; - - return tokens[i].right - i + 1; - } - - /** - * Get node with text inside parentheses or square brackets (e.g. `(1)`) - * @returns {Array} `['braces', l, r, x*]` where `l` is a left bracket - * (e.g. `'('`), `r` is a right bracket (e.g. `')'`) and `x` is - * parsed text inside those brackets (if there is any) - * (e.g. `['number', '1']`) - */ - function getBraces() { - var startPos = pos, - left = pos, - right = tokens[pos].right, - x; - - pos++; - - var tsets = getTsets(); - - pos++; - - x = [NodeType.BracesType, tokens[left].value, tokens[right].value] - .concat(tsets); - - return x; - } - - /** - * Check if token is part of a class selector (e.g. `.abc`) - * @param {Number} i Token's index number - * @returns {Number} Length of the class selector - */ - function checkClass(i) { - var l; - - if (i >= tokensLength) return 0; - - if (tokens[i].class_l) return tokens[i].class_l; - - if (tokens[i++].type === TokenType.FullStop && (l = checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; - } - - return 0; - } - - /** - * Get node with a class selector - * @returns {Array} `['class', ['ident', x]]` where x is a class's - * identifier (without `.`, e.g. `abc`). - */ - function getClass() { - var startPos = pos, - x = [NodeType.ClassType]; - - pos++; - - x.push(getIdent()); - - return x; - } - - /** - * Check if token is a combinator (`+`, `>` or `~`) - * @param {Number} i Token's index number - * @returns {Number} Length of the combinator - */ - function checkCombinator(i) { - if (i >= tokensLength) return 0; - - switch (tokens[i].type) { - case TokenType.PlusSign: - case TokenType.GreaterThanSign: - case TokenType.Tilde: - return 1; - } - - return 0; - } - - /** - * Get node with a combinator (`+`, `>` or `~`) - * @returns {Array} `['combinator', x]` where `x` is a combinator - * converted to string. - */ - function getCombinator() { - var startPos = pos, - x; - - x = [NodeType.CombinatorType, tokens[pos++].value]; - - return x; - } - - /** - * Check if token is a multiline comment. - * @param {Number} i Token's index number - * @returns {Number} `1` if token is a multiline comment, otherwise `0` - */ - function checkCommentML(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0; - } - - /** - * Get node with a multiline comment - * @returns {Array} `['commentML', x]` where `x` - * is the comment's text (without `/*` and `* /`). - */ - function getCommentML() { - var startPos = pos, - s = tokens[pos].value.substring(2), - l = s.length, - x; - - if (s.charAt(l - 2) === '*' && s.charAt(l - 1) === '/') s = s.substring(0, l - 2); - - pos++; - - x = [NodeType.CommentMLType, s]; - - return x; - } - - /** - * Check if token is part of a declaration (property-value pair) - * @param {Number} i Token's index number - * @returns {Number} Length of the declaration - */ - function checkDeclaration(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkProperty(i)) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - - if (l = checkPropertyDelim(i)) i++; - else return 0; - - if (l = checkSC(i)) i += l; - - if (l = checkValue(i)) i += l; - else return 0; - - return i - start; - } - - /** - * Get node with a declaration - * @returns {Array} `['declaration', ['property', x], ['propertyDelim'], - * ['value', y]]` - */ - function getDeclaration() { - var startPos = pos, - x = [NodeType.DeclarationType]; - - x.push(getProperty()); - x = x.concat(getSC()); - x.push(getPropertyDelim()); - x = x.concat(getSC()); - x.push(getValue()); - - return x; - } - - /** - * Check if token is a semicolon - * @param {Number} i Token's index number - * @returns {Number} `1` if token is a semicolon, otherwise `0` - */ - function checkDeclDelim(i) { - return i < tokensLength && tokens[i].type === TokenType.Semicolon ? 1 : 0; - } - - /** - * Get node with a semicolon - * @returns {Array} `['declDelim']` - */ - function getDeclDelim() { - var startPos = pos, - x = [NodeType.DeclDelimType]; - - pos++; - - return x; - } - - /** - * Check if token is a comma - * @param {Number} i Token's index number - * @returns {Number} `1` if token is a comma, otherwise `0` - */ - function checkDelim(i) { - return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0; - } - - /** - * Get node with a comma - * @returns {Array} `['delim']` - */ - function getDelim() { - var startPos = pos, - x = [NodeType.DelimType]; - - pos++; - - return x; - } - - /** - * Check if token is part of a number with dimension unit (e.g. `10px`) - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkDimension(i) { - var ln = checkNumber(i), - li; - - if (i >= tokensLength || - !ln || - i + ln >= tokensLength) return 0; - - return (li = checkNmName2(i + ln)) ? ln + li : 0; - } - - /** - * Get node of a number with dimension unit - * @returns {Array} `['dimension', ['number', x], ['ident', y]]` where - * `x` is a number converted to string (e.g. `'10'`) and `y` is - * a dimension unit (e.g. `'px'`). - */ - function getDimension() { - var startPos = pos, - x = [NodeType.DimensionType, getNumber()], - ident = [NodeType.IdentType, getNmName2()]; - - x.push(ident); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkFilter(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkFilterp(i)) i += l; - else return 0; - - if (tokens[i].type === TokenType.Colon) i++; - else return 0; - - if (l = checkFilterv(i)) i += l; - else return 0; - - return i - start; - } - - /** - * @returns {Array} `['filter', x, y]` - */ - function getFilter() { - var startPos = pos, - x = [NodeType.FilterType, getFilterp()]; - - pos++; - - x.push(getFilterv()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkFilterp(i) { - var start = i, - l, - x; - - if (i >= tokensLength) return 0; - - if (tokens[i].value === 'filter') l = 1; - else { - x = joinValues2(i, 2); - - if (x === '-filter' || x === '_filter' || x === '*filter') l = 2; - else { - x = joinValues2(i, 4); - - if (x === '-ms-filter') l = 4; - else return 0; - } - } - - tokens[start].filterp_l = l; - - i += l; - - if (checkSC(i)) i += l; - - return i - start; - } - - /** - * @returns {Array} - */ - function getFilterp() { - var startPos = pos, - ident = [NodeType.IdentType, joinValues2(pos, tokens[pos].filterp_l)], - x; - - pos += tokens[pos].filterp_l; - - x = [NodeType.PropertyType, ident].concat(getSC()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkFilterv(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkSC(i)) i += l; - - if (l = checkProgid(i)) i += l; - else return 0; - - while (l = checkProgid(i)) { - i += l; - } - - tokens[start].last_progid = i; - - if (i < tokensLength && (l = checkSC(i))) i += l; - - if (i < tokensLength && (l = checkImportant(i))) i += l; - - return i - start; - } - - /** - * progid+:x -> [#filterv].concat(x) - * @returns {Array} - */ - function getFilterv() { - var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - - x = x.concat(getSC()); - - while (pos < last_progid) { - x.push(getProgid()); - } - - if (checkSC(pos)) x = x.concat(getSC()); - - if (pos < tokensLength && checkImportant(pos)) x.push(getImportant()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkFunctionExpression(i) { - var start = i; - - if (i >= tokensLength || tokens[i++].value !== 'expression' || - i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0; - - return tokens[i].right - start + 1; - } - - /** - * @returns {Array} - */ - function getFunctionExpression() { - var startPos = pos, - x, e; - - pos++; - - e = joinValues(pos + 1, tokens[pos].right - 1); - - pos = tokens[pos].right + 1; - - x = [NodeType.FunctionExpressionType, e]; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkFunction(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkIdent(i)) i +=l; - else return 0; - - return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? - tokens[i].right - start + 1 : 0; - } - - /** - * @returns {Array} - */ - function getFunction() { - var startPos = pos, - ident = getIdent(), - x = [NodeType.FunctionType, ident], - body; - - body = ident[1] === 'not' ? getNotArguments() : getArguments(); - - x.push(body); - - return x; - } - - /** - * @returns {Array} - */ - function getArguments() { - var startPos = pos, - x = [NodeType.ArgumentsType], - body; - - pos++; - - while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) { - if (checkDeclaration(pos)) x.push(getDeclaration()); - else if (checkArgument(pos)) { - body = getArgument(); - if (typeof body[0] === 'string') x.push(body); - else x = x.concat(body); - } else if (checkClass(pos)) x.push(getClass()); - else throwError(); - } - - pos++; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkArgument(i) { - return checkVhash(i) || - checkAny(i) || - checkSC(i) || - checkOperator(i); - } - - /** - * @returns {Array} - */ - function getArgument() { - if (checkVhash(pos)) return getVhash(); - else if (checkAny(pos)) return getAny(); - else if (checkSC(pos)) return getSC(); - else if (checkOperator(pos)) return getOperator(); - } - - /** - * @returns {Array} - */ - function getNotArguments() { - var startPos = pos, - x = [NodeType.ArgumentsType]; - - pos++; - - while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) { - if (checkSimpleSelector(pos)) x.push(getSimpleSelector()); - else throwError(); - } - - pos++; - - return x; - } - - /** - * Check if token is part of an identifier - * @param {Number} i Token's index number - * @returns {Number} Length of the identifier - */ - function checkIdent(i) { - var start = i, - wasIdent, - l; - - if (i >= tokensLength) return 0; - - // Check if token is part of an identifier starting with `_`: - if (tokens[i].type === TokenType.LowLine) return checkIdentLowLine(i); - - // If token is a character, `-`, `$` or `*`, skip it & continue: - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DollarSign || - tokens[i].type === TokenType.Asterisk) i++; - else return 0; - - // Remember if previous token's type was identifier: - wasIdent = tokens[i - 1].type === TokenType.Identifier; - - for (; i < tokensLength; i++) { - if (i >= tokensLength) break; - - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine) { - if (tokens[i].type !== TokenType.Identifier && - (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; - else wasIdent = true; - } - } - - if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; - - tokens[start].ident_last = i - 1; - - return i - start; - } - - /** - * Check if token is part of an identifier starting with `_` - * @param {Number} i Token's index number - * @returns {Number} Length of the identifier - */ - function checkIdentLowLine(i) { - var start = i; - - if (i++ >= tokensLength) return 0; - - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.DecimalNumber && - tokens[i].type !== TokenType.LowLine && - tokens[i].type !== TokenType.Identifier) break; - } - - // Save index number of the last token of the identifier: - tokens[start].ident_last = i - 1; - - return i - start; - } - - /** - * Get node with an identifier - * @returns {Array} `['ident', x]` where `x` is identifier's name - */ - function getIdent() { - var startPos = pos, - x = [NodeType.IdentType, joinValues(pos, tokens[pos].ident_last)]; - - pos = tokens[pos].ident_last + 1; - - return x; - } - - /** - * Check if token is part of `!important` word - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkImportant(i) { - var start = i, - l; - - if (i >= tokensLength || - tokens[i++].type !== TokenType.ExclamationMark) return 0; - - if (l = checkSC(i)) i += l; - - return tokens[i].value === 'important' ? i - start + 1 : 0; - } - - /** - * Get node with `!important` word - * @returns {Array} `['important', sc]` where `sc` is optional whitespace - */ - function getImportant() { - var startPos = pos, - x = [NodeType.ImportantType]; - - pos++; - - x = x.concat(getSC()); - - pos++; - - return x; - } - - /** - * Check if token is a namespace sign (`|`) - * @param {Number} i Token's index number - * @returns {Number} `1` if token is `|`, `0` if not - */ - function checkNamespace(i) { - return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0; - } - - /** - * Get node with a namespace sign - * @returns {Array} `['namespace']` - */ - function getNamespace() { - var startPos = pos, - x = [NodeType.NamespaceType]; - - pos++; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkNmName(i) { - var start = i; - - if (i >= tokensLength) return 0; - - // start char / word - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.LowLine || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DecimalNumber) i++; - else return 0; - - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine && - tokens[i].type !== TokenType.Identifier && - tokens[i].type !== TokenType.DecimalNumber) break; - } - - tokens[start].nm_name_last = i - 1; - - return i - start; - } - - /** - * @returns {String} - */ - function getNmName() { - var s = joinValues(pos, tokens[pos].nm_name_last); - - pos = tokens[pos].nm_name_last + 1; - - return s; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkNmName2(i) { - if (tokens[i].type === TokenType.Identifier) return 1; - else if (tokens[i].type !== TokenType.DecimalNumber) return 0; - - i++; - - return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1; - } - - /** - * @returns {String} - */ - function getNmName2() { - var s = tokens[pos].value; - - if (tokens[pos++].type === TokenType.DecimalNumber && - pos < tokensLength && - tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value; - - return s; - } - - /** - * Check if token is part of an nth-selector's identifier (e.g. `2n+1`) - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkNth(i) { - if (i >= tokensLength) return 0; - - return checkNth1(i) || checkNth2(i); - } - - /** - * Check if token is part of an nth-selector's identifier in the form of - * sequence of decimals and n-s (e.g. `3`, `n`, `2n+1`) - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkNth1(i) { - var start = i; - - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.DecimalNumber && - tokens[i].value !== 'n') break; - } - - if (i !== start) tokens[start].nth_last = i - 1; - - return i - start; - } - - /** - * Get node for nth-selector's identifier (e.g. `2n+1`) - * @returns {Array} `['nth', x]` where `x` is identifier's text - */ - function getNth() { - var startPos = pos, - x = [NodeType.NthType]; - - if (tokens[pos].nth_last) { - x.push(joinValues(pos, tokens[pos].nth_last)); - pos = tokens[pos].nth_last + 1; - } else { - x.push(tokens[pos++].value); - } - - return x; - } - - /** - * Check if token is part of `even` or `odd` nth-selector's identifier - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkNth2(i) { - return tokens[i].value === 'even' || tokens[i].value === 'odd' ? 1 : 0; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkNthf(i) { - var start = i, - l = 0; - - if (tokens[i++].type !== TokenType.Colon) return 0; - - // There was `:`: - l++; - - if (tokens[i++].value !== 'nth' || tokens[i++].value !== '-') return 0; - - // There was either `nth-` or `last-`: - l += 2; - - if ('child' === tokens[i].value) { - l += 1; - } else if ('last-child' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value) { - l += 3; - } else if ('of-type' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value) { - l += 3; - } else if ('last-of-type' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value + - tokens[i + 3].value + - tokens[i + 4].value) { - l += 5; - } else return 0; - - tokens[start + 1].nthf_last = start + l - 1; - - return l; - } - - /** - * @returns {String} - */ - function getNthf() { - pos++; - - var s = joinValues(pos, tokens[pos].nthf_last); - - pos = tokens[pos].nthf_last + 1; - - return s; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkNthselector(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkNthf(i)) i += l; - else return 0; - - if (tokens[i].type !== TokenType.LeftParenthesis || !tokens[i].right) return 0; - - l++; - - var rp = tokens[i++].right; - - while (i < rp) { - if (l = checkSC(i) || - checkUnary(i) || - checkNth(i)) i += l; - else return 0; - } - - return rp - start + 1; - } - - /** - * @returns {Array} - */ - function getNthselector() { - var startPos = pos, - nthf = [NodeType.IdentType, getNthf()], - x = [NodeType.NthselectorType]; - - x.push(nthf); - - pos++; - - while (tokens[pos].type !== TokenType.RightParenthesis) { - if (checkSC(pos)) x = x.concat(getSC()); - else if (checkUnary(pos)) x.push(getUnary()); - else if (checkNth(pos)) x.push(getNth()); - } - - pos++; - - return x; - } - - /** - * Check if token is part of a number - * @param {Number} i Token's index number - * @returns {Number} Length of number - */ - function checkNumber(i) { - if (i >= tokensLength) return 0; - - if (tokens[i].number_l) return tokens[i].number_l; - - // `10`: - if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && - (!tokens[i + 1] || - (tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop))) - return (tokens[i].number_l = 1, tokens[i].number_l); - - // `10.`: - if (i < tokensLength && - tokens[i].type === TokenType.DecimalNumber && - tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && - (!tokens[i + 2] || (tokens[i + 2].type !== TokenType.DecimalNumber))) - return (tokens[i].number_l = 2, tokens[i].number_l); - - // `.10`: - if (i < tokensLength && - tokens[i].type === TokenType.FullStop && - tokens[i + 1].type === TokenType.DecimalNumber) - return (tokens[i].number_l = 2, tokens[i].number_l); - - // `10.10`: - if (i < tokensLength && - tokens[i].type === TokenType.DecimalNumber && - tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && - tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) - return (tokens[i].number_l = 3, tokens[i].number_l); - - return 0; - } - - /** - * Get node with number - * @returns {Array} `['number', x]` where `x` is a number converted - * to string. - */ - function getNumber() { - var s = '', - startPos = pos, - l = tokens[pos].number_l, - x = [NodeType.NumberType]; - - for (var j = 0; j < l; j++) { - s += tokens[pos + j].value; - } - - pos += l; - - x.push(s); - - return x; - } - - /** - * Check if token is an operator (`/`, `,`, `:` or `=`). - * @param {Number} i Token's index number - * @returns {Number} `1` if token is an operator, otherwise `0` - */ - function checkOperator(i) { - if (i >= tokensLength) return 0; - - switch(tokens[i].type) { - case TokenType.Solidus: - case TokenType.Comma: - case TokenType.Colon: - case TokenType.EqualsSign: - return 1; - } - - return 0; - } - - /** - * Get node with an operator - * @returns {Array} `['operator', x]` where `x` is an operator converted - * to string. - */ - function getOperator() { - var startPos = pos, - x = [NodeType.OperatorType, tokens[pos++].value]; - - return x; - } - - /** - * Check if token is part of a number with percent sign (e.g. `10%`) - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkPercentage(i) { - var x; - - if (i >= tokensLength) return 0; - - x = checkNumber(i); - - if (!x || i + x >= tokensLength) return 0; - - return tokens[i + x].type === TokenType.PercentSign ? x + 1 : 0; - } - - /** - * Get node of number with percent sign - * @returns {Array} `['percentage', ['number', x]]` where `x` is a number - * (without percent sign) converted to string. - */ - function getPercentage() { - var startPos = pos, - x = [NodeType.PercentageType, getNumber()]; - - pos++; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkProgid(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkSC(i)) i += l; - - if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6; - else return 0; - - if (l = checkIdent(i)) i += l; - else return 0; - - if (l = checkSC(i)) i += l; - - if (tokens[i].type === TokenType.LeftParenthesis) { - tokens[start].progid_end = tokens[i].right; - i = tokens[i].right + 1; - } else return 0; - - if (l = checkSC(i)) i += l; - - return i - start; - } - - /** - * @returns {Array} - */ - function getProgid() { - var startPos = pos, - progid_end = tokens[pos].progid_end, - x; - - x = [NodeType.ProgidType] - .concat(getSC()) - .concat([_getProgid(progid_end)]) - .concat(getSC()); - - return x; - } - - /** - * @param {Number} progid_end - * @returns {Array} - */ - function _getProgid(progid_end) { - var startPos = pos, - x = [NodeType.RawType, joinValues(pos, progid_end)]; - - pos = progid_end + 1; - - return x; - } - - /** - * Check if token is part of a property - * @param {Number} i Token's index number - * @returns {Number} Length of the property - */ - function checkProperty(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkIdent(i)) i += l; - else return 0; - - return i - start; - } - - /** - * Get node with a property - * @returns {Array} `['property', x]` - */ - function getProperty() { - var startPos = pos, - x = [NodeType.PropertyType]; - - x.push(getIdent()); - - return x; - } - - /** - * Check if token is a colon - * @param {Number} i Token's index number - * @returns {Number} `1` if token is a colon, otherwise `0` - */ - function checkPropertyDelim(i) { - return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0; - } - - /** - * Get node with a colon - * @returns {Array} `['propertyDelim']` - */ - function getPropertyDelim() { - var startPos = pos, - x = [NodeType.PropertyDelimType]; - - pos++; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkPseudo(i) { - return checkPseudoe(i) || - checkPseudoc(i); - } - - /** - * @returns {Array} - */ - function getPseudo() { - if (checkPseudoe(pos)) return getPseudoe(); - if (checkPseudoc(pos)) return getPseudoc(); - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkPseudoe(i) { - var l; - - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || - i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - - return (l = checkIdent(i)) ? l + 2 : 0; - } - - /** - * @returns {Array} - */ - function getPseudoe() { - var startPos = pos, - x = [NodeType.PseudoeType]; - - pos += 2; - - x.push(getIdent()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkPseudoc(i) { - var l; - - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - - return (l = checkFunction(i) || checkIdent(i)) ? l + 1 : 0; - } - - /** - * @returns {Array} - */ - function getPseudoc() { - var startPos = pos, - x = [NodeType.PseudocType]; - - pos ++; - - x.push(checkFunction(pos) ? getFunction() : getIdent()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkRuleset(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (tokens[start].ruleset_l) return tokens[start].ruleset_l; - - while (i < tokensLength) { - if (l = checkBlock(i)) {i += l; break;} - else if (l = checkSelector(i)) i += l; - else return 0; - } - - tokens[start].ruleset_l = i - start; - - return i - start; - } - - /** - * @returns {Array} - */ - function getRuleset() { - var startPos = pos, - x = [NodeType.RulesetType]; - - while (pos < tokensLength) { - if (checkBlock(pos)) {x.push(getBlock()); break;} - else if (checkSelector(pos)) x.push(getSelector()); - else break; - } - - return x; - } - - /** - * Check if token is marked as a space (if it's a space or a tab - * or a line break). - * @param i - * @returns {Number} Number of spaces in a row starting with the given token. - */ - function checkS(i) { - return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0; - } - - /** - * Get node with spaces - * @returns {Array} `['s', x]` where `x` is a string containing spaces - */ - function getS() { - var startPos = pos, - x = [NodeType.SType, joinValues(pos, tokens[pos].ws_last)]; - - pos = tokens[pos].ws_last + 1; - - return x; - } - - /** - * Check if token is a space or a comment. - * @param {Number} i Token's index number - * @returns {Number} Number of similar (space or comment) tokens - * in a row starting with the given token. - */ - function checkSC(i) { - var l, - lsc = 0; - - while (i < tokensLength) { - if (!(l = checkS(i)) && - !(l = checkCommentML(i))) break; - i += l; - lsc += l; - } - - return lsc || 0; - } - - /** - * Get node with spaces and comments - * @returns {Array} Array containing nodes with spaces (if there are any) - * and nodes with comments (if there are any): - * `[['s', x]*, ['comment', y]*]` where `x` is a string of spaces - * and `y` is a comment's text (without `/*` and `* /`). - */ - function getSC() { - var sc = []; - - if (pos >= tokensLength) return sc; - - while (pos < tokensLength) { - if (checkS(pos)) sc.push(getS()); - else if (checkCommentML(pos)) sc.push(getCommentML()); - else break; - } - - return sc; - } - - /** - * Check if token is part of a selector - * @param {Number} i Token's index number - * @returns {Number} Length of the selector - */ - function checkSelector(i) { - var start = i, - l; - - while (i < tokensLength) { - if (l = checkSimpleSelector(i) || checkDelim(i)) i += l; - else break; - } - - if (i !== start) tokens[start].selector_end = i - 1; - - return i - start; - } - - /** - * @returns {Array} - */ - function getSelector() { - var startPos = pos, - x = [NodeType.SelectorType], - selector_end = tokens[pos].selector_end; - - while (pos <= selector_end) { - x.push(checkDelim(pos) ? getDelim() : getSimpleSelector()); - } - - return x; - } - - /** - * Check if token is part of a hexadecimal number (e.g. `#fff`) inside - * a simple selector - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkShash(i) { - var l; - - if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; - - return (l = checkNmName(i + 1)) ? l + 1 : 0; - } - - /** - * Get node with a hexadecimal number (e.g. `#fff`) inside a simple - * selector - * @returns {Array} `['shash', x]` where `x` is a hexadecimal number - * converted to string (without `#`, e.g. `fff`) - */ - function getShash() { - var startPos = pos, - x = [NodeType.ShashType]; - - pos++; - - x.push(getNmName()); - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkSimpleSelector(i) { - var start = i, - l; - - while (i < tokensLength) { - if (l = checkSimpleSelector1(i)) i += l; - else break; - } - - return i - start; - } - - /** - * @returns {Array} - */ - function getSimpleSelector() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t; - - while (pos < tokensLength) { - if (!checkSimpleSelector1(pos)) break; - t = getSimpleSelector1(); - - if (typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkSimpleSelector1(i) { - return checkNthselector(i) || - checkCombinator(i) || - checkAttrib(i) || - checkPseudo(i) || - checkShash(i) || - checkAny(i) || - checkSC(i) || - checkNamespace(i); - } - - /** - * @returns {Array} - */ - function getSimpleSelector1() { - if (checkNthselector(pos)) return getNthselector(); - else if (checkCombinator(pos)) return getCombinator(); - else if (checkAttrib(pos)) return getAttrib(); - else if (checkPseudo(pos)) return getPseudo(); - else if (checkShash(pos)) return getShash(); - else if (checkAny(pos)) return getAny(); - else if (checkSC(pos)) return getSC(); - else if (checkNamespace(pos)) return getNamespace(); - } - - /** - * Check if token is part of a string (text wrapped in quotes) - * @param {Number} i Token's index number - * @returns {Number} `1` if token is part of a string, `0` if not - */ - function checkString(i) { - return i < tokensLength && (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) ? 1 : 0; - } - - /** - * Get string's node - * @returns {Array} `['string', x]` where `x` is a string (including - * quotes). - */ - function getString() { - var startPos = pos, - x = [NodeType.StringType, tokens[pos++].value]; - - return x; - } - - /** - * Validate stylesheet: it should consist of any number (0 or more) of - * rulesets (sets of rules with selectors), @-rules, whitespaces or - * comments. - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkStylesheet(i) { - var start = i, - l; - - // Check every token: - while (i < tokensLength) { - if (l = checkSC(i) || - checkDeclDelim(i) || - checkAtrule(i) || - checkRuleset(i)) i += l; - else throwError(i); - } - - return i - start; - } - - /** - * @returns {Array} `['stylesheet', x]` where `x` is all stylesheet's - * nodes. - */ - function getStylesheet() { - var startPos = pos, - x = [NodeType.StylesheetType]; - - while (pos < tokensLength) { - if (checkSC(pos)) x = x.concat(getSC()); - else if (checkRuleset(pos)) x.push(getRuleset()); - else if (checkAtrule(pos)) x.push(getAtrule()); - else if (checkDeclDelim(pos)) x.push(getDeclDelim()); - else throwError(); - } - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkTset(i) { - return checkVhash(i) || - checkAny(i) || - checkSC(i) || - checkOperator(i); - } - - /** - * @returns {Array} - */ - function getTset() { - if (checkVhash(pos)) return getVhash(); - else if (checkAny(pos)) return getAny(); - else if (checkSC(pos)) return getSC(); - else if (checkOperator(pos)) return getOperator(); - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkTsets(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - while (l = checkTset(i)) { - i += l; - } - - return i - start; - } - - /** - * @returns {Array} - */ - function getTsets() { - var x = [], - t; - - while (t = getTset()) { - if (typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - - return x; - } - - /** - * Check if token is an unary (arithmetical) sign (`+` or `-`) - * @param {Number} i Token's index number - * @returns {Number} `1` if token is an unary sign, `0` if not - */ - function checkUnary(i) { - return i < tokensLength && (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) ? 1 : 0; - } - - /** - * Get node with an unary (arithmetical) sign (`+` or `-`) - * @returns {Array} `['unary', x]` where `x` is an unary sign - * converted to string. - */ - function getUnary() { - var startPos = pos, - x = [NodeType.UnaryType, tokens[pos++].value]; - - return x; - } - - /** - * Check if token is part of URI (e.g. `url('/css/styles.css')`) - * @param {Number} i Token's index number - * @returns {Number} Length of URI - */ - function checkUri(i) { - var start = i; - - if (i >= tokensLength || tokens[i++].value !== 'url' || - i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) - return 0; - - return tokens[i].right - start + 1; - } - - /** - * Get node with URI - * @returns {Array} `['uri', x]` where `x` is URI's nodes (without `url` - * and braces, e.g. `['string', ''/css/styles.css'']`). - */ - function getUri() { - var startPos = pos, - uriExcluding = {}, - uri, - l, - raw; - - pos += 2; - - uriExcluding[TokenType.Space] = 1; - uriExcluding[TokenType.Tab] = 1; - uriExcluding[TokenType.Newline] = 1; - uriExcluding[TokenType.LeftParenthesis] = 1; - uriExcluding[TokenType.RightParenthesis] = 1; - - if (checkUri1(pos)) { - uri = [NodeType.UriType] - .concat(getSC()) - .concat([getString()]) - .concat(getSC()); - - pos++; - } else { - uri = [NodeType.UriType].concat(getSC()), - l = checkExcluding(uriExcluding, pos), - raw = [NodeType.RawType, joinValues(pos, pos + l)]; - - uri.push(raw); - - pos += l + 1; - - uri = uri.concat(getSC()); - - pos++; - } - - return uri; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkUri1(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (l = checkSC(i)) i += l; - - if (tokens[i].type !== TokenType.StringDQ && tokens[i].type !== TokenType.StringSQ) return 0; - - i++; - - if (l = checkSC(i)) i += l; - - return i - start; - } - - /** - * Check if token is part of a value - * @param {Number} i Token's index number - * @returns {Number} Length of the value - */ - function checkValue(i) { - var start = i, - l, s, _i; - - while (i < tokensLength) { - s = checkSC(i); - _i = i + s; - - if (l = _checkValue(_i)) i += l + s; - else break; - } - - return i - start; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function _checkValue(i) { - return checkVhash(i) || - checkAny(i) || - checkOperator(i) || - checkImportant(i); - } - - /** - * @returns {Array} - */ - function getValue() { - var startPos = pos, - x = [NodeType.ValueType], - s, _pos; - - while (pos < tokensLength) { - s = checkSC(pos); - _pos = pos + s; - - if (!_checkValue(_pos)) break; - - if (s) x = x.concat(getSC()); - x.push(_getValue()); - } - - return x; - } - - /** - * @returns {Array} - */ - function _getValue() { - if (checkVhash(pos)) return getVhash(); - else if (checkAny(pos)) return getAny(); - else if (checkOperator(pos)) return getOperator(); - else if (checkImportant(pos)) return getImportant(); - } - - /** - * Check if token is part of a hexadecimal number (e.g. `#fff`) inside - * some value - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkVhash(i) { - var l; - - if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; - - return (l = checkNmName2(i + 1)) ? l + 1 : 0; - } - - /** - * Get node with a hexadecimal number (e.g. `#fff`) inside some value - * @returns {Array} `['vhash', x]` where `x` is a hexadecimal number - * converted to string (without `#`, e.g. `'fff'`). - */ - function getVhash() { - var startPos = pos, - x = [NodeType.VhashType]; - - pos++; - - x.push(getNmName2()); - - return x; - } - - return function(_tokens, rule) { - tokens = _tokens; - tokensLength = tokens.length; - pos = 0; - - return rules[rule](); - }; -})(); diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/stringify.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/css/stringify.js deleted file mode 100644 index 166f77e..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/stringify.js +++ /dev/null @@ -1,97 +0,0 @@ -module.exports = function stringify(tree) { - // TODO: Better error message - if (!tree) throw new Error('We need tree to translate'); - - var _m_simple = { - 'attrselector': 1, 'combinator': 1, 'nth': 1, 'number': 1, - 'operator': 1, 'raw': 1, 's': 1, 'string': 1, 'unary': 1 - }, - _m_composite = { - 'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, 'atrules': 1, - 'declaration': 1, 'dimension': 1, 'filterv': 1, 'function': 1, - 'ident': 1, 'selector': 1, 'progid': 1, 'property': 1, - 'ruleset': 1, 'simpleselector': 1, 'stylesheet': 1, 'value': 1 - }, - _m_primitive = { - 'declDelim': ';', 'delim': ',', 'namespace': '|', - 'propertyDelim' : ':' - }; - - function _t(tree) { - var t = tree[0]; - if (t in _m_primitive) return _m_primitive[t]; - else if (t in _m_simple) return _simple(tree); - else if (t in _m_composite) return _composite(tree); - return _unique[t](tree); - } - - function _composite(t, i) { - var s = ''; - i = i === undefined ? 1 : i; - for (; i < t.length; i++) s += typeof t[i] === 'string' ? t[i] : _t(t[i]); - return s; - } - - function _simple(t) { - return t[1]; - } - - var _unique = { - 'arguments': function(t) { - return '(' + _composite(t) + ')'; - }, - 'atkeyword': function(t) { - return '@' + _t(t[1]); - }, - 'atruler': function(t) { - return _t(t[1]) + _t(t[2]) + '{' + _t(t[3]) + '}'; - }, - 'attrib': function(t) { - return '[' + _composite(t) + ']'; - }, - 'block': function(t) { - return '{' + _composite(t) + '}'; - }, - 'braces': function(t) { - return t[1] + _composite(t, 3) + t[2]; - }, - 'class': function(t) { - return '.' + _t(t[1]); - }, - 'commentML': function (t) { - return '/*' + t[1] + '*/'; - }, - 'filter': function(t) { - return _t(t[1]) + ':' + _t(t[2]); - }, - 'functionExpression': function(t) { - return 'expression(' + t[1] + ')'; - }, - 'important': function(t) { - return '!' + _composite(t) + 'important'; - }, - 'nthselector': function(t) { - return ':' + _simple(t[1]) + '(' + _composite(t, 2) + ')'; - }, - 'percentage': function(t) { - return _t(t[1]) + '%'; - }, - 'pseudoc': function(t) { - return ':' + _t(t[1]); - }, - 'pseudoe': function(t) { - return '::' + _t(t[1]); - }, - 'shash': function (t) { - return '#' + t[1]; - }, - 'uri': function(t) { - return 'url(' + _composite(t) + ')'; - }, - 'vhash': function(t) { - return '#' + t[1]; - } - }; - - return _t(tree); -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.ast-to-css.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.ast-to-css.js deleted file mode 100644 index 911aac3..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.ast-to-css.js +++ /dev/null @@ -1,121 +0,0 @@ -function astToCSS(options) { - var tree, hasInfo, syntax; - if (!options) throw new Error('We need tree to translate'); - tree = typeof options === 'string' ? options : options.ast; - hasInfo = typeof tree[0] === 'object'; - syntax = options.syntax || 'css'; - var _m_simple = { - 'attrselector': 1, 'combinator': 1, 'ident': 1, 'nth': 1, 'number': 1, - 'operator': 1, 'raw': 1, 's': 1, 'string': 1, 'unary': 1, 'unknown': 1 - }, - _m_composite = { - 'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, 'atrules': 1,'condition': 1, - 'declaration': 1, 'dimension': 1, 'filterv': 1, 'include': 1, - 'loop': 1, 'mixin': 1, 'selector': 1, 'progid': 1, 'property': 1, - 'ruleset': 1, 'simpleselector': 1, 'stylesheet': 1, 'value': 1 - }, - _m_primitive = { - 'cdc': 'cdc', 'cdo': 'cdo', - 'declDelim': syntax === 'sass' ? '\n' : ';', - 'delim': ',', - 'namespace': '|', 'parentselector': '&', 'propertyDelim' : ':' - }; - function _t(tree) { - var t = tree[hasInfo? 1 : 0]; - if (t in _m_primitive) return _m_primitive[t]; - else if (t in _m_simple) return _simple(tree); - else if (t in _m_composite) return _composite(tree); - return _unique[t](tree); - } - function _composite(t, i) { - var s = ''; - i = i === undefined ? (hasInfo? 2 : 1) : i; - for (; i < t.length; i++) s += _t(t[i]); - return s; - } - function _simple(t) { - return t[hasInfo? 2 : 1]; - } - var _unique = { - 'arguments': function(t) { - return '(' + _composite(t) + ')'; - }, - 'atkeyword': function(t) { - return '@' + _t(t[hasInfo? 2 : 1]); - }, - 'atruler': function(t) { - return _t(t[hasInfo? 2 : 1]) + _t(t[hasInfo? 3 : 2]) + '{' + _t(t[hasInfo? 4 : 3]) + '}'; - }, - 'attrib': function(t) { - return '[' + _composite(t) + ']'; - }, - 'block': function(t) { - return syntax === 'sass' ? _composite(t) : '{' + _composite(t) + '}'; - }, - 'braces': function(t) { - return t[hasInfo? 2 : 1] + _composite(t, hasInfo? 4 : 3) + t[hasInfo? 3 : 2]; - }, - 'class': function(t) { - return '.' + _t(t[hasInfo? 2 : 1]); - }, - 'commentML': function (t) { - return '/*' + t[hasInfo? 2 : 1] + (syntax === 'sass' ? '' : '*/'); - }, - 'commentSL': function (t) { - return '/' + '/' + t[hasInfo? 2 : 1]; - }, - 'default': function(t) { - return '!' + _composite(t) + 'default'; - }, - 'escapedString': function(t) { - return '~' + t[hasInfo? 2 : 1]; - }, - 'filter': function(t) { - return _t(t[hasInfo? 2 : 1]) + ':' + _t(t[hasInfo? 3 : 2]); - }, - 'functionExpression': function(t) { - return 'expression(' + t[hasInfo? 2 : 1] + ')'; - }, - 'function': function(t) { - return _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t[hasInfo? 3: 2]) + ')'; - }, - 'important': function(t) { - return '!' + _composite(t) + 'important'; - }, - 'interpolatedVariable': function(t) { - return (syntax === 'less' ? '@{' : '#\{$') + _t(t[hasInfo? 2 : 1]) + '}'; - }, - 'nthselector': function(t) { - return ':' + _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t, hasInfo? 3 : 2) + ')'; - }, - 'percentage': function(t) { - return _t(t[hasInfo? 2 : 1]) + '%'; - }, - 'placeholder': function(t) { - return '%' + _t(t[hasInfo? 2 : 1]); - }, - 'pseudoc': function(t) { - return ':' + _t(t[hasInfo? 2 : 1]); - }, - 'pseudoe': function(t) { - return '::' + _t(t[hasInfo? 2 : 1]); - }, - 'shash': function (t) { - return '#' + t[hasInfo? 2 : 1]; - }, - 'uri': function(t) { - return 'url(' + _composite(t) + ')'; - }, - 'variable': function(t) { - return (syntax === 'less' ? '@' : '$') + _t(t[hasInfo? 2 : 1]); - }, - 'variableslist': function(t) { - return _t(t[hasInfo? 2 : 1]) + '...'; - }, - 'vhash': function(t) { - return '#' + t[hasInfo? 2 : 1]; - } - }; - return _t(tree); -} -exports.astToCSS = astToCSS; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.css-to-ast.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.css-to-ast.js deleted file mode 100644 index 1d30504..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.css-to-ast.js +++ /dev/null @@ -1,3832 +0,0 @@ -var cssToAST = (function() { - var syntaxes = {}, - s, - needInfo, - tokens, - tokensLength, - tn = 0, - ln = 1, - pos = 0; - function pushToken(type, value) { - tokens.push({ tn: tn++, ln: ln, type: type, value: value }); - } - function throwError(i) { - var ln = i ? tokens[i].ln : tokens[pos].ln; - throw new Error('Please check the validity of the CSS block starting from the line #' + ln); - } - function getInfo(i) { - return { ln: tokens[i].ln, tn: tokens[i].tn }; - } - function checkExcluding(exclude, i) { - var start = i; - while(i < tokensLength) { - if (exclude[tokens[i++].type]) break; - } - return i - start - 2; - } - function joinValues(start, finish) { - var s = ''; - for (var i = start; i < finish + 1; i++) { - s += tokens[i].value; - } - return s; - } - function joinValues2(start, num) { - if (start + num - 1 >= tokensLength) return; - var s = ''; - for (var i = 0; i < num; i++) { - s += tokens[start + i].value; - } - return s; - } -var TokenType = { - StringSQ: 'StringSQ', - StringDQ: 'StringDQ', - CommentML: 'CommentML', - CommentSL: 'CommentSL', - Newline: 'Newline', - Space: 'Space', - Tab: 'Tab', - ExclamationMark: 'ExclamationMark', - QuotationMark: 'QuotationMark', - NumberSign: 'NumberSign', - DollarSign: 'DollarSign', - PercentSign: 'PercentSign', - Ampersand: 'Ampersand', - Apostrophe: 'Apostrophe', - LeftParenthesis: 'LeftParenthesis', - RightParenthesis: 'RightParenthesis', - Asterisk: 'Asterisk', - PlusSign: 'PlusSign', - Comma: 'Comma', - HyphenMinus: 'HyphenMinus', - FullStop: 'FullStop', - Solidus: 'Solidus', - Colon: 'Colon', - Semicolon: 'Semicolon', - LessThanSign: 'LessThanSign', - EqualsSign: 'EqualsSign', - GreaterThanSign: 'GreaterThanSign', - QuestionMark: 'QuestionMark', - CommercialAt: 'CommercialAt', - LeftSquareBracket: 'LeftSquareBracket', - ReverseSolidus: 'ReverseSolidus', - RightSquareBracket: 'RightSquareBracket', - CircumflexAccent: 'CircumflexAccent', - LowLine: 'LowLine', - LeftCurlyBracket: 'LeftCurlyBracket', - VerticalLine: 'VerticalLine', - RightCurlyBracket: 'RightCurlyBracket', - Tilde: 'Tilde', - Identifier: 'Identifier', - DecimalNumber: 'DecimalNumber' -}; -var NodeType = { - ArgumentsType: 'arguments', - AtkeywordType: 'atkeyword', - AtrulebType: 'atruleb', - AtrulerType: 'atruler', - AtrulerqType: 'atrulerq', - AtrulersType: 'atrulers', - AtrulesType: 'atrules', - AttribType: 'attrib', - AttrselectorType: 'attrselector', - BlockType: 'block', - BracesType: 'braces', - CdcType: 'cdc', - CdoType: 'cdo', - ClassType: 'class', - CombinatorType: 'combinator', - CommentMLType: 'commentML', - CommentSLType: 'commentSL', - ConditionType: 'condition', - DeclarationType: 'declaration', - DeclDelimType: 'declDelim', - DefaultType: 'default', - DelimType: 'delim', - DimensionType: 'dimension', - EscapedStringType: 'escapedString', - FilterType: 'filter', - FiltervType: 'filterv', - FunctionType: 'function', - FunctionBodyType: 'functionBody', - FunctionExpressionType: 'functionExpression', - IdentType: 'ident', - ImportantType: 'important', - IncludeType :'include', - InterpolatedVariableType: 'interpolatedVariable', - LoopType: 'loop', - MixinType: 'mixin', - NamespaceType: 'namespace', - NthType: 'nth', - NthselectorType: 'nthselector', - NumberType: 'number', - OperatorType: 'operator', - ParentSelectorType: 'parentselector', - PercentageType: 'percentage', - PlaceholderType: 'placeholder', - ProgidType: 'progid', - PropertyType: 'property', - PropertyDelimType: 'propertyDelim', - PseudocType: 'pseudoc', - PseudoeType: 'pseudoe', - RawType: 'raw', - RulesetType: 'ruleset', - SType: 's', - SelectorType: 'selector', - ShashType: 'shash', - SimpleselectorType: 'simpleselector', - StringType: 'string', - StylesheetType: 'stylesheet', - UnaryType: 'unary', - UnknownType: 'unknown', - UriType: 'uri', - ValueType: 'value', - VariableType: 'variable', - VariablesListType: 'variableslist', - VhashType: 'vhash' -}; -var getTokens = (function() { - var Punctuation, - urlMode = false, - blockMode = 0; - Punctuation = { - ' ': TokenType.Space, - '\n': TokenType.Newline, - '\r': TokenType.Newline, - '\t': TokenType.Tab, - '!': TokenType.ExclamationMark, - '"': TokenType.QuotationMark, - '#': TokenType.NumberSign, - '$': TokenType.DollarSign, - '%': TokenType.PercentSign, - '&': TokenType.Ampersand, - '\'': TokenType.Apostrophe, - '(': TokenType.LeftParenthesis, - ')': TokenType.RightParenthesis, - '*': TokenType.Asterisk, - '+': TokenType.PlusSign, - ',': TokenType.Comma, - '-': TokenType.HyphenMinus, - '.': TokenType.FullStop, - '/': TokenType.Solidus, - ':': TokenType.Colon, - ';': TokenType.Semicolon, - '<': TokenType.LessThanSign, - '=': TokenType.EqualsSign, - '>': TokenType.GreaterThanSign, - '?': TokenType.QuestionMark, - '@': TokenType.CommercialAt, - '[': TokenType.LeftSquareBracket, - ']': TokenType.RightSquareBracket, - '^': TokenType.CircumflexAccent, - '_': TokenType.LowLine, - '{': TokenType.LeftCurlyBracket, - '|': TokenType.VerticalLine, - '}': TokenType.RightCurlyBracket, - '~': TokenType.Tilde - }; - function isDecimalDigit(c) { - return '0123456789'.indexOf(c) >= 0; - } - function parseSpaces(css) { - var start = pos; - for (; pos < css.length; pos++) { - if (css.charAt(pos) !== ' ') break; - } - pushToken(TokenType.Space, css.substring(start, pos)); - pos--; - } - function parseString(css, q) { - var start = pos; - for (pos = pos + 1; pos < css.length; pos++) { - if (css.charAt(pos) === '\\') pos++; - else if (css.charAt(pos) === q) break; - } - pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1)); - } - function parseDecimalNumber(css) { - var start = pos; - for (; pos < css.length; pos++) { - if (!isDecimalDigit(css.charAt(pos))) break; - } - pushToken(TokenType.DecimalNumber, css.substring(start, pos)); - pos--; - } - function parseIdentifier(css) { - var start = pos; - while (css.charAt(pos) === '/') pos++; - for (; pos < css.length; pos++) { - if (css.charAt(pos) === '\\') pos++; - else if (css.charAt(pos) in Punctuation) break; - } - var ident = css.substring(start, pos); - urlMode = urlMode || ident === 'url'; - pushToken(TokenType.Identifier, ident); - pos--; - } - function _getTokens(css, syntax) { - var c, - cn; - tokens = []; - pos = 0; - tn = 0; - ln = 1; - for (pos = 0; pos < css.length; pos++) { - c = css.charAt(pos); - cn = css.charAt(pos + 1); - if (c === '/' && cn === '*') { - s.parseMLComment(css); - } - else if (!urlMode && c === '/' && cn === '/') { - if (syntax === 'css' && blockMode > 0) parseIdentifier(css); - else s.parseSLComment && s.parseSLComment(css); - } - else if (c === '"' || c === "'") { - parseString(css, c); - } - else if (c === ' ') { - parseSpaces(css) - } - else if (c in Punctuation) { - pushToken(Punctuation[c], c); - if (c === '\n' || c === '\r') ln++; - if (c === ')') urlMode = false; - if (c === '{') blockMode++; - if (c === '}') blockMode--; - } - else if (isDecimalDigit(c)) { - parseDecimalNumber(css); - } - else { - parseIdentifier(css); - } - } - } - return function(s, syntax) { - return _getTokens(s, syntax); - }; -}()); -var rules = { - 'arguments': function() { if (s.checkArguments(pos)) return s.getArguments() }, - 'atkeyword': function() { if (s.checkAtkeyword(pos)) return s.getAtkeyword() }, - 'atruleb': function() { if (s.checkAtruleb(pos)) return s.getAtruleb() }, - 'atruler': function() { if (s.checkAtruler(pos)) return s.getAtruler() }, - 'atrulerq': function() { if (s.checkAtrulerq(pos)) return s.getAtrulerq() }, - 'atrulers': function() { if (s.checkAtrulers(pos)) return s.getAtrulers() }, - 'atrules': function() { if (s.checkAtrules(pos)) return s.getAtrules() }, - 'attrib': function() { if (s.checkAttrib(pos)) return s.getAttrib() }, - 'attrselector': function() { if (s.checkAttrselector(pos)) return s.getAttrselector() }, - 'block': function() { if (s.checkBlock(pos)) return s.getBlock() }, - 'braces': function() { if (s.checkBraces(pos)) return s.getBraces() }, - 'class': function() { if (s.checkClass(pos)) return s.getClass() }, - 'combinator': function() { if (s.checkCombinator(pos)) return s.getCombinator() }, - 'commentML': function() { if (s.checkCommentML(pos)) return s.getCommentML() }, - 'commentSL': function() { if (s.checkCommentSL(pos)) return s.getCommentSL() }, - 'condition': function() { if (s.checkCondition(pos)) return s.getCondition() }, - 'declaration': function() { if (s.checkDeclaration(pos)) return s.getDeclaration() }, - 'declDelim': function() { if (s.checkDeclDelim(pos)) return s.getDeclDelim() }, - 'default': function () { if (s.checkDefault(pos)) return s.getDefault() }, - 'delim': function() { if (s.checkDelim(pos)) return s.getDelim() }, - 'dimension': function() { if (s.checkDimension(pos)) return s.getDimension() }, - 'escapedString': function() { if (s.checkEscapedString(pos)) return s.getEscapedString() }, - 'filter': function() { if (s.checkFilter(pos)) return s.getFilter() }, - 'filterv': function() { if (s.checkFilterv(pos)) return s.getFilterv() }, - 'functionExpression': function() { if (s.checkFunctionExpression(pos)) return s.getFunctionExpression() }, - 'function': function() { if (s.checkFunction(pos)) return s.getFunction() }, - 'ident': function() { if (s.checkIdent(pos)) return s.getIdent() }, - 'important': function() { if (s.checkImportant(pos)) return s.getImportant() }, - 'include': function () { if (s.checkInclude(pos)) return s.getInclude() }, - 'interpolatedVariable': function () { if (s.checkInterpolatedVariable(pos)) return s.getInterpolatedVariable() }, - 'loop': function() { if (s.checkLoop(pos)) return s.getLoop() }, - 'mixin': function () { if (s.checkMixin(pos)) return s.getMixin() }, - 'namespace': function() { if (s.checkNamespace(pos)) return s.getNamespace() }, - 'nth': function() { if (s.checkNth(pos)) return s.getNth() }, - 'nthselector': function() { if (s.checkNthselector(pos)) return s.getNthselector() }, - 'number': function() { if (s.checkNumber(pos)) return s.getNumber() }, - 'operator': function() { if (s.checkOperator(pos)) return s.getOperator() }, - 'parentselector': function () { if (s.checkParentSelector(pos)) return s.getParentSelector() }, - 'percentage': function() { if (s.checkPercentage(pos)) return s.getPercentage() }, - 'placeholder': function() { if (s.checkPlaceholder(pos)) return s.getPlaceholder() }, - 'progid': function() { if (s.checkProgid(pos)) return s.getProgid() }, - 'property': function() { if (s.checkProperty(pos)) return s.getProperty() }, - 'propertyDelim': function() { if (s.checkPropertyDelim(pos)) return s.getPropertyDelim() }, - 'pseudoc': function() { if (s.checkPseudoc(pos)) return s.getPseudoc() }, - 'pseudoe': function() { if (s.checkPseudoe(pos)) return s.getPseudoe() }, - 'ruleset': function() { if (s.checkRuleset(pos)) return s.getRuleset() }, - 's': function() { if (s.checkS(pos)) return s.getS() }, - 'selector': function() { if (s.checkSelector(pos)) return s.getSelector() }, - 'shash': function() { if (s.checkShash(pos)) return s.getShash() }, - 'simpleselector': function() { if (s.checkSimpleSelector(pos)) return s.getSimpleSelector() }, - 'string': function() { if (s.checkString(pos)) return s.getString() }, - 'stylesheet': function() { if (s.checkStylesheet(pos)) return s.getStylesheet() }, - 'unary': function() { if (s.checkUnary(pos)) return s.getUnary() }, - 'unknown': function() { if (s.checkUnknown(pos)) return s.getUnknown() }, - 'uri': function() { if (s.checkUri(pos)) return s.getUri() }, - 'value': function() { if (s.checkValue(pos)) return s.getValue() }, - 'variable': function () { if (s.checkVariable(pos)) return s.getVariable() }, - 'variableslist': function () { if (s.checkVariablesList(pos)) return s.getVariablesList() }, - 'vhash': function() { if (s.checkVhash(pos)) return s.getVhash() } -}; -syntaxes.css = { - checkAny: function(i) { - return this.checkBraces(i) || - this.checkString(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkFunctionExpression(i) || - this.checkFunction(i) || - this.checkIdent(i) || - this.checkClass(i) || - this.checkUnary(i); - }, - getAny: function() { - if (this.checkBraces(pos)) return this.getBraces(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkFunctionExpression(pos)) return this.getFunctionExpression(); - else if (this.checkFunction(pos)) return this.getFunction(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - else if (this.checkUnary(pos)) return this.getUnary(); - }, - checkAtkeyword: function(i) { - var l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.CommercialAt) return 0; - return (l = this.checkIdent(i)) ? l + 1 : 0; - }, - getAtkeyword: function() { - var startPos = pos, - x; - pos++; - x = [NodeType.AtkeywordType, this.getIdent()]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAttrib: function(i) { - if (i >= tokensLength || - tokens[i].type !== TokenType.LeftSquareBracket || - !tokens[i].right) return 0; - return tokens[i].right - i + 1; - }, - getAttrib: function() { - if (this.checkAttrib1(pos)) return this.getAttrib1(); - if (this.checkAttrib2(pos)) return this.getAttrib2(); - }, - checkAttrib1: function(i) { - var start = i, - l; - if (i++ >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkAttrselector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i) || this.checkString(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; - }, - getAttrib1: function() { - var startPos = pos, - x; - pos++; - x = [NodeType.AttribType] - .concat(this.getSC()) - .concat([this.getIdent()]) - .concat(this.getSC()) - .concat([this.getAttrselector()]) - .concat(this.getSC()) - .concat([this.checkString(pos)? this.getString() : this.getIdent()]) - .concat(this.getSC()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAttrib2: function(i) { - var start = i, - l; - if (i++ >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; - }, - getAttrib2: function() { - var startPos = pos, - x; - pos++; - x = [NodeType.AttribType] - .concat(this.getSC()) - .concat([this.getIdent()]) - .concat(this.getSC()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAttrselector: function(i) { - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.EqualsSign) return 1; - if (tokens[i].type === TokenType.VerticalLine && - (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign)) - return 1; - if (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign) return 0; - switch(tokens[i].type) { - case TokenType.Tilde: - case TokenType.CircumflexAccent: - case TokenType.DollarSign: - case TokenType.Asterisk: - case TokenType.VerticalLine: - return 2; - } - return 0; - }, - getAttrselector: function() { - var startPos = pos, - s = tokens[pos++].value, - x; - if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) s += tokens[pos++].value; - x = [NodeType.AttrselectorType, s]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrule: function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l; - if (l = this.checkAtruler(i)) tokens[i].atrule_type = 1; - else if (l = this.checkAtruleb(i)) tokens[i].atrule_type = 2; - else if (l = this.checkAtrules(i)) tokens[i].atrule_type = 3; - else return 0; - tokens[i].atrule_l = l; - return l; - }, - getAtrule: function() { - switch (tokens[pos].atrule_type) { - case 1: return this.getAtruler(); - case 2: return this.getAtruleb(); - case 3: return this.getAtrules(); - } - }, - checkAtruleb: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (l = this.checkTsets(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - return i - start; - }, - getAtruleb: function() { - var startPos = pos, - x; - x = [NodeType.AtrulebType, this.getAtkeyword()] - .concat(this.getTsets()) - .concat([this.getBlock()]); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtruler: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (l = this.checkAtrulerq(i)) i += l; - if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++; - else return 0; - if (l = this.checkAtrulers(i)) i += l; - if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++; - else return 0; - return i - start; - }, - getAtruler: function() { - var startPos = pos, - x; - x = [NodeType.AtrulerType, this.getAtkeyword(), this.getAtrulerq()]; - pos++; - x.push(this.getAtrulers()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrulerq: function(i) { - return this.checkTsets(i); - }, - getAtrulerq: function() { - var startPos = pos, - x; - x = [NodeType.AtrulerqType].concat(this.getTsets()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrulers: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - while (l = this.checkRuleset(i) || this.checkAtrule(i) || this.checkSC(i)) { - i += l; - } - tokens[i].atrulers_end = 1; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getAtrulers: function() { - var startPos = pos, - x; - x = [NodeType.AtrulersType].concat(this.getSC()); - while (!tokens[pos].atrulers_end) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else x.push(this.getAtrule()); - } - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrules: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (l = this.checkTsets(i)) i += l; - return i - start; - }, - getAtrules: function() { - var startPos = pos, - x; - x = [NodeType.AtrulesType, this.getAtkeyword()].concat(this.getTsets()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkBlock: function(i) { - return i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket ? - tokens[i].right - i + 1 : 0; - }, - getBlock: function() { - var startPos = pos, - end = tokens[pos].right, - x = [NodeType.BlockType]; - pos++; - while (pos < end) { - if (this.checkBlockdecl(pos)) x = x.concat(this.getBlockdecl()); - else throwError(); - } - pos = end + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkBlockdecl: function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkBlockdecl1(i)) tokens[i].bd_type = 1; - else if (l = this.checkBlockdecl2(i)) tokens[i].bd_type = 2; - else if (l = this.checkBlockdecl3(i)) tokens[i].bd_type = 3; - else if (l = this.checkBlockdecl4(i)) tokens[i].bd_type = 4; - else return 0; - return l; - }, - getBlockdecl: function() { - switch (tokens[pos].bd_type) { - case 1: return this.getBlockdecl1(); - case 2: return this.getBlockdecl2(); - case 3: return this.getBlockdecl3(); - case 4: return this.getBlockdecl4(); - } - }, - checkBlockdecl1: function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkFilter(i)) tokens[i].bd_kind = 1; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 2; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 3; - else return 0; - i += l; - if (i < tokensLength && (l = this.checkDeclDelim(i))) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - return i - start; - }, - getBlockdecl1: function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getFilter(); - break; - case 2: - x = this.getDeclaration(); - break; - case 3: - x = this.getAtrule(); - break; - } - return sc - .concat([x]) - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }, - checkBlockdecl2: function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkFilter(i)) tokens[i].bd_kind = 1; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 2; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 3; - else return 0; - i += l; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getBlockdecl2: function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getFilter(); - break; - case 2: - x = this.getDeclaration(); - break; - case 3: - x = this.getAtrule(); - break; - } - return sc - .concat([x]) - .concat(this.getSC()); - }, - checkBlockdecl3: function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkDeclDelim(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getBlockdecl3: function() { - return this.getSC() - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }, - checkBlockdecl4: function(i) { - return this.checkSC(i); - }, - getBlockdecl4: function() { - return this.getSC(); - }, - checkBraces: function(i) { - if (i >= tokensLength || - (tokens[i].type !== TokenType.LeftParenthesis && - tokens[i].type !== TokenType.LeftSquareBracket)) return 0; - return tokens[i].right - i + 1; - }, - getBraces: function() { - var startPos = pos, - left = pos, - right = tokens[pos].right, - x; - pos++; - var tsets = this.getTsets(); - pos++; - x = [NodeType.BracesType, tokens[left].value, tokens[right].value] - .concat(tsets); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkClass: function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && (l = this.checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; - } - return 0; - }, - getClass: function() { - var startPos = pos, - x = [NodeType.ClassType]; - pos++; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkCombinator: function(i) { - if (i >= tokensLength) return 0; - switch (tokens[i].type) { - case TokenType.PlusSign: - case TokenType.GreaterThanSign: - case TokenType.Tilde: - return 1; - } - return 0; - }, - getCombinator: function() { - var startPos = pos, - x; - x = [NodeType.CombinatorType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkCommentML: function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0; - }, - getCommentML: function() { - var startPos = pos, - s = tokens[pos].value.substring(2), - l = s.length, - x; - if (s.charAt(l - 2) === '*' && s.charAt(l - 1) === '/') s = s.substring(0, l - 2); - pos++; - x = [NodeType.CommentMLType, s]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDeclaration: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkProperty(i)) i += l; - else return 0; - if (l = this.checkPropertyDelim(i)) i++; - else return 0; - if (l = this.checkValue(i)) i += l; - else return 0; - return i - start; - }, - getDeclaration: function() { - var startPos = pos, - x = [NodeType.DeclarationType]; - x.push(this.getProperty()); - x.push(this.getPropertyDelim()); - x.push(this.getValue()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDeclDelim: function(i) { - return i < tokensLength && tokens[i].type === TokenType.Semicolon ? 1 : 0; - }, - getDeclDelim: function() { - var startPos = pos, - x = [NodeType.DeclDelimType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDelim: function(i) { - return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0; - }, - getDelim: function() { - var startPos = pos, - x = [NodeType.DelimType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDimension: function(i) { - var ln = this.checkNumber(i), - li; - if (i >= tokensLength || - !ln || - i + ln >= tokensLength) return 0; - return (li = this.checkNmName2(i + ln)) ? ln + li : 0; - }, - getDimension: function() { - var startPos = pos, - x = [NodeType.DimensionType, this.getNumber()], - ident = [NodeType.IdentType, this.getNmName2()]; - if (needInfo) ident.unshift(getInfo(startPos)); - x.push(ident); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFilter: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkFilterp(i)) i += l; - else return 0; - if (tokens[i].type === TokenType.Colon) i++; - else return 0; - if (l = this.checkFilterv(i)) i += l; - else return 0; - return i - start; - }, - getFilter: function() { - var startPos = pos, - x = [NodeType.FilterType, this.getFilterp()]; - pos++; - x.push(this.getFilterv()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFilterp: function(i) { - var start = i, - l, - x; - if (i >= tokensLength) return 0; - if (tokens[i].value === 'filter') l = 1; - else { - x = joinValues2(i, 2); - if (x === '-filter' || x === '_filter' || x === '*filter') l = 2; - else { - x = joinValues2(i, 4); - if (x === '-ms-filter') l = 4; - else return 0; - } - } - tokens[start].filterp_l = l; - i += l; - if (this.checkSC(i)) i += l; - return i - start; - }, - getFilterp: function() { - var startPos = pos, - ident = [NodeType.IdentType, joinValues2(pos, tokens[pos].filterp_l)], - x; - if (needInfo) ident.unshift(getInfo(startPos)); - pos += tokens[pos].filterp_l; - x = [NodeType.PropertyType, ident].concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFilterv: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkProgid(i)) i += l; - else return 0; - while (l = this.checkProgid(i)) { - i += l; - } - tokens[start].last_progid = i; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }, - getFilterv: function() { - var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - x = x.concat(this.getSC()); - while (pos < last_progid) { - x.push(this.getProgid()); - } - if (this.checkSC(pos)) x = x.concat(this.getSC()); - if (pos < tokensLength && this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFunctionExpression: function(i) { - var start = i; - if (i >= tokensLength || tokens[i++].value !== 'expression' || - i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0; - return tokens[i].right - start + 1; - }, - getFunctionExpression: function() { - var startPos = pos, - x, e; - pos++; - e = joinValues(pos + 1, tokens[pos].right - 1); - pos = tokens[pos].right + 1; - x = [NodeType.FunctionExpressionType, e]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFunction: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkIdent(i)) i +=l; - else return 0; - return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? - tokens[i].right - start + 1 : 0; - }, - getFunction: function() { - var startPos = pos, - ident = this.getIdent(), - x = [NodeType.FunctionType, ident], - body; - pos++; - body = ident[needInfo ? 2 : 1] === 'not' ? this.getNotFunctionBody() : this.getFunctionBody(); - x.push(body); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - getFunctionBody: function() { - var startPos = pos, - x = [NodeType.FunctionBodyType], - body; - while (tokens[pos].type !== TokenType.RightParenthesis) { - if (this.checkDeclaration(pos)) x.push(this.getDeclaration()); - else if (this.checkTset(pos)) { - body = this.getTset(); - if ((needInfo && typeof body[1] === 'string') || typeof body[0] === 'string') x.push(body); - else x = x.concat(body); - } else if (this.checkClass(pos)) x.push(this.getClass()); - else throwError(); - } - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - getNotFunctionBody: function() { - var startPos = pos, - x = [NodeType.FunctionBodyType]; - while (tokens[pos].type !== TokenType.RightParenthesis) { - if (this.checkSimpleSelector(pos)) x.push(this.getSimpleSelector()); - else throwError(); - } - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkIdent: function(i) { - var start = i, - wasIdent, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.LowLine) return this.checkIdentLowLine(i); - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DollarSign || - tokens[i].type === TokenType.Asterisk) i++; - else return 0; - wasIdent = tokens[i - 1].type === TokenType.Identifier; - for (; i < tokensLength; i++) { - if (i >= tokensLength) break; - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine) { - if (tokens[i].type !== TokenType.Identifier && - (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; - else wasIdent = true; - } - } - if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; - tokens[start].ident_last = i - 1; - return i - start; - }, - checkIdentLowLine: function(i) { - var start = i; - if (i++ >= tokensLength) return 0; - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.DecimalNumber && - tokens[i].type !== TokenType.LowLine && - tokens[i].type !== TokenType.Identifier) break; - } - tokens[start].ident_last = i - 1; - return i - start; - }, - getIdent: function() { - var startPos = pos, - x = [NodeType.IdentType, joinValues(pos, tokens[pos].ident_last)]; - pos = tokens[pos].ident_last + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkImportant: function(i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.ExclamationMark) return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].value === 'important' ? i - start + 1 : 0; - }, - getImportant: function() { - var startPos = pos, - x = [NodeType.ImportantType]; - pos++; - x = x.concat(this.getSC()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNamespace: function(i) { - return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0; - }, - getNamespace: function() { - var startPos = pos, - x = [NodeType.NamespaceType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNmName: function(i) { - var start = i; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.LowLine || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DecimalNumber) i++; - else return 0; - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine && - tokens[i].type !== TokenType.Identifier && - tokens[i].type !== TokenType.DecimalNumber) break; - } - tokens[start].nm_name_last = i - 1; - return i - start; - }, - getNmName: function() { - var s = joinValues(pos, tokens[pos].nm_name_last); - pos = tokens[pos].nm_name_last + 1; - return s; - }, - checkNmName2: function(i) { - if (tokens[i].type === TokenType.Identifier) return 1; - else if (tokens[i].type !== TokenType.DecimalNumber) return 0; - i++; - return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1; - }, - getNmName2: function() { - var s = tokens[pos].value; - if (tokens[pos++].type === TokenType.DecimalNumber && - pos < tokensLength && - tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value; - return s; - }, - checkNth: function(i) { - if (i >= tokensLength) return 0; - return this.checkNth1(i) || this.checkNth2(i); - }, - checkNth1: function(i) { - var start = i; - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.DecimalNumber && - tokens[i].value !== 'n') break; - } - if (i !== start) tokens[start].nth_last = i - 1; - return i - start; - }, - getNth: function() { - var startPos = pos, - x = [NodeType.NthType]; - if (tokens[pos].nth_last) { - x.push(joinValues(pos, tokens[pos].nth_last)); - pos = tokens[pos].nth_last + 1; - } else { - x.push(tokens[pos++].value); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNth2: function(i) { - return tokens[i].value === 'even' || tokens[i].value === 'odd' ? 1 : 0; - }, - checkNthf: function(i) { - var start = i, - l = 0; - if (tokens[i++].type !== TokenType.Colon) return 0; - l++; - if (tokens[i++].value !== 'nth' || tokens[i++].value !== '-') return 0; - l += 2; - if ('child' === tokens[i].value) { - l += 1; - } else if ('last-child' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value) { - l += 3; - } else if ('of-type' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value) { - l += 3; - } else if ('last-of-type' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value + - tokens[i + 3].value + - tokens[i + 4].value) { - l += 5; - } else return 0; - tokens[start + 1].nthf_last = start + l - 1; - return l; - }, - getNthf: function() { - pos++; - var s = joinValues(pos, tokens[pos].nthf_last); - pos = tokens[pos].nthf_last + 1; - return s; - }, - checkNthselector: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkNthf(i)) i += l; - else return 0; - if (tokens[i].type !== TokenType.LeftParenthesis || !tokens[i].right) return 0; - l++; - var rp = tokens[i++].right; - while (i < rp) { - if (l = this.checkSC(i) || - this.checkUnary(i) || - this.checkNth(i)) i += l; - else return 0; - } - return rp - start + 1; - }, - getNthselector: function() { - var startPos = pos, - nthf = [NodeType.IdentType, this.getNthf()], - x = [NodeType.NthselectorType]; - if (needInfo) nthf.unshift(getInfo(startPos)); - x.push(nthf); - pos++; - while (tokens[pos].type !== TokenType.RightParenthesis) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkUnary(pos)) x.push(this.getUnary()); - else if (this.checkNth(pos)) x.push(this.getNth()); - } - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNumber: function(i) { - if (i >= tokensLength) return 0; - if (tokens[i].number_l) return tokens[i].number_l; - if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && - (!tokens[i + 1] || - (tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop))) - return (tokens[i].number_l = 1, tokens[i].number_l); - if (i < tokensLength && - tokens[i].type === TokenType.DecimalNumber && - tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && - (!tokens[i + 2] || (tokens[i + 2].type !== TokenType.DecimalNumber))) - return (tokens[i].number_l = 2, tokens[i].number_l); - if (i < tokensLength && - tokens[i].type === TokenType.FullStop && - tokens[i + 1].type === TokenType.DecimalNumber) - return (tokens[i].number_l = 2, tokens[i].number_l); - if (i < tokensLength && - tokens[i].type === TokenType.DecimalNumber && - tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && - tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) - return (tokens[i].number_l = 3, tokens[i].number_l); - return 0; - }, - getNumber: function() { - var s = '', - startPos = pos, - l = tokens[pos].number_l, - x = [NodeType.NumberType]; - for (var j = 0; j < l; j++) { - s += tokens[pos + j].value; - } - pos += l; - x.push(s); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkOperator: function(i) { - if (i >= tokensLength) return 0; - switch(tokens[i].type) { - case TokenType.Solidus: - case TokenType.Comma: - case TokenType.Colon: - case TokenType.EqualsSign: - return 1; - } - return 0; - }, - getOperator: function() { - var startPos = pos, - x = [NodeType.OperatorType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPercentage: function(i) { - var x; - if (i >= tokensLength) return 0; - x = this.checkNumber(i); - if (!x || i + x >= tokensLength) return 0; - return tokens[i + x].type === TokenType.PercentSign ? x + 1 : 0; - }, - getPercentage: function() { - var startPos = pos, - x = [NodeType.PercentageType, this.getNumber()]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkProgid: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6; - else return 0; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (tokens[i].type === TokenType.LeftParenthesis) { - tokens[start].progid_end = tokens[i].right; - i = tokens[i].right + 1; - } else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getProgid: function() { - var startPos = pos, - progid_end = tokens[pos].progid_end, - x; - x = [NodeType.ProgidType] - .concat(this.getSC()) - .concat([this._getProgid(progid_end)]) - .concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - _getProgid: function(progid_end) { - var startPos = pos, - x = [NodeType.RawType, joinValues(pos, progid_end)]; - pos = progid_end + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkProperty: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getProperty: function() { - var startPos = pos, - x = [NodeType.PropertyType]; - x.push(this.getIdent()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPropertyDelim: function(i) { - return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0; - }, - getPropertyDelim: function() { - var startPos = pos, - x = [NodeType.PropertyDelimType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPseudo: function(i) { - return this.checkPseudoe(i) || - this.checkPseudoc(i); - }, - getPseudo: function() { - if (this.checkPseudoe(pos)) return this.getPseudoe(); - if (this.checkPseudoc(pos)) return this.getPseudoc(); - }, - checkPseudoe: function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || - i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkIdent(i)) ? l + 2 : 0; - }, - getPseudoe: function() { - var startPos = pos, - x = [NodeType.PseudoeType]; - pos += 2; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPseudoc: function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkFunction(i) || this.checkIdent(i)) ? l + 1 : 0; - }, - getPseudoc: function() { - var startPos = pos, - x = [NodeType.PseudocType]; - pos ++; - x.push(this.checkFunction(pos) ? this.getFunction() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkRuleset: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[start].ruleset_l) return tokens[start].ruleset_l; - while (i < tokensLength) { - if (l = this.checkBlock(i)) {i += l; break;} - else if (l = this.checkSelector(i)) i += l; - else return 0; - } - tokens[start].ruleset_l = i - start; - return i - start; - }, - getRuleset: function() { - var startPos = pos, - x = [NodeType.RulesetType]; - while (pos < tokensLength) { - if (this.checkBlock(pos)) {x.push(this.getBlock()); break;} - else if (this.checkSelector(pos)) x.push(this.getSelector()); - else break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkS: function(i) { - return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0; - }, - getS: function() { - var startPos = pos, - x = [NodeType.SType, joinValues(pos, tokens[pos].ws_last)]; - pos = tokens[pos].ws_last + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkSC: function(i) { - var l, - lsc = 0; - while (i < tokensLength) { - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }, - getSC: function() { - var sc = []; - if (pos >= tokensLength) return sc; - while (pos < tokensLength) { - if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else break; - } - return sc; - }, - checkSelector: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector(i) || this.checkDelim(i)) i += l; - else break; - } - if (i !== start) tokens[start].selector_end = i - 1; - return i - start; - }, - getSelector: function() { - var startPos = pos, - x = [NodeType.SelectorType], - selector_end = tokens[pos].selector_end; - while (pos <= selector_end) { - x.push(this.checkDelim(pos) ? this.getDelim() : this.getSimpleSelector()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkShash: function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; - return (l = this.checkNmName(i + 1)) ? l + 1 : 0; - }, - getShash: function() { - var startPos = pos, - x = [NodeType.ShashType]; - pos++; - x.push(this.getNmName()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkSimpleSelector: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector1(i)) i += l; - else break; - } - return i - start; - }, - getSimpleSelector: function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t; - while (pos < tokensLength) { - if (!this.checkSimpleSelector1(pos)) break; - t = this.getSimpleSelector1(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkSimpleSelector1: function(i) { - return this.checkNthselector(i) || - this.checkCombinator(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkNamespace(i); - }, - getSimpleSelector1: function() { - if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkCombinator(pos)) return this.getCombinator(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkNamespace(pos)) return this.getNamespace(); - }, - checkString: function(i) { - return i < tokensLength && (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) ? 1 : 0; - }, - getString: function() { - var startPos = pos, - x = [NodeType.StringType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkStylesheet: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSC(i) || - this.checkDeclDelim(i) || - this.checkAtrule(i) || - this.checkRuleset(i) || - this.checkUnknown(i)) i += l; - else throwError(i); - } - return i - start; - }, - getStylesheet: function() { - var startPos = pos, - x = [NodeType.StylesheetType]; - while (pos < tokensLength) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else if (this.checkAtrule(pos)) x.push(this.getAtrule()); - else if (this.checkDeclDelim(pos)) x.push(this.getDeclDelim()); - else if (this.checkUnknown(pos)) x.push(this.getUnknown()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkTset: function(i) { - return this.checkVhash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkOperator(i); - }, - getTset: function() { - if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkOperator(pos)) return this.getOperator(); - }, - checkTsets: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - while (l = this.checkTset(i)) { - i += l; - } - return i - start; - }, - getTsets: function() { - var x = [], - t; - while (t = this.getTset()) { - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return x; - }, - checkUnary: function(i) { - return i < tokensLength && (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) ? 1 : 0; - }, - getUnary: function() { - var startPos = pos, - x = [NodeType.UnaryType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkUnknown: function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0; - }, - getUnknown: function() { - var startPos = pos, - x = [NodeType.UnknownType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkUri: function(i) { - var start = i; - if (i >= tokensLength || tokens[i++].value !== 'url' || - i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) - return 0; - return tokens[i].right - start + 1; - }, - getUri: function() { - var startPos = pos, - uriExcluding = {}, - uri, - l, - raw; - pos += 2; - uriExcluding[TokenType.Space] = 1; - uriExcluding[TokenType.Tab] = 1; - uriExcluding[TokenType.Newline] = 1; - uriExcluding[TokenType.LeftParenthesis] = 1; - uriExcluding[TokenType.RightParenthesis] = 1; - if (this.checkUri1(pos)) { - uri = [NodeType.UriType] - .concat(this.getSC()) - .concat([this.getString()]) - .concat(this.getSC()); - pos++; - } else { - uri = [NodeType.UriType].concat(this.getSC()), - l = checkExcluding(uriExcluding, pos), - raw = [NodeType.RawType, joinValues(pos, pos + l)]; - if (needInfo) raw.unshift(getInfo(startPos)); - uri.push(raw); - pos += l + 1; - uri = uri.concat(this.getSC()); - pos++; - } - return needInfo ? (uri.unshift(getInfo(startPos)), uri) : uri; - }, - checkUri1: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (tokens[i].type !== TokenType.StringDQ && tokens[i].type !== TokenType.StringSQ) return 0; - i++; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - checkValue: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this._checkValue(i)) i += l; - else break; - } - return i - start; - }, - _checkValue: function(i) { - return this.checkSC(i) || - this.checkVhash(i) || - this.checkAny(i) || - this.checkOperator(i) || - this.checkImportant(i); - }, - getValue: function() { - var startPos = pos, - x = [NodeType.ValueType], - t, - _pos; - while (pos < tokensLength) { - _pos = pos; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - _getValue: function() { - if (this.checkSC(pos)) return this.getSC(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - }, - checkVhash: function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; - return (l = this.checkNmName2(i + 1)) ? l + 1 : 0; - }, - getVhash: function() { - var startPos = pos, - x = [NodeType.VhashType]; - pos++; - x.push(this.getNmName2()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - markSC: function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.CommentML: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }, - markBrackets: function() { - var ps = [], - sbs = [], - cbs = [], - t; - for (var i = 0; i < tokens.length; i++) { - t = tokens[i]; - switch(t.type) { - case TokenType.LeftParenthesis: - ps.push(i); - break; - case TokenType.RightParenthesis: - if (ps.length) { - t.left = ps.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftSquareBracket: - sbs.push(i); - break; - case TokenType.RightSquareBracket: - if (sbs.length) { - t.left = sbs.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftCurlyBracket: - cbs.push(i); - break; - case TokenType.RightCurlyBracket: - if (cbs.length) { - t.left = cbs.pop(); - tokens[t.left].right = i; - } - break; - } - } - }, - parseMLComment: function(css) { - var start = pos; - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') { - pos++; - break; - } - } - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); - }, - parseSLComment: function(css) { - var start = pos; - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { - break; - } - } - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; - } -}; -(function() { - var scss = Object.create(syntaxes.css); - scss.checkAny = function(i) { - return this.checkBraces(i) || - this.checkString(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkPlaceholder(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkFunctionExpression(i) || - this.checkFunction(i) || - this.checkIdent(i) || - this.checkClass(i) || - this.checkUnary(i); - }; - scss.getAny = function() { - if (this.checkBraces(pos)) return this.getBraces(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkPlaceholder(pos)) return this.getPlaceholder(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkFunctionExpression(pos)) return this.getFunctionExpression(); - else if (this.checkFunction(pos)) return this.getFunction(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - else if (this.checkUnary(pos)) return this.getUnary(); - }; - scss.checkArguments = function (i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i].type !== TokenType.LeftParenthesis) return 0; - i++; - while (i < tokens[start].right) { - if (l = this.checkArgument(i)) i +=l; - else return 0; - } - return tokens[start].right - start + 1; - }; - scss.getArguments = function() { - var startPos = pos, - arguments = [], - x; - pos++; - while (x = this.getArgument()) { - if ((needInfo && typeof x[1] === 'string') || typeof x[0] === 'string') arguments.push(x); - else arguments = arguments.concat(x); - } - pos++; - x = [NodeType.ArgumentsType].concat(arguments); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkArgument = function(i) { - return this.checkDeclaration(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkSC(i) || - this.checkDelim(i) || - this.checkDeclDelim(i) || - this.checkString(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkIdent(i) || - this.checkVhash(i); - }; - scss.getArgument = function() { - if (this.checkDeclaration(pos)) return this.getDeclaration(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkDelim(pos)) return this.getDelim(); - else if (this.checkDeclDelim(pos)) return this.getDeclDelim(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkVhash(pos)) return this.getVhash(); - }; - scss.checkBlockdecl1 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkLoop(i)) tokens[i].bd_kind = 3; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 4; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 5; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 6; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 7; - else return 0; - i += l; - if (i < tokensLength && (l = this.checkDeclDelim(i))) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - return i - start; - }; - scss.getBlockdecl1 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getLoop(); - break; - case 4: - x = this.getFilter(); - break; - case 5: - x = this.getDeclaration(); - break; - case 6: - x = this.getAtrule(); - break; - case 7: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }; - scss.checkBlockdecl2 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkLoop(i)) tokens[i].bd_kind = 3; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 4; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 5; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 6; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 7; - else return 0; - i += l; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getBlockdecl2 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getLoop(); - break; - case 4: - x = this.getFilter(); - break; - case 5: - x = this.getDeclaration(); - break; - case 6: - x = this.getAtrule(); - break; - case 7: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat(this.getSC()); - }; - scss.checkClass = function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && - (l = this.checkInterpolatedVariable(i) || this.checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; - } - return 0; - }; - scss.getClass = function() { - var startPos = pos, - x = [NodeType.ClassType]; - pos++; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkCommentSL = function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0; - }; - scss.getCommentSL = function() { - var startPos = pos, - x; - x = [NodeType.CommentSLType, tokens[pos++].value.substring(2)]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkCondition = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['if', 'else'].indexOf(tokens[start + 1].value) < 0) return 0; - while (i < tokensLength) { - if (l = this.checkBlock(i)) break; - else if (l = this.checkVariable(i) || - this.checkIdent(i) || - this.checkSC(i) || - this.checkNumber(i) || - this.checkOperator(i) || - this.checkCombinator(i) || - this.checkString(i)) i += l; - else return 0; - } - return i - start; - }; - scss.getCondition = function() { - var startPos = pos, - x = [NodeType.ConditionType]; - x.push(this.getAtkeyword()); - while (pos < tokensLength) { - if (this.checkBlock(pos)) break; - else if (this.checkVariable(pos)) x.push(this.getVariable()); - else if (this.checkIdent(pos)) x.push(this.getIdent()); - else if (this.checkNumber(pos)) x.push(this.getNumber()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else if (this.checkCombinator(pos)) x.push(this.getCombinator()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkString(pos)) x.push(this.getString()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkDefault = function(i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.ExclamationMark) return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].value === 'default' ? i - start + 1 : 0; - }; - scss.getDefault = function() { - var startPos = pos, - x = [NodeType.DefaultType], - sc; - pos++; - sc = this.getSC(); - pos++; - x = x.concat(sc); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkIdent = function(i) { - var start = i, - wasIdent, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.LowLine) return this.checkIdentLowLine(i); - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DollarSign || - tokens[i].type === TokenType.Asterisk) i++; - else return 0; - wasIdent = tokens[i - 1].type === TokenType.Identifier; - for (; i < tokensLength; i++) { - if (l = this.checkInterpolatedVariable(i)) i += l; - if (i >= tokensLength) break; - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine) { - if (tokens[i].type !== TokenType.Identifier && - (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; - else wasIdent = true; - } - } - if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; - tokens[start].ident_last = i - 1; - return i - start; - }; - scss.checkInclude = function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkInclude1(i)) tokens[i].include_type = 1; - else if (l = this.checkInclude2(i)) tokens[i].include_type = 2; - else if (l = this.checkInclude3(i)) tokens[i].include_type = 3; - else if (l = this.checkInclude4(i)) tokens[i].include_type = 4; - return l; - }; - scss.getInclude = function() { - switch (tokens[pos].include_type) { - case 1: return this.getInclude1(); - case 2: return this.getInclude2(); - case 3: return this.getInclude3(); - case 4: return this.getInclude4(); - } - }; - scss.checkInclude1 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude1 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInclude2 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude2 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInclude3 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude3 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInclude4 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude4 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkIncludeSelector = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector2(i)) i += l; - else break; - } - return i - start; - }; - scss.getIncludeSelector = function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t; - while (pos < tokensLength && this.checkSimpleSelector2(pos)) { - t = this.getSimpleSelector2(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInterpolatedVariable = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type !== TokenType.NumberSign || - !tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket || - !tokens[i + 2] || tokens[i + 2].type !== TokenType.DollarSign) return 0; - i += 3; - if (l = this.checkIdent(i)) i += l; - else return 0; - return tokens[i].type === TokenType.RightCurlyBracket ? i - start + 1 : 0; - }; - scss.getInterpolatedVariable = function() { - var startPos = pos, - x = [NodeType.InterpolatedVariableType]; - pos += 3; - x.push(this.getIdent()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkLoop = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['for', 'each', 'while'].indexOf(tokens[start + 1].value) < 0) return 0; - while (i < tokensLength) { - if (l = this.checkBlock(i)) { - i += l; - break; - } else if (l = this.checkVariable(i) || - this.checkIdent(i) || - this.checkSC(i) || - this.checkNumber(i) || - this.checkOperator(i) || - this.checkCombinator(i) || - this.checkString(i)) i += l; - else return 0; - } - return i - start; - }; - scss.getLoop = function() { - var startPos = pos, - x = [NodeType.LoopType]; - x.push(this.getAtkeyword()); - while (pos < tokensLength) { - if (this.checkBlock(pos)) { - x.push(this.getBlock()); - break; - } - else if (this.checkVariable(pos)) x.push(this.getVariable()); - else if (this.checkIdent(pos)) x.push(this.getIdent()); - else if (this.checkNumber(pos)) x.push(this.getNumber()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else if (this.checkCombinator(pos)) x.push(this.getCombinator()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkString(pos)) x.push(this.getString()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkMixin = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if ((l = this.checkAtkeyword(i)) && tokens[i + 1].value === 'mixin') i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - return i - start; - }; - scss.getMixin = function() { - var startPos = pos, - x = [NodeType.MixinType, this.getAtkeyword()]; - x = x.concat(this.getSC()); - if (this.checkIdent(pos)) x.push(this.getIdent()); - x = x.concat(this.getSC()); - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkOperator = function(i) { - if (i >= tokensLength) return 0; - switch(tokens[i].type) { - case TokenType.Solidus: - case TokenType.Comma: - case TokenType.Colon: - case TokenType.EqualsSign: - case TokenType.LessThanSign: - case TokenType.GreaterThanSign: - case TokenType.Asterisk: - return 1; - } - return 0; - }; - scss.checkParentSelector = function(i) { - return i < tokensLength && tokens[i].type === TokenType.Ampersand ? 1 : 0; - }; - scss.getParentSelector = function() { - var startPos = pos, - x = [NodeType.ParentSelectorType, '&']; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkPlaceholder = function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].placeholder_l) return tokens[i].placeholder_l; - if (tokens[i].type === TokenType.PercentSign && (l = this.checkIdent(i + 1))) { - tokens[i].placeholder_l = l + 1; - return l + 1; - } else return 0; - }; - scss.getPlaceholder = function() { - var startPos = pos, - x = [NodeType.PlaceholderType]; - pos++; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkProperty = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i) || this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getProperty = function() { - var startPos = pos, - x = [NodeType.PropertyType]; - x.push(this.checkVariable(pos) ? this.getVariable() : this.getIdent()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkPseudoe = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || - i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkIdent(i)) ? l + 2 : 0; - }; - scss.getPseudoe = function() { - var startPos = pos, - x = [NodeType.PseudoeType]; - pos += 2; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkPseudoc = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkFunction(i) || this.checkIdent(i)) ? l + 1 : 0; - }; - scss.getPseudoc = function() { - var startPos = pos, - x = [NodeType.PseudocType]; - pos ++; - if (this.checkInterpolatedVariable(pos)) x.push(this.getInterpolatedVariable()); - else if (this.checkFunction(pos)) x.push(this.getFunction()); - else x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkSC = function(i) { - if (i >= tokensLength) return 0; - var l, - lsc = 0, - ln = tokens[i].ln; - while (i < tokensLength) { - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i)) && - !(l = this.checkCommentSL(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }; - scss.getSC = function() { - var sc = []; - if (pos >= tokensLength) return sc; - while (pos < tokensLength) { - if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else if (this.checkCommentSL(pos)) sc.push(this.getCommentSL()); - else break; - } - return sc; - }; - scss.checkSimpleSelector1 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkCombinator(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkNamespace(i); - }; - scss.getSimpleSelector1 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkCombinator(pos)) return this.getCombinator(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkNamespace(pos)) return this.getNamespace(); - }; - scss.checkSimpleSelector2 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkPlaceholder(i) || - this.checkIdent(i) || - this.checkClass(i); - }; - scss.getSimpleSelector2 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkPlaceholder(pos)) return this.getPlaceholder(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - }; - scss.checkStylesheet = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSC(i) || - this.checkDeclaration(i) || - this.checkDeclDelim(i) || - this.checkInclude(i) || - this.checkMixin(i) || - this.checkLoop(i) || - this.checkAtrule(i) || - this.checkRuleset(i)) i += l; - else throwError(i); - } - return i - start; - }; - scss.getStylesheet = function() { - var startPos = pos, - x = [NodeType.StylesheetType]; - while (pos < tokensLength) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else if (this.checkInclude(pos)) x.push(this.getInclude()); - else if (this.checkMixin(pos)) x.push(this.getMixin()); - else if (this.checkLoop(pos)) x.push(this.getLoop()); - else if (this.checkAtrule(pos)) x.push(this.getAtrule()); - else if (this.checkDeclaration(pos)) x.push(this.getDeclaration()); - else if (this.checkDeclDelim(pos)) x.push(this.getDeclDelim()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkValue = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this._checkValue(i)) i += l; - if (!l || this.checkBlock(i - l)) break; - } - return i - start; - }; - scss._checkValue = function(i) { - return this.checkSC(i) || - this.checkInterpolatedVariable(i) || - this.checkVariable(i) || - this.checkVhash(i) || - this.checkBlock(i) || - this.checkAny(i) || - this.checkAtkeyword(i) || - this.checkOperator(i) || - this.checkImportant(i) || - this.checkDefault(i); - }; - scss.getValue = function() { - var startPos = pos, - x = [NodeType.ValueType], - t, _pos; - while (pos < tokensLength) { - _pos = pos; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - if (this.checkBlock(_pos)) break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss._getValue = function() { - if (this.checkSC(pos)) return this.getSC(); - else if (this.checkInterpolatedVariable(pos)) return this.getInterpolatedVariable(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkBlock(pos)) return this.getBlock(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkAtkeyword(pos)) return this.getAtkeyword(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - else if (this.checkDefault(pos)) return this.getDefault(); - }; - scss.checkVariable = function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.DollarSign) return 0; - return (l = this.checkIdent(i + 1)) ? l + 1 : 0; - }; - scss.getVariable = function() { - var startPos = pos, - x = [NodeType.VariableType]; - pos++; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkVariablesList = function(i) { - var d = 0, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i)) i+= l; - else return 0; - while (i < tokensLength && tokens[i].type === TokenType.FullStop) { - d++; - i++; - } - return d === 3 ? l + d : 0; - }; - scss.getVariablesList = function() { - var startPos = pos, - x = [NodeType.VariablesListType, this.getVariable()]; - pos += 3; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.markSC = function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.CommentML: - case TokenType.CommentSL: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }; - syntaxes.scss = scss; -})(); -(function() { - var sass = Object.create(syntaxes.scss); - sass.checkBlock = function(i) { - return i < tokensLength && tokens[i].block_end ? - tokens[i].block_end - i + 1 : 0; - }; - sass.getBlock = function() { - var startPos = pos, - end = tokens[pos].block_end, - x = [NodeType.BlockType]; - while (pos < end) { - if (this.checkBlockdecl(pos)) x = x.concat(this.getBlockdecl()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.getCommentML = function() { - var startPos = pos, - s = tokens[pos].value.substring(2), - l = s.length, - x; - pos++; - x = [NodeType.CommentMLType, s]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkDeclaration = function(i) { - return this.checkDeclaration1(i) || this.checkDeclaration2(i); - }; - sass.getDeclaration = function() { - return this.checkDeclaration1(pos) ? this.getDeclaration1() : this.getDeclaration2(); - }; - sass.checkDeclaration1 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkProperty(i)) i += l; - else return 0; - if (l = this.checkPropertyDelim(i)) i++; - else return 0; - if (l = this.checkValue(i)) i += l; - else return 0; - return i - start; - }; - sass.getDeclaration1 = function() { - var startPos = pos, - x = [NodeType.DeclarationType]; - x.push(this.getProperty()); - x.push(this.getPropertyDelim()); - x.push(this.getValue()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkDeclaration2 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkPropertyDelim(i)) i++; - else return 0; - if (l = this.checkProperty(i)) i += l; - else return 0; - if (l = this.checkValue(i)) i += l; - else return 0; - return i - start; - }; - sass.getDeclaration2 = function() { - var startPos = pos, - x = [NodeType.DeclarationType]; - x.push(this.getPropertyDelim()); - x.push(this.getProperty()); - x.push(this.getValue()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkDeclDelim = function(i) { - if (i >= tokensLength) return 0; - return (tokens[i].type === TokenType.Newline || - tokens[i].type === TokenType.Semicolon) ? 1 : 0; - }; - sass.checkFilterv = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkProgid(i)) i += l; - else return 0; - while (l = this.checkProgid(i)) { - i += l; - } - tokens[start].last_progid = i; - if (this.checkDeclDelim(i)) return i - start; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }; - sass.getFilterv = function() { - var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - while (pos < last_progid) { - x.push(this.getProgid()); - } - if (this.checkDeclDelim(pos)) return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - if (this.checkSC(pos)) x = x.concat(this.getSC()); - if (pos < tokensLength && this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude = function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkInclude1(i)) tokens[i].include_type = 1; - else if (l = this.checkInclude2(i)) tokens[i].include_type = 2; - else if (l = this.checkInclude3(i)) tokens[i].include_type = 3; - else if (l = this.checkInclude4(i)) tokens[i].include_type = 4; - else if (l = this.checkInclude5(i)) tokens[i].include_type = 5; - else if (l = this.checkInclude6(i)) tokens[i].include_type = 6; - else if (l = this.checkInclude7(i)) tokens[i].include_type = 7; - else if (l = this.checkInclude8(i)) tokens[i].include_type = 8; - return l; - }; - sass.getInclude = function() { - switch (tokens[pos].include_type) { - case 1: return this.getInclude1(); - case 2: return this.getInclude2(); - case 3: return this.getInclude3(); - case 4: return this.getInclude4(); - case 5: return this.getInclude5(); - case 6: return this.getInclude6(); - case 7: return this.getInclude7(); - case 8: return this.getInclude8(); - } - }; - sass.checkInclude5 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude5 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude6 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude6 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude7 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude7 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude8 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude8 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkMixin = function(i) { - return this.checkMixin1(i) || this.checkMixin2(i); - }; - sass.getMixin = function() { - return this.checkMixin1(pos) ? this.getMixin1() : this.getMixin2(); - }; - sass.checkMixin1 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if ((l = this.checkAtkeyword(i)) && tokens[i + 1].value === 'mixin') i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else { - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - } - return i - start; - }; - sass.getMixin1 = function() { - var startPos = pos, - x = [NodeType.MixinType, this.getAtkeyword()]; - x = x.concat(this.getSC()); - if (this.checkIdent(pos)) x.push(this.getIdent()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - else { - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkMixin2 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.EqualsSign) i++; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else { - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - } - return i - start; - }; - sass.getMixin2 = function() { - var startPos = pos, - x = [NodeType.MixinType, this.getOperator()]; - x = x.concat(this.getSC()); - if (this.checkIdent(pos)) x.push(this.getIdent()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - else { - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkProgid = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6; - else return 0; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (tokens[i].type === TokenType.LeftParenthesis) { - tokens[start].progid_end = tokens[i].right; - i = tokens[i].right + 1; - } else return 0; - return i - start; - }; - sass.getProgid = function() { - var startPos = pos, - progid_end = tokens[pos].progid_end, - x; - x = [NodeType.ProgidType] - .concat(this.getSC()) - .concat([this._getProgid(progid_end)]); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkSC = function(i) { - if (!tokens[i]) return 0; - var l, - lsc = 0, - ln = tokens[i].ln; - while (i < tokensLength) { - if (tokens[i].ln !== ln) break; - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i)) && - !(l = this.checkCommentSL(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }; - sass.getSC = function() { - var sc = [], - ln; - if (pos >= tokensLength) return sc; - ln = tokens[pos].ln; - while (pos < tokensLength) { - if (tokens[pos].ln !== ln) break; - else if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else if (this.checkCommentSL(pos)) sc.push(this.getCommentSL()); - else break; - } - return sc; - }; - sass.checkSelector = function(i) { - var start = i, - l, ln; - if (i >= tokensLength) return 0; - ln = tokens[i].ln; - while (i < tokensLength) { - if (tokens[i].ln !== ln) break; - if ((l = this.checkDeclDelim(i) && this.checkBlock(i + l)) || this.checkSC(i)) i += l; - if (l = this.checkSimpleSelector(i) || this.checkDelim(i)) i += l; - else break; - } - tokens[start].selector_end = i - 1; - return i - start; - }; - sass.getSelector = function() { - var startPos = pos, - x = [NodeType.SelectorType], - selector_end = tokens[pos].selector_end, - ln = tokens[pos].ln; - while (pos <= selector_end) { - if (tokens[pos].ln !== ln) break; - if ((l = this.checkDeclDelim(pos)) && this.checkBlock(pos + l)) x.push(this.getDeclDelim()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - x.push(this.checkDelim(pos) ? this.getDelim() : this.getSimpleSelector()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkSimpleSelector = function(i) { - if (i >= tokensLength) return 0; - var start = i, - l, - ln = tokens[i].ln; - while (i < tokensLength) { - if (tokens[i].ln !== ln) break; - if (l = this.checkSimpleSelector1(i)) i += l; - else break; - } - return (i - start) || 0; - }; - sass.getSimpleSelector = function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t, - ln = tokens[pos].ln; - while (pos < tokensLength) { - if (tokens[pos].ln !== ln || - !this.checkSimpleSelector1(pos)) break; - t = this.getSimpleSelector1(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkValue = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (this.checkDeclDelim(i)) break; - if (l = this._checkValue(i)) i += l; - if (!l || this.checkBlock(i - l)) break; - } - return i - start; - }; - sass.getValue = function() { - var startPos = pos, - x = [NodeType.ValueType], - t, _pos; - while (pos < tokensLength) { - _pos = pos; - if (this.checkDeclDelim(pos)) break; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - if (this.checkBlock(_pos)) break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass._checkValue = function(i) { - return this.checkS(i) || - this.checkCommentML(i) || - this.checkCommentSL(i) || - this.checkVhash(i) || - this.checkAny(i) || - this.checkOperator(i) || - this.checkImportant(i); - }; - sass._getValue = function() { - if (this.checkS(pos)) return this.getS(); - if (this.checkCommentML(pos)) return this.getCommentML(); - if (this.checkCommentSL(pos)) return this.getCommentSL(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - }; - sass.markSC = function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.Newline: - t.ws = true; - t.sc = true; - ws = ws === -1 ? i : ws; - sc = sc === -1 ? i : ws; - tokens[ws].ws_last = i; - tokens[sc].sc_last = i; - ws = -1; - sc = -1; - break; - case TokenType.CommentML: - case TokenType.CommentSL: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }; - sass.markBlocks = function() { - var blocks = [], - currentLN = 1, - currentIL = 0, - prevIL = 0, - i = 0, - l = tokens.length, - iw; - for (; i != l; i++) { - if (!tokens[i - 1]) continue; - if (tokens[i].ln == currentLN) continue; - else currentLN = tokens[i].ln; - prevIL = currentIL; - if (tokens[i].type !== TokenType.Space) currentIL = 0; - else { - if (!iw) iw = tokens[i].value.length; - prevIL = currentIL; - currentIL = tokens[i].value.length / iw; - } - if (prevIL === currentIL) continue; - else if (currentIL > prevIL) { - blocks.push(i); - continue; - } else { - var il = prevIL; - while (blocks.length > 0 && il !== currentIL) { - tokens[blocks.pop()].block_end = i - 1; - il--; - } - } - } - while (blocks.length > 0) { - tokens[blocks.pop()].block_end = i - 1; - } - }; - sass.parseMLComment = function(css) { - var start = pos; - var il = 0; - for (var _pos = pos - 1; _pos > -1; _pos--) { - if (css.charAt(_pos) === ' ') il++; - else break; - } - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n') { - var _il = 0; - for (var _pos = pos + 1; _pos < css.length; _pos++) { - if (css.charAt(_pos) === ' ') _il++; - else break; - } - if (_il > il) { - pos = _pos; - } else break; - } - } - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); - }; - sass.parseSLComment = function(css) { - var start = pos; - var il = 0; - var onlyToken = false; - for (var _pos = pos - 1; _pos > -1; _pos--) { - if (css.charAt(_pos) === ' ') il++; - else if (css.charAt(_pos) === '\n') { - onlyToken = true; - break; - } else break; - } - if (_pos === -1) onlyToken = true; - if (!onlyToken) { - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { - break; - } - } - } else { - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n') { - var _il = 0; - for (var _pos = pos + 1; _pos < css.length; _pos++) { - if (css.charAt(_pos) === ' ') _il++; - else break; - } - if (_il > il) { - pos = _pos; - } else break; - } - } - } - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; - }; - syntaxes.sass = sass; -})(); -(function() { - var less = Object.create(syntaxes.css); - less.checkAny = function(i) { - return this.checkBraces(i) || - this.checkString(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkFunctionExpression(i) || - this.checkFunction(i) || - this.checkIdent(i) || - this.checkClass(i) || - this.checkUnary(i); - }; - less.getAny = function() { - if (this.checkBraces(pos)) return this.getBraces(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkFunctionExpression(pos)) return this.getFunctionExpression(); - else if (this.checkFunction(pos)) return this.getFunction(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - else if (this.checkUnary(pos)) return this.getUnary(); - }; - less.checkArguments = function (i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.LeftParenthesis) return 0; - while (i < tokens[start].right) { - if (l = this.checkArgument(i)) i +=l; - else return 0; - } - return tokens[start].right - start + 1; - }; - less.getArguments = function() { - var startPos = pos, - arguments = [], - x; - pos++; - while (x = this.getArgument()) { - if ((needInfo && typeof x[1] === 'string') || typeof x[0] === 'string') arguments.push(x); - else arguments = arguments.concat(x); - } - pos++; - x = [NodeType.ArgumentsType].concat(arguments); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkArgument = function(i) { - return this.checkDeclaration(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkSC(i) || - this.checkDelim(i) || - this.checkDeclDelim(i) || - this.checkString(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkIdent(i) || - this.checkVhash(i); - }; - less.getArgument = function() { - if (this.checkDeclaration(pos)) return this.getDeclaration(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkDelim(pos)) return this.getDelim(); - else if (this.checkDeclDelim(pos)) return this.getDeclDelim(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkVhash(pos)) return this.getVhash(); - }; - less.checkBlockdecl1 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 3; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 4; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 5; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 6; - else return 0; - i += l; - if (i < tokensLength && (l = this.checkDeclDelim(i))) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - return i - start; - } - less.getBlockdecl1 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getFilter(); - break; - case 4: - x = this.getDeclaration(); - break; - case 5: - x = this.getAtrule(); - break; - case 6: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }; - less.checkBlockdecl2 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 3; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 4; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 5; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 6; - else return 0; - i += l; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - less.getBlockdecl2 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getFilter(); - break; - case 4: - x = this.getDeclaration(); - break; - case 5: - x = this.getAtrule(); - break; - case 6: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat(this.getSC()); - }; - less.checkClass = function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && - (l = this.checkInterpolatedVariable(i) || this.checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; - } - return 0; - }; - less.getClass = function() { - var startPos = pos, - x = [NodeType.ClassType]; - pos++; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkCommentSL = function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0; - }; - less.getCommentSL = function() { - var startPos = pos, - x; - x = [NodeType.CommentSLType, tokens[pos++].value.substring(2)]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkCondition = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if ((l = this.checkIdent(i)) && tokens[i].value === 'when') i += l; - else return 0; - while (i < tokensLength) { - if (l = this.checkBlock(i)) break; - if (l = this.checkFunction(i) | - this.checkBraces(i) || - this.checkVariable(i) || - this.checkIdent(i) || - this.checkSC(i) || - this.checkNumber(i) || - this.checkDelim(i) || - this.checkOperator(i) || - this.checkCombinator(i) || - this.checkString(i)) i += l; - else return 0; - } - return i - start; - }; - less.getCondition = function() { - var startPos = pos, - x = [NodeType.ConditionType]; - x.push(this.getIdent()); - while (pos < tokensLength) { - if (this.checkBlock(pos)) break; - else if (this.checkFunction(pos)) x.push(this.getFunction()); - else if (this.checkBraces(pos)) x.push(this.getBraces()); - else if (this.checkVariable(pos)) x.push(this.getVariable()); - else if (this.checkIdent(pos)) x.push(this.getIdent()); - else if (this.checkNumber(pos)) x.push(this.getNumber()); - else if (this.checkDelim(pos)) x.push(this.getDelim()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else if (this.checkCombinator(pos)) x.push(this.getCombinator()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkString(pos)) x.push(this.getString()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkEscapedString = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.Tilde && (l = this.checkString(i + 1))) return i + l - start; - else return 0; - }; - less.getEscapedString = function() { - var startPos = pos, - x = [NodeType.EscapedStringType]; - pos++; - x.push(tokens[pos++].value); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkFilterv = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkProgid(i) || this.checkEscapedString(i)) i += l; - else return 0; - while (l = this.checkProgid(i) || this.checkEscapedString(i)) { - i += l; - } - tokens[start].last_progid = i; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }; - less.getFilterv = function() { - var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - x = x.concat(this.getSC()); - while (pos < last_progid) { - x.push(this.checkProgid(pos) ? this.getProgid() : this.getEscapedString()); - } - if (this.checkSC(pos)) x = x.concat(this.getSC()); - if (pos < tokensLength && this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - less.checkIdent = function(i) { - var start = i, - wasIdent, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.LowLine) return this.checkIdentLowLine(i); - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DollarSign || - tokens[i].type === TokenType.Asterisk) i++; - else return 0; - wasIdent = tokens[i - 1].type === TokenType.Identifier; - for (; i < tokensLength; i++) { - if (l = this.checkInterpolatedVariable(i)) i += l; - if (i >= tokensLength) break; - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine) { - if (tokens[i].type !== TokenType.Identifier && - (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; - else wasIdent = true; - } - } - if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; - tokens[start].ident_last = i - 1; - return i - start; - }; - less.checkInclude = function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkInclude1(i)) tokens[i].include_type = 1; - else if (l = this.checkInclude2(i)) tokens[i].include_type = 2; - return l; - }; - less.getInclude = function() { - switch (tokens[pos].include_type) { - case 1: return this.getInclude1(); - case 2: return this.getInclude2(); - } - }; - less.checkInclude1 = function(i) { - var start = i, - l; - if (l = this.checkClass(i) || this.checkShash(i)) i += l; - else return 0; - while (i < tokensLength) { - if (l = this.checkClass(i) || this.checkShash(i) || this.checkSC(i)) i += l; - else if (tokens[i].type == TokenType.GreaterThanSign) i++; - else break; - } - if (l = this.checkArguments(i)) i += l; - else return 0; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }; - less.getInclude1 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.checkClass(pos) ? this.getClass() : this.getShash()); - while (pos < tokensLength) { - if (this.checkClass(pos)) x.push(this.getClass()); - else if (this.checkShash(pos)) x.push(this.getShash()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else break; - } - x.push(this.getArguments()); - x = x.concat(this.getSC()); - if (this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkInclude2 = function(i) { - var start = i, - l; - if (l = this.checkClass(i) || this.checkShash(i)) i += l; - else return 0; - while (i < tokensLength) { - if (l = this.checkClass(i) || this.checkShash(i) || this.checkSC(i)) i += l; - else if (tokens[i].type == TokenType.GreaterThanSign) i++; - else break; - } - return i - start; - }; - less.getInclude2 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.checkClass(pos) ? this.getClass() : this.getShash()); - while (pos < tokensLength) { - if (this.checkClass(pos)) x.push(this.getClass()); - else if (this.checkShash(pos)) x.push(this.getShash()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkIncludeSelector = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector2(i)) i += l; - else break; - } - return i - start; - }; - less.getIncludeSelector = function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t; - while (pos < tokensLength && this.checkSimpleSelector2(pos)) { - t = this.getSimpleSelector2(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkInterpolatedVariable = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type !== TokenType.CommercialAt || - !tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket) return 0; - i += 2; - if (l = this.checkIdent(i)) i += l; - else return 0; - return tokens[i].type === TokenType.RightCurlyBracket ? i - start + 1 : 0; - }; - less.getInterpolatedVariable = function() { - var startPos = pos, - x = [NodeType.InterpolatedVariableType]; - pos += 2; - x.push(this.getIdent()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkMixin = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkClass(i) || this.checkShash(i)) i +=l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - return i - start; - }; - less.getMixin = function() { - var startPos = pos, - x = [NodeType.MixinType]; - x.push(this.checkClass(pos) ? this.getClass() : this.getShash()); - x = x.concat(this.getSC()); - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkOperator = function(i) { - if (i >= tokensLength) return 0; - switch(tokens[i].type) { - case TokenType.Solidus: - case TokenType.Comma: - case TokenType.Colon: - case TokenType.EqualsSign: - case TokenType.LessThanSign: - case TokenType.GreaterThanSign: - case TokenType.Asterisk: - return 1; - } - return 0; - }; - less.checkParentSelector = function(i) { - return i < tokensLength && tokens[i].type === TokenType.Ampersand ? 1 : 0; - }; - less.getParentSelector = function() { - var startPos = pos, - x = [NodeType.ParentSelectorType, '&']; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkProperty = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i) || this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - less.getProperty = function() { - var startPos = pos, - x = [NodeType.PropertyType]; - if (this.checkVariable(pos)) x.push(this.getVariable()); - else x.push(this.getIdent()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkPseudoe = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || - i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkIdent(i)) ? l + 2 : 0; - }; - less.getPseudoe = function() { - var startPos = pos, - x = [NodeType.PseudoeType]; - pos += 2; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkPseudoc = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkFunction(i) || this.checkIdent(i)) ? l + 1 : 0; - }; - less.getPseudoc = function() { - var startPos = pos, - x = [NodeType.PseudocType]; - pos ++; - if (this.checkInterpolatedVariable(pos)) x.push(this.getInterpolatedVariable()); - else if (this.checkFunction(pos)) x.push(this.getFunction()); - else x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkSC = function(i) { - if (i >= tokensLength) return 0; - var l, - lsc = 0, - ln = tokens[i].ln; - while (i < tokensLength) { - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i)) && - !(l = this.checkCommentSL(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }; - less.getSC = function() { - var sc = [], - ln; - if (pos >= tokensLength) return sc; - ln = tokens[pos].ln; - while (pos < tokensLength) { - if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else if (this.checkCommentSL(pos)) sc.push(this.getCommentSL()); - else break; - } - return sc; - }; - less.checkSimpleSelector1 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkCombinator(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkNamespace(i); - }; - less.getSimpleSelector1 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkCombinator(pos)) return this.getCombinator(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkNamespace(pos)) return this.getNamespace(); - }; - less.checkSimpleSelector2 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkIdent(i) || - this.checkClass(i); - }; - less.getSimpleSelector2 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - }; - less.checkStylesheet = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSC(i) || - this.checkDeclaration(i) || - this.checkDeclDelim(i) || - this.checkInclude(i) || - this.checkMixin(i) || - this.checkAtrule(i) || - this.checkRuleset(i)) i += l; - else throwError(i); - } - return i - start; - }; - less.getStylesheet = function() { - var startPos = pos, - x = [NodeType.StylesheetType]; - while (pos < tokensLength) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else if (this.checkInclude(pos)) x.push(this.getInclude()); - else if (this.checkMixin(pos)) x.push(this.getMixin()); - else if (this.checkAtrule(pos)) x.push(this.getAtrule()); - else if (this.checkDeclaration(pos)) x.push(this.getDeclaration()); - else if (this.checkDeclDelim(pos)) x.push(this.getDeclDelim()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkValue = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this._checkValue(i)) i += l; - if (!l || this.checkBlock(i - l)) break; - } - return i - start; - }; - less._checkValue = function(i) { - return this.checkSC(i) || - this.checkEscapedString(i) || - this.checkInterpolatedVariable(i) || - this.checkVariable(i) || - this.checkVhash(i) || - this.checkBlock(i) || - this.checkAny(i) || - this.checkAtkeyword(i) || - this.checkOperator(i) || - this.checkImportant(i); - }; - less.getValue = function() { - var startPos = pos, - x = [NodeType.ValueType], - t, _pos; - while (pos < tokensLength) { - _pos = pos; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - if (this.checkBlock(_pos)) break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less._getValue = function() { - if (this.checkSC(pos)) return this.getSC(); - else if (this.checkEscapedString(pos)) return this.getEscapedString(); - else if (this.checkInterpolatedVariable(pos)) return this.getInterpolatedVariable(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkBlock(pos)) return this.getBlock(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkAtkeyword(pos)) return this.getAtkeyword(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - }; - less.checkVariable = function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.CommercialAt) return 0; - if (tokens[i - 1] && - tokens[i - 1].type === TokenType.CommercialAt && - tokens[i - 2] && - tokens[i - 2].type === TokenType.CommercialAt) return 0; - return (l = this.checkVariable(i + 1) || this.checkIdent(i + 1)) ? l + 1 : 0; - }; - less.getVariable = function() { - var startPos = pos, - x = [NodeType.VariableType]; - pos++; - if (this.checkVariable(pos)) x.push(this.getVariable()); - else x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkVariablesList = function(i) { - var d = 0, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i)) i+= l; - else return 0; - while (tokens[i] && tokens[i].type === TokenType.FullStop) { - d++; - i++; - } - return d === 3 ? l + d : 0; - }; - less.getVariablesList = function() { - var startPos = pos, - x = [NodeType.VariablesListType, this.getVariable()]; - pos += 3; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.markSC = function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.CommentML: - case TokenType.CommentSL: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }; - syntaxes.less = less; -})(); - return function(options) { - var css, rule, syntax; - if (!options) throw new Error('Please, pass a string to parse'); - css = typeof options === 'string'? options : options.css; - if (!css) throw new Error('String can not be empty'); - rule = options.rule || 'stylesheet'; - needInfo = options.needInfo || false; - syntax = options.syntax || 'css'; - if (!syntaxes[syntax]) throw new Error('Syntax "' + _syntax + - '" is not currently supported, sorry'); - s = syntaxes[syntax]; - getTokens(css, syntax); - tokensLength = tokens.length; - pos = 0; - s.markBrackets(); - s.markSC(); - s.markBlocks && s.markBlocks(); - return rules[rule](); - } -}()); -exports.cssToAST = cssToAST; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.js deleted file mode 100644 index 3802a0a..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/gonzales.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - astToSrc: require('./ast-to-src'), - astToString: require('./ast-to-string'), - srcToAST: require('./src-to-ast') -}; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/mark.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/js/mark.js deleted file mode 100644 index 426b97e..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/mark.js +++ /dev/null @@ -1,117 +0,0 @@ -var TokenType = require('../token-types'); - -module.exports = (function() { - /** - * Mark whitespaces and comments - */ - function markSC(tokens) { - var tokensLength = tokens.length; - var ws = -1, // flag for whitespaces - sc = -1, // flag for whitespaces and comments - t; // current token - - // For every token in the token list, mark spaces and line breaks - // as spaces (set both `ws` and `sc` flags). Mark multiline comments - // with `sc` flag. - // If there are several spaces or tabs or line breaks or multiline - // comments in a row, group them: take the last one's index number - // and save it to the first token in the group as a reference - // (e.g., `ws_last = 7` for a group of whitespaces or `sc_last = 9` - // for a group of whitespaces and comments): - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - - if (ws === -1) ws = i; - if (sc === -1) sc = i; - - break; - case TokenType.CommentML: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - - t.sc = true; - - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - } - - /** - * Pair brackets - */ - function markBrackets(tokens) { - var tokensLength = tokens.length; - var ps = [], // parenthesis - sbs = [], // square brackets - cbs = [], // curly brackets - t; // current token - - // For every token in the token list, if we meet an opening (left) - // bracket, push its index number to a corresponding array. - // If we then meet a closing (right) bracket, look at the corresponding - // array. If there are any elements (records about previously met - // left brackets), take a token of the last left bracket (take - // the last index number from the array and find a token with - // this index number) and save right bracket's index as a reference: - for (var i = 0; i < tokens.length; i++) { - t = tokens[i]; - switch(t.type) { - case TokenType.LeftParenthesis: - ps.push(i); - break; - case TokenType.RightParenthesis: - if (ps.length) { - t.left = ps.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftSquareBracket: - sbs.push(i); - break; - case TokenType.RightSquareBracket: - if (sbs.length) { - t.left = sbs.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftCurlyBracket: - cbs.push(i); - break; - case TokenType.RightCurlyBracket: - if (cbs.length) { - t.left = cbs.pop(); - tokens[t.left].right = i; - } - break; - } - } - } - - return function(tokens) { - // Mark paired brackets: - markBrackets(tokens); - // Mark whitespaces and comments: - markSC(tokens); - } -})(); diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/node-types.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/js/node-types.js deleted file mode 100644 index c0e46eb..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/node-types.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - FUNCTION_BODY: 'functionBody', - FUNCTION_DECLARATION: 'functionDeclaration', - PARAMS: 'params', - PROGRAM: 'program', - SPACE: 'space', - TEXT: 'text' -}; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/rules.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/js/rules.js deleted file mode 100644 index 36464d1..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/rules.js +++ /dev/null @@ -1,281 +0,0 @@ -var TokenType = require('../token-types'); -var NodeType = require('./node-types'); - -module.exports = (function() { - var tokens, tokensLength, pos; - - var rules = { - 'functionBody': function() { return checkFunctionBody(pos) && getFunctionBody(); }, - 'functionDeclaration': function() { return checkFunctionDeclaration(pos) && getFunctionDeclaration(); }, - 'papams': function() { return checkParams(pos) && getParams(); }, - 'program': function() { return checkProgram(pos) && getProgram(); }, - 'space': function() { return checkSpace(pos) && getSpace(); }, - 'text': function() { return checkText(pos) && getText(); } - }; - - /** - * Stop parsing and display error - * @param {Number=} i Token's index number - */ - function throwError(i) { - var ln = i ? tokens[i].ln : tokens[pos].ln; - - throw {line: ln, syntax: 'js'}; - } - - /** - * @param {Object} exclude - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkExcluding(exclude, i) { - var start = i; - - while(i < tokensLength) { - if (exclude[tokens[i++].type]) break; - } - - return i - start - 2; - } - - /** - * @param {Number} start - * @param {Number} finish - * @returns {String} - */ - function joinValues(start, finish) { - var s = ''; - - for (var i = start; i < finish + 1; i++) { - s += tokens[i].value; - } - - return s; - } - - /** - * @param {Number} start - * @param {Number} num - * @returns {String} - */ - function joinValues2(start, num) { - if (start + num - 1 >= tokensLength) return; - - var s = ''; - - for (var i = 0; i < num; i++) { - s += tokens[start + i].value; - } - - return s; - } - - -///////////////////////////////////// -///////////////////////////////////// -///////////////////////////////////// - - function checkFunctionBody(i) { - var start = i; - - if (i >= tokensLength) return 0; - - if (tokens[i].type === TokenType.LeftCurlyBracket) i = tokens[i].right + 1; - else return 0; - - return i - start; - } - - function getFunctionBody() { - var startPos = pos, - x = [NodeType.FUNCTION_BODY]; - - // Skip `{`: - pos++; - - x.push(joinValues(pos, tokens[pos].right - 1)); - - // Skip `}`: - pos++; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkFunctionDeclaration(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - if (tokens[i].value === 'function') i++; - else return 0; - - if (l = checkSpace(i)) i += l; - else return 0; - - if (tokens[i].type === TokenType.Identifier) i++; - else return 0; - - if (l = checkSpace(i)) i += l; - - if (l = checkParams(i)) i += l; - else return 0; - - if (l = checkSpace(i)) i += l; - - if (l = checkFunctionBody(i)) i += l; - else return 0; - - return i - start; - } - - /** - * @returns {Array} - */ - function getFunctionDeclaration() { - var startPos = pos, - x = [NodeType.FUNCTION_DECLARATION]; - - // Skip `function` word: - pos++; - - x.push(getSpace()); - - // TODO: `getIdent`: - x.push(['ident', tokens[pos].value]); - pos++; - - if (checkSpace(pos)) x.push(getSpace()); - - x.push(getParams()); - - if (checkSpace(pos)) x.push(getSpace()); - - x.push(getFunctionBody()); - - return x; - } - - function checkParams(i) { - var start = i; - - if (tokens[i].type === TokenType.LeftParenthesis) i = tokens[i].right + 1; - else return 0; - - return i - start; - } - - function getParams() { - var startPos = pos, - x = [NodeType.PARAMS]; - - // Skip `(`: - pos++; - - x.push(joinValues(pos, tokens[pos].right - 1)); - - // Skip `)`: - pos++; - - return x; - } - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkProgram(i) { - var start = i, - l; - - while (i < tokensLength) { - if (l = checkFunctionDeclaration(i) || checkText(i)) i += l; - else break; - } - - return i - start; - } - - /** - * @returns {Array} - */ - function getProgram() { - var startPos = pos, - x = [NodeType.PROGRAM]; - - while (pos < tokensLength) { - if (checkFunctionDeclaration(pos)) x.push(getFunctionDeclaration()); - else if (checkText(pos)) x.push(getText()); - else throwError(); - } - - return x; - } - - /** - * Check if token is marked as a space (if it's a space or a tab - * or a line break). - * @param i - * @returns {Number} Number of spaces in a row starting with the given token. - */ - function checkSpace(i) { - return i < tokensLength && tokens[i].ws ? - tokens[i].ws_last - i + 1 : - 0; - } - - /** - * Get node with spaces - * @returns {Array} `['s', x]` where `x` is a string containing spaces - */ - function getSpace() { - var startPos = pos, - x = [NodeType.SPACE, joinValues(pos, tokens[pos].ws_last)]; - - pos = tokens[pos].ws_last + 1; - - return x; - } - - - /** - * @param {Number} i Token's index number - * @returns {Number} - */ - function checkText(i) { - var start = i, - l; - - if (i >= tokensLength) return 0; - - while (i < tokensLength && !checkFunctionDeclaration(i)) i++; - - return i - start; - } - - /** - * @returns {Array} - */ - function getText() { - var startPos = pos, - x = [NodeType.TEXT]; - - while (pos < tokensLength && !checkFunctionDeclaration(pos)) pos++; - - x.push(joinValues(startPos, pos - 1)); - - return x; - } - - return function(_tokens, rule) { - tokens = _tokens; - tokensLength = tokens.length; - pos = 0; - - return rules[rule](); - }; -})(); diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/stringify.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/js/stringify.js deleted file mode 100644 index 0ed02c2..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/stringify.js +++ /dev/null @@ -1,48 +0,0 @@ -module.exports = function stringify(tree) { - // TODO: Better error message - if (!tree) throw new Error('We need tree to translate'); - - var _m_simple = { - 'ident': 1, - 'space': 1, - 'text': 1 - }, - _m_composite = { - 'program': 1, - }, - _m_primitive = { - }; - - function _t(tree) { - var t = tree[0]; - if (t in _m_primitive) return _m_primitive[t]; - else if (t in _m_simple) return _simple(tree); - else if (t in _m_composite) return _composite(tree); - return _unique[t](tree); - } - - function _composite(t, i) { - var s = ''; - i = i === undefined ? 1 : i; - for (; i < t.length; i++) s += typeof t[i] === 'string' ? t[i] : _t(t[i]); - return s; - } - - function _simple(t) { - return t[1]; - } - - var _unique = { - 'functionBody': function(t) { - return '{' + t[1] + '}'; - }, - 'functionDeclaration': function(t) { - return 'function' + _composite(t); - }, - 'params': function(t) { - return '(' + t[1] + ')'; - } - }; - - return _t(tree); -}; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/tokenizer.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/js/tokenizer.js deleted file mode 100644 index f580f8b..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/js/tokenizer.js +++ /dev/null @@ -1,249 +0,0 @@ -module.exports = function(js) { - var TokenType = require('../token-types'); - - var tokens = [], - urlMode = false, - blockMode = 0, - c, // current character - cn, // next character - pos = 0, - tn = 0, - ln = 1; - - var Punctuation = { - ' ': TokenType.Space, - '\n': TokenType.Newline, - '\r': TokenType.Newline, - '\t': TokenType.Tab, - '!': TokenType.ExclamationMark, - '"': TokenType.QuotationMark, - '#': TokenType.NumberSign, - '$': TokenType.DollarSign, - '%': TokenType.PercentSign, - '&': TokenType.Ampersand, - '\'': TokenType.Apostrophe, - '(': TokenType.LeftParenthesis, - ')': TokenType.RightParenthesis, - '*': TokenType.Asterisk, - '+': TokenType.PlusSign, - ',': TokenType.Comma, - '-': TokenType.HyphenMinus, - '.': TokenType.FullStop, - '/': TokenType.Solidus, - ':': TokenType.Colon, - ';': TokenType.Semicolon, - '<': TokenType.LessThanSign, - '=': TokenType.EqualsSign, - '>': TokenType.GreaterThanSign, - '?': TokenType.QuestionMark, - '@': TokenType.CommercialAt, - '[': TokenType.LeftSquareBracket, - ']': TokenType.RightSquareBracket, - '^': TokenType.CircumflexAccent, - '_': TokenType.LowLine, - '{': TokenType.LeftCurlyBracket, - '|': TokenType.VerticalLine, - '}': TokenType.RightCurlyBracket, - '~': TokenType.Tilde - }; - - /** - * Add a token to the token list - * @param {string} type - * @param {string} value - */ - function pushToken(type, value) { - tokens.push({ tn: tn++, ln: ln, type: type, value: value }); - } - - /** - * Check if a character is a decimal digit - * @param {string} c Character - * @returns {boolean} - */ - function isDecimalDigit(c) { - return '0123456789'.indexOf(c) >= 0; - } - - /** - * Parse spaces - * @param {string} js Unparsed part of js string - */ - function parseSpaces(js) { - var start = pos; - - // Read the string until we meet a non-space character: - for (; pos < js.length; pos++) { - if (js.charAt(pos) !== ' ') break; - } - - // Add a substring containing only spaces to tokens: - pushToken(TokenType.Space, js.substring(start, pos)); - pos--; - } - - /** - * Parse a string within quotes - * @param {string} js Unparsed part of js string - * @param {string} q Quote (either `'` or `"`) - */ - function parseString(js, q) { - var start = pos; - - // Read the string until we meet a matching quote: - for (pos = pos + 1; pos < js.length; pos++) { - // Skip escaped quotes: - if (js.charAt(pos) === '\\') pos++; - else if (js.charAt(pos) === q) break; - } - - // Add the string (including quotes) to tokens: - pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, js.substring(start, pos + 1)); - } - - /** - * Parse numbers - * @param {string} js Unparsed part of js string - */ - function parseDecimalNumber(js) { - var start = pos; - - // Read the string until we meet a character that's not a digit: - for (; pos < js.length; pos++) { - if (!isDecimalDigit(js.charAt(pos))) break; - } - - // Add the number to tokens: - pushToken(TokenType.DecimalNumber, js.substring(start, pos)); - pos--; - } - - /** - * Parse identifier - * @param {string} js Unparsed part of js string - */ - function parseIdentifier(js) { - var start = pos; - - // Skip all opening slashes: - while (js.charAt(pos) === '/') pos++; - - // Read the string until we meet a punctuation mark: - for (; pos < js.length; pos++) { - // Skip all '\': - if (js.charAt(pos) === '\\') pos++; - else if (js.charAt(pos) in Punctuation) break; - } - - var ident = js.substring(start, pos); - - // Enter url mode if parsed substring is `url`: - urlMode = urlMode || ident === 'url'; - - // Add identifier to tokens: - pushToken(TokenType.Identifier, ident); - pos--; - } - - /** - * Parse a multiline comment - * @param {string} js Unparsed part of js string - */ - function parseMLComment(js) { - var start = pos; - - // Read the string until we meet `*/`. - // Since we already know first 2 characters (`/*`), start reading - // from `pos + 2`: - for (pos = pos + 2; pos < js.length; pos++) { - if (js.charAt(pos) === '*' && js.charAt(pos + 1) === '/') { - pos++; - break; - } - } - - // Add full comment (including `/*` and `*/`) to the list of tokens: - pushToken(TokenType.CommentML, js.substring(start, pos + 1)); - } - - function parseSLComment(js) { - var start = pos; - - // Read the string until we meet line break. - // Since we already know first 2 characters (`//`), start reading - // from `pos + 2`: - for (pos = pos + 2; pos < js.length; pos++) { - if (js.charAt(pos) === '\n' || js.charAt(pos) === '\r') { - break; - } - } - - // Add comment (including `//` and line break) to the list of tokens: - pushToken(TokenType.CommentSL, js.substring(start, pos)); - pos--; - } - - /** - * Convert a js string to a list of tokens - * @param {string} js js string - * @returns {Array} List of tokens - * @private - */ - function getTokens(js) { - // Parse string, character by character: - for (pos = 0; pos < js.length; pos++) { - c = js.charAt(pos); - cn = js.charAt(pos + 1); - - // If we meet `/*`, it's a start of a multiline comment. - // Parse following characters as a multiline comment: - if (c === '/' && cn === '*') { - parseMLComment(js); - } - - // If we meet `//` and it is not a part of url: - else if (!urlMode && c === '/' && cn === '/') { - // If we're currently inside a block, treat `//` as a start - // of identifier. Else treat `//` as a start of a single-line - // comment: - if (blockMode > 0) parseIdentifier(js); - else parseSLComment(js); - } - - // If current character is a double or single quote, it's a start - // of a string: - else if (c === '"' || c === "'") { - parseString(js, c); - } - - // If current character is a space: - else if (c === ' ') { - parseSpaces(js) - } - - // If current character is a punctuation mark: - else if (c in Punctuation) { - // Add it to the list of tokens: - pushToken(Punctuation[c], c); - if (c === '\n' || c === '\r') ln++; // Go to next line - if (c === ')') urlMode = false; // exit url mode - if (c === '{') blockMode++; // enter a block - if (c === '}') blockMode--; // exit a block - } - - // If current character is a decimal digit: - else if (isDecimalDigit(c)) { - parseDecimalNumber(js); - } - - // If current character is anything else: - else { - parseIdentifier(js); - } - } - - return tokens; - } - - return getTokens(js); -}; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/node-types.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/less/node-types.js deleted file mode 100644 index 5667642..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/node-types.js +++ /dev/null @@ -1,58 +0,0 @@ -module.exports = { - ArgumentsType: 'arguments', - AtkeywordType: 'atkeyword', - AtrulebType: 'atruleb', - AtrulerType: 'atruler', - AtrulerqType: 'atrulerq', - AtrulersType: 'atrulers', - AtrulesType: 'atrules', - AttribType: 'attrib', - AttrselectorType: 'attrselector', - BlockType: 'block', - BracesType: 'braces', - ClassType: 'class', - CombinatorType: 'combinator', - CommentMLType: 'commentML', - CommentSLType: 'commentSL', - ConditionType: 'condition', - DeclarationType: 'declaration', - DeclDelimType: 'declDelim', - DelimType: 'delim', - DimensionType: 'dimension', - EscapedStringType: 'escapedString', - FilterType: 'filter', - FiltervType: 'filterv', - FunctionType: 'function', - FunctionExpressionType: 'functionExpression', - IdentType: 'ident', - ImportantType: 'important', - IncludeType :'include', - InterpolatedVariableType: 'interpolatedVariable', - MixinType: 'mixin', - NamespaceType: 'namespace', - NthType: 'nth', - NthselectorType: 'nthselector', - NumberType: 'number', - OperatorType: 'operator', - ParentSelectorType: 'parentselector', - PercentageType: 'percentage', - ProgidType: 'progid', - PropertyType: 'property', - PropertyDelimType: 'propertyDelim', - PseudocType: 'pseudoc', - PseudoeType: 'pseudoe', - RawType: 'raw', - RulesetType: 'ruleset', - SType: 's', - SelectorType: 'selector', - ShashType: 'shash', - SimpleselectorType: 'simpleselector', - StringType: 'string', - StylesheetType: 'stylesheet', - UnaryType: 'unary', - UriType: 'uri', - ValueType: 'value', - VariableType: 'variable', - VariablesListType: 'variableslist', - VhashType: 'vhash' -}; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/stringify.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/less/stringify.js deleted file mode 100644 index 0e6868a..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/stringify.js +++ /dev/null @@ -1,113 +0,0 @@ -module.exports = function stringify(tree) { - // TODO: Better error message - if (!tree) throw new Error('We need tree to translate'); - - var _m_simple = { - 'attrselector': 1, 'combinator': 1, 'nth': 1, 'number': 1, - 'operator': 1, 'raw': 1, 's': 1, 'string': 1, 'unary': 1 - }, - _m_composite = { - 'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, 'atrules': 1,'condition': 1, - 'declaration': 1, 'dimension': 1, 'filterv': 1, 'function': 1, - 'ident': 1, 'include': 1, 'mixin': 1, 'selector': 1, 'progid': 1, - 'property': 1, 'ruleset': 1, 'simpleselector': 1, 'stylesheet': 1, - 'value': 1 - }, - _m_primitive = { - 'declDelim': ';', 'delim': ',', - 'namespace': '|', 'parentselector': '&', 'propertyDelim' : ':' - }; - - function _t(tree) { - var t = tree[0]; - if (t in _m_primitive) return _m_primitive[t]; - else if (t in _m_simple) return _simple(tree); - else if (t in _m_composite) return _composite(tree); - return _unique[t](tree); - } - - function _composite(t, i) { - var s = ''; - i = i === undefined ? 1 : i; - for (; i < t.length; i++) s += typeof t[i] === 'string' ? t[i] : _t(t[i]); - return s; - } - - function _simple(t) { - return t[1]; - } - - var _unique = { - 'arguments': function(t) { - return '(' + _composite(t) + ')'; - }, - 'atkeyword': function(t) { - return '@' + _t(t[1]); - }, - 'atruler': function(t) { - return _t(t[1]) + _t(t[2]) + '{' + _t(t[3]) + '}'; - }, - 'attrib': function(t) { - return '[' + _composite(t) + ']'; - }, - 'block': function(t) { - return '{' + _composite(t) + '}'; - }, - 'braces': function(t) { - return t[1] + _composite(t, 3) + t[2]; - }, - 'class': function(t) { - return '.' + _t(t[1]); - }, - 'commentML': function (t) { - return '/*' + t[1] + '*/'; - }, - 'commentSL': function (t) { - return '/' + '/' + t[1]; - }, - 'escapedString': function(t) { - return '~' + t[1]; - }, - 'filter': function(t) { - return _t(t[1]) + ':' + _t(t[2]); - }, - 'functionExpression': function(t) { - return 'expression(' + t[1] + ')'; - }, - 'important': function(t) { - return '!' + _composite(t) + 'important'; - }, - 'interpolatedVariable': function(t) { - return '@{' + _t(t[1]) + '}'; - }, - 'nthselector': function(t) { - return ':' + _simple(t[1]) + '(' + _composite(t, 2) + ')'; - }, - 'percentage': function(t) { - return _t(t[1]) + '%'; - }, - 'pseudoc': function(t) { - return ':' + _t(t[1]); - }, - 'pseudoe': function(t) { - return '::' + _t(t[1]); - }, - 'shash': function (t) { - return '#' + t[1]; - }, - 'uri': function(t) { - return 'url(' + _composite(t) + ')'; - }, - 'variable': function(t) { - return '@' + _t(t[1]); - }, - 'variableslist': function(t) { - return _t(t[1]) + '...'; - }, - 'vhash': function(t) { - return '#' + t[1]; - } - }; - - return _t(tree); -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/stringify.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/stringify.js deleted file mode 100644 index a1d05c5..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/stringify.js +++ /dev/null @@ -1,117 +0,0 @@ -module.exports = function stringify(tree) { - // TODO: Better error message - if (!tree) throw new Error('We need tree to translate'); - - var _m_simple = { - 'attrselector': 1, 'combinator': 1, 'nth': 1, 'number': 1, - 'operator': 1, 'raw': 1, 's': 1, 'string': 1, 'unary': 1 - }, - _m_composite = { - 'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, 'atrules': 1,'condition': 1, - 'conditionalStatement': 1, - 'declaration': 1, 'dimension': 1, 'filterv': 1, 'function': 1, - 'ident': 1, 'include': 1, - 'loop': 1, 'mixin': 1, 'selector': 1, 'progid': 1, 'property': 1, - 'ruleset': 1, 'simpleselector': 1, 'stylesheet': 1, 'value': 1 - }, - _m_primitive = { - 'declDelim': '\n', 'delim': ',', - 'namespace': '|', 'parentselector': '&', 'propertyDelim' : ':' - }; - - function _t(tree) { - var t = tree[0]; - if (t in _m_primitive) return _m_primitive[t]; - else if (t in _m_simple) return _simple(tree); - else if (t in _m_composite) return _composite(tree); - return _unique[t](tree); - } - - function _composite(t, i) { - var s = ''; - i = i === undefined ? 1 : i; - for (; i < t.length; i++) s += typeof t[i] === 'string' ? t[i] : _t(t[i]); - return s; - } - - function _simple(t) { - return t[1]; - } - - var _unique = { - 'arguments': function(t) { - return '(' + _composite(t) + ')'; - }, - 'atkeyword': function(t) { - return '@' + _t(t[1]); - }, - 'atruler': function(t) { - return _t(t[1]) + _t(t[2]) + '{' + _t(t[3]) + '}'; - }, - 'attrib': function(t) { - return '[' + _composite(t) + ']'; - }, - 'block': function(t) { - return _composite(t); - }, - 'braces': function(t) { - return t[1] + _composite(t, 3) + t[2]; - }, - 'class': function(t) { - return '.' + _t(t[1]); - }, - 'commentML': function (t) { - return '/*' + t[1]; - }, - 'commentSL': function (t) { - return '/' + '/' + t[1]; - }, - 'default': function(t) { - return '!' + _composite(t) + 'default'; - }, - 'filter': function(t) { - return _t(t[1]) + ':' + _t(t[2]); - }, - 'functionExpression': function(t) { - return 'expression(' + t[1] + ')'; - }, - 'important': function(t) { - return '!' + _composite(t) + 'important'; - }, - 'interpolation': function(t) { - return '#{' + _t(t[1]) + '}'; - }, - 'nthselector': function(t) { - return ':' + _simple(t[1]) + '(' + _composite(t, 2) + ')'; - }, - 'percentage': function(t) { - return _t(t[1]) + '%'; - }, - 'placeholder': function(t) { - return '%' + _t(t[1]); - }, - 'pseudoc': function(t) { - return ':' + _t(t[1]); - }, - 'pseudoe': function(t) { - return '::' + _t(t[1]); - }, - 'shash': function (t) { - return '#' + t[1]; - }, - 'uri': function(t) { - return 'url(' + _composite(t) + ')'; - }, - 'variable': function(t) { - return '$' + _t(t[1]); - }, - 'variableslist': function(t) { - return _t(t[1]) + '...'; - }, - 'vhash': function(t) { - return '#' + t[1]; - } - }; - - return _t(tree); -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/node-types.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/node-types.js deleted file mode 100644 index 3118be2..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/node-types.js +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = { - ArgumentsType: 'arguments', - AtkeywordType: 'atkeyword', - AtrulebType: 'atruleb', - AtrulerType: 'atruler', - AtrulerqType: 'atrulerq', - AtrulersType: 'atrulers', - AtrulesType: 'atrules', - AttribType: 'attrib', - AttrselectorType: 'attrselector', - BlockType: 'block', - BracesType: 'braces', - ClassType: 'class', - CombinatorType: 'combinator', - CommentMLType: 'commentML', - CommentSLType: 'commentSL', - ConditionType: 'condition', - ConditionalStatementType: 'conditionalStatement', - DeclarationType: 'declaration', - DeclDelimType: 'declDelim', - DefaultType: 'default', - DelimType: 'delim', - DimensionType: 'dimension', - FilterType: 'filter', - FiltervType: 'filterv', - FunctionType: 'function', - FunctionExpressionType: 'functionExpression', - IdentType: 'ident', - ImportantType: 'important', - IncludeType :'include', - InterpolationType: 'interpolation', - LoopType: 'loop', - MixinType: 'mixin', - NamespaceType: 'namespace', - NthType: 'nth', - NthselectorType: 'nthselector', - NumberType: 'number', - OperatorType: 'operator', - ParentSelectorType: 'parentselector', - PercentageType: 'percentage', - PlaceholderType: 'placeholder', - ProgidType: 'progid', - PropertyType: 'property', - PropertyDelimType: 'propertyDelim', - PseudocType: 'pseudoc', - PseudoeType: 'pseudoe', - RawType: 'raw', - RulesetType: 'ruleset', - SType: 's', - SelectorType: 'selector', - ShashType: 'shash', - SimpleselectorType: 'simpleselector', - StringType: 'string', - StylesheetType: 'stylesheet', - UnaryType: 'unary', - UriType: 'uri', - ValueType: 'value', - VariableType: 'variable', - VariablesListType: 'variableslist', - VhashType: 'vhash' -}; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/stringify.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/stringify.js deleted file mode 100644 index bed2718..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/stringify.js +++ /dev/null @@ -1,117 +0,0 @@ -module.exports = function stringify(tree) { - // TODO: Better error message - if (!tree) throw new Error('We need tree to translate'); - - var _m_simple = { - 'attrselector': 1, 'combinator': 1, 'nth': 1, 'number': 1, - 'operator': 1, 'raw': 1, 's': 1, 'string': 1, 'unary': 1 - }, - _m_composite = { - 'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, 'atrules': 1,'condition': 1, - 'conditionalStatement': 1, - 'declaration': 1, 'dimension': 1, 'filterv': 1, 'function': 1, - 'ident': 1, 'include': 1, - 'loop': 1, 'mixin': 1, 'selector': 1, 'progid': 1, 'property': 1, - 'ruleset': 1, 'simpleselector': 1, 'stylesheet': 1, 'value': 1 - }, - _m_primitive = { - 'declDelim': ';', 'delim': ',', - 'namespace': '|', 'parentselector': '&', 'propertyDelim' : ':' - }; - - function _t(tree) { - var t = tree[0]; - if (t in _m_primitive) return _m_primitive[t]; - else if (t in _m_simple) return _simple(tree); - else if (t in _m_composite) return _composite(tree); - return _unique[t](tree); - } - - function _composite(t, i) { - var s = ''; - i = i === undefined ? 1 : i; - for (; i < t.length; i++) s += typeof t[i] === 'string' ? t[i] : _t(t[i]); - return s; - } - - function _simple(t) { - return t[1]; - } - - var _unique = { - 'arguments': function(t) { - return '(' + _composite(t) + ')'; - }, - 'atkeyword': function(t) { - return '@' + _t(t[1]); - }, - 'atruler': function(t) { - return _t(t[1]) + _t(t[2]) + '{' + _t(t[3]) + '}'; - }, - 'attrib': function(t) { - return '[' + _composite(t) + ']'; - }, - 'block': function(t) { - return '{' + _composite(t) + '}'; - }, - 'braces': function(t) { - return t[1] + _composite(t, 3) + t[2]; - }, - 'class': function(t) { - return '.' + _t(t[1]); - }, - 'commentML': function (t) { - return '/*' + t[1] + '*/'; - }, - 'commentSL': function (t) { - return '/' + '/' + t[1]; - }, - 'default': function(t) { - return '!' + _composite(t) + 'default'; - }, - 'filter': function(t) { - return _t(t[1]) + ':' + _t(t[2]); - }, - 'functionExpression': function(t) { - return 'expression(' + t[1] + ')'; - }, - 'important': function(t) { - return '!' + _composite(t) + 'important'; - }, - 'interpolation': function(t) { - return '#{' + _t(t[1]) + '}'; - }, - 'nthselector': function(t) { - return ':' + _simple(t[1]) + '(' + _composite(t, 2) + ')'; - }, - 'percentage': function(t) { - return _t(t[1]) + '%'; - }, - 'placeholder': function(t) { - return '%' + _t(t[1]); - }, - 'pseudoc': function(t) { - return ':' + _t(t[1]); - }, - 'pseudoe': function(t) { - return '::' + _t(t[1]); - }, - 'shash': function (t) { - return '#' + t[1]; - }, - 'uri': function(t) { - return 'url(' + _composite(t) + ')'; - }, - 'variable': function(t) { - return '$' + _t(t[1]); - }, - 'variableslist': function(t) { - return _t(t[1]) + '...'; - }, - 'vhash': function(t) { - return '#' + t[1]; - } - }; - - return _t(tree); -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/src-to-ast.js b/node_modules/csscomb/node_modules/gonzales-pe/lib/src-to-ast.js deleted file mode 100644 index 9292d52..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/src-to-ast.js +++ /dev/null @@ -1,75 +0,0 @@ -module.exports = (function() { - function throwError(e, src) { - var line = e.line; - var name = 'Parsing error'; - var version = require('../package.json').version; - var message = formatErrorMessage(src, line, version); - var error = { - line: line, - syntax: e.syntax, - version: version, - name: name, - message: message - } - error.toString = function() {return this.name + ': ' + this.message;}; - throw error; - } - - function formatErrorMessage(text, ln, version) { - var message = ['Please check the validity of the block starting from line #' + ln]; - - message.push(''); - var code = formatCodeFragment(text, ln); - message = message.concat(code); - message.push(''); - - message.push('Gonzales PE version: ' + version); - - return message.join('\n'); - } - - function formatCodeFragment(text, lineNumber) { - var lines = text.split(/\r\n|\r|\n/); - var linesAround = 2; - var result = []; - - for (var i = lineNumber - 1 - linesAround; i < lineNumber + linesAround; i++) { - var line = lines[i]; - if (!line) continue; - var ln = i + 1; - var mark = ln === lineNumber ? '*' : ' '; - result.push(ln + mark + '| ' + line); - } - - return result; - } - - return function(options) { - var src, rule, syntax, getTokens, mark, rules, tokens, ast; - - if (!options || !options.src) throw new Error('Please, pass a string to parse'); - - src = typeof options === 'string' ? options : options.src; - syntax = options.syntax || 'css'; - rule = options.rule || (syntax === 'js' ? 'program' : 'stylesheet'); - - var fs = require('fs'); - if (!fs.existsSync(__dirname + '/' + syntax)) - return console.error('Syntax "' + syntax + '" is not supported yet, sorry'); - - getTokens = require('./' + syntax + '/tokenizer'); - mark = require('./' + syntax + '/mark'); - rules = require('./' + syntax + '/rules'); - - tokens = getTokens(src); - mark(tokens); - - try { - ast = rules(tokens, rule); - } catch (e) { - throwError(e, src); - } - - return ast; - } -})(); diff --git a/node_modules/csscomb/node_modules/gonzales-pe/package.json b/node_modules/csscomb/node_modules/gonzales-pe/package.json deleted file mode 100644 index 3c74109..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "gonzales-pe", - "description": "Gonzales Preprocessor Edition (fast CSS parser)", - "version": "3.0.0-10", - "homepage": "http://github.com/tonyganch/gonzales-pe", - "bugs": { - "url": "http://github.com/tonyganch/gonzales-pe/issues" - }, - "license": "MIT", - "author": { - "name": "Tony Ganch", - "email": "tonyganch+github@gmail.com", - "url": "http://tonyganch.com" - }, - "main": "./lib/gonzales", - "repository": { - "type": "git", - "url": "http://github.com/tonyganch/gonzales-pe.git" - }, - "scripts": { - "test": "(mkdir -p log && node ./test/mocha.js) | tee ./log/test.log" - }, - "bin": { - "gonzales": "./bin/gonzales.js" - }, - "devDependencies": { - "benchmark": "~1.0.0", - "coffee-script": "~1.7.1", - "microtime": "~0.3.3", - "mocha": "~1.20.0" - }, - "engines": { - "node": ">=0.6.0" - }, - "readme": "Gonzales is a fast CSS parser. \nGonzales PE is a rework with support of preprocessors. \n\nCurrently those are supported: SCSS, Sass, LESS.\n\nFor a plan of future work see [issue #4](https://github.com/tonyganch/gonzales-pe/issues/4).\n\n## Install\n\nTo install globally:\n\n npm install gonzales-pe -g\n\nTo install as a project dependency:\n\n npm install gonzales-pe\n\nTo install dev branch:\n\n npm install git://github.com/tonyganch/gonzales-pe.git#dev\n\nTo clone from github:\n\n git clone git@github.com:tonyganch/gonzales-pe.git\n\n## Build\n\nIf you installed/cloned the repo from GitHub, make sure to build library files\nfirst. \nIt can be done by running `make` in the module's root directory. \n`make` will build both Node.js and web versions (all files are comments-free\nbut not compressed). \nIf you need a minified version for production, feel free to use uglifier of\nyour choice.\n\n## Use\n\nRequire Gonzales in your project:\n\n var gonzales = require('gonzales-pe');\n\nDo something:\n\n var css = 'a { color: tomato }';\n console.log(gonzales.cssToAST(css));\n\nYou can learn more about available methods on [Gonzales usage](doc/Gonzales-Usage.md) page.\n\nAST is described on [Gonzales AST description](doc/AST-Description.md) page.\n\nYou can also invoke gonzales via a shell command (if you globally install it via `npm install gonzales-pe -g`)\n\n```\ngonzales myFile.css\n```\n\nOutputs the AST for that file. Example output:\n\n```\n['stylesheet',\n ['atrules',\n ['atkeyword',\n ['ident', 'import']],\n ['s', '\n']]]\n```\n\n## Test\n\nTo run tests:\n\n npm test\n\nThis command will build library files from sources and run tests on all files\nin syntax directories.\n\nEvery test has 3 files: source stylesheet, expected AST and expected string\ncompiled back from AST to css.\n\nIf some tests fail, you can find information in test logs:\n\n- `log/test.log` contains all information from stdout;\n- `log/expected.txt` contains only expected text;\n- `log/result.txt` contains only result text.\n\nThe last two are made for your convenience: you can use any diff app to see\nthe defference between them.\n\nIf you want to test one specific string or get a general idea of how Gonzales\nworks, you can use `test/ast.js` file. \nSimply change the first two strings (`css` and `syntax` vars) and run:\n\n node test/ast.js\n\nPlease remember to also run `make` every time you modify any source files.\n\n## Report\n\nIf you find a bug or want to add a feature, welcome to [Issues](https://github.com/tonyganch/gonzales-pe/issues).\n\nIf you are shy but have a question, feel free to [drop me a\nline](mailto:tonyganch+gonzales@gmail.com).\n", - "readmeFilename": "README.md", - "gitHead": "8d860d993f2a645644c0e5bc0d59951cdb64990b", - "_id": "gonzales-pe@3.0.0-10", - "_shasum": "6dac1b7e4070118042de92c6ff7a8fc346255dde", - "_from": "gonzales-pe@>=3.0.0-0 <3.1.0-0" -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.ast-to-css.js b/node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.ast-to-css.js deleted file mode 100644 index 170b6bf..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.ast-to-css.js +++ /dev/null @@ -1,120 +0,0 @@ -function astToCSS(options) { - var tree, hasInfo, syntax; - if (!options) throw new Error('We need tree to translate'); - tree = typeof options === 'string' ? options : options.ast; - hasInfo = typeof tree[0] === 'object'; - syntax = options.syntax || 'css'; - var _m_simple = { - 'attrselector': 1, 'combinator': 1, 'ident': 1, 'nth': 1, 'number': 1, - 'operator': 1, 'raw': 1, 's': 1, 'string': 1, 'unary': 1, 'unknown': 1 - }, - _m_composite = { - 'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, 'atrules': 1,'condition': 1, - 'declaration': 1, 'dimension': 1, 'filterv': 1, 'include': 1, - 'loop': 1, 'mixin': 1, 'selector': 1, 'progid': 1, 'property': 1, - 'ruleset': 1, 'simpleselector': 1, 'stylesheet': 1, 'value': 1 - }, - _m_primitive = { - 'cdc': 'cdc', 'cdo': 'cdo', - 'declDelim': syntax === 'sass' ? '\n' : ';', - 'delim': ',', - 'namespace': '|', 'parentselector': '&', 'propertyDelim' : ':' - }; - function _t(tree) { - var t = tree[hasInfo? 1 : 0]; - if (t in _m_primitive) return _m_primitive[t]; - else if (t in _m_simple) return _simple(tree); - else if (t in _m_composite) return _composite(tree); - return _unique[t](tree); - } - function _composite(t, i) { - var s = ''; - i = i === undefined ? (hasInfo? 2 : 1) : i; - for (; i < t.length; i++) s += _t(t[i]); - return s; - } - function _simple(t) { - return t[hasInfo? 2 : 1]; - } - var _unique = { - 'arguments': function(t) { - return '(' + _composite(t) + ')'; - }, - 'atkeyword': function(t) { - return '@' + _t(t[hasInfo? 2 : 1]); - }, - 'atruler': function(t) { - return _t(t[hasInfo? 2 : 1]) + _t(t[hasInfo? 3 : 2]) + '{' + _t(t[hasInfo? 4 : 3]) + '}'; - }, - 'attrib': function(t) { - return '[' + _composite(t) + ']'; - }, - 'block': function(t) { - return syntax === 'sass' ? _composite(t) : '{' + _composite(t) + '}'; - }, - 'braces': function(t) { - return t[hasInfo? 2 : 1] + _composite(t, hasInfo? 4 : 3) + t[hasInfo? 3 : 2]; - }, - 'class': function(t) { - return '.' + _t(t[hasInfo? 2 : 1]); - }, - 'commentML': function (t) { - return '/*' + t[hasInfo? 2 : 1] + (syntax === 'sass' ? '' : '*/'); - }, - 'commentSL': function (t) { - return '/' + '/' + t[hasInfo? 2 : 1]; - }, - 'default': function(t) { - return '!' + _composite(t) + 'default'; - }, - 'escapedString': function(t) { - return '~' + t[hasInfo? 2 : 1]; - }, - 'filter': function(t) { - return _t(t[hasInfo? 2 : 1]) + ':' + _t(t[hasInfo? 3 : 2]); - }, - 'functionExpression': function(t) { - return 'expression(' + t[hasInfo? 2 : 1] + ')'; - }, - 'function': function(t) { - return _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t[hasInfo? 3: 2]) + ')'; - }, - 'important': function(t) { - return '!' + _composite(t) + 'important'; - }, - 'interpolatedVariable': function(t) { - return (syntax === 'less' ? '@{' : '#\{$') + _t(t[hasInfo? 2 : 1]) + '}'; - }, - 'nthselector': function(t) { - return ':' + _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t, hasInfo? 3 : 2) + ')'; - }, - 'percentage': function(t) { - return _t(t[hasInfo? 2 : 1]) + '%'; - }, - 'placeholder': function(t) { - return '%' + _t(t[hasInfo? 2 : 1]); - }, - 'pseudoc': function(t) { - return ':' + _t(t[hasInfo? 2 : 1]); - }, - 'pseudoe': function(t) { - return '::' + _t(t[hasInfo? 2 : 1]); - }, - 'shash': function (t) { - return '#' + t[hasInfo? 2 : 1]; - }, - 'uri': function(t) { - return 'url(' + _composite(t) + ')'; - }, - 'variable': function(t) { - return (syntax === 'less' ? '@' : '$') + _t(t[hasInfo? 2 : 1]); - }, - 'variableslist': function(t) { - return _t(t[hasInfo? 2 : 1]) + '...'; - }, - 'vhash': function(t) { - return '#' + t[hasInfo? 2 : 1]; - } - }; - return _t(tree); -} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.css-to-ast.js b/node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.css-to-ast.js deleted file mode 100644 index 8309322..0000000 --- a/node_modules/csscomb/node_modules/gonzales-pe/web/gonzales.css-to-ast.js +++ /dev/null @@ -1,3831 +0,0 @@ -var cssToAST = (function() { - var syntaxes = {}, - s, - needInfo, - tokens, - tokensLength, - tn = 0, - ln = 1, - pos = 0; - function pushToken(type, value) { - tokens.push({ tn: tn++, ln: ln, type: type, value: value }); - } - function throwError(i) { - var ln = i ? tokens[i].ln : tokens[pos].ln; - throw new Error('Please check the validity of the CSS block starting from the line #' + ln); - } - function getInfo(i) { - return { ln: tokens[i].ln, tn: tokens[i].tn }; - } - function checkExcluding(exclude, i) { - var start = i; - while(i < tokensLength) { - if (exclude[tokens[i++].type]) break; - } - return i - start - 2; - } - function joinValues(start, finish) { - var s = ''; - for (var i = start; i < finish + 1; i++) { - s += tokens[i].value; - } - return s; - } - function joinValues2(start, num) { - if (start + num - 1 >= tokensLength) return; - var s = ''; - for (var i = 0; i < num; i++) { - s += tokens[start + i].value; - } - return s; - } -var TokenType = { - StringSQ: 'StringSQ', - StringDQ: 'StringDQ', - CommentML: 'CommentML', - CommentSL: 'CommentSL', - Newline: 'Newline', - Space: 'Space', - Tab: 'Tab', - ExclamationMark: 'ExclamationMark', - QuotationMark: 'QuotationMark', - NumberSign: 'NumberSign', - DollarSign: 'DollarSign', - PercentSign: 'PercentSign', - Ampersand: 'Ampersand', - Apostrophe: 'Apostrophe', - LeftParenthesis: 'LeftParenthesis', - RightParenthesis: 'RightParenthesis', - Asterisk: 'Asterisk', - PlusSign: 'PlusSign', - Comma: 'Comma', - HyphenMinus: 'HyphenMinus', - FullStop: 'FullStop', - Solidus: 'Solidus', - Colon: 'Colon', - Semicolon: 'Semicolon', - LessThanSign: 'LessThanSign', - EqualsSign: 'EqualsSign', - GreaterThanSign: 'GreaterThanSign', - QuestionMark: 'QuestionMark', - CommercialAt: 'CommercialAt', - LeftSquareBracket: 'LeftSquareBracket', - ReverseSolidus: 'ReverseSolidus', - RightSquareBracket: 'RightSquareBracket', - CircumflexAccent: 'CircumflexAccent', - LowLine: 'LowLine', - LeftCurlyBracket: 'LeftCurlyBracket', - VerticalLine: 'VerticalLine', - RightCurlyBracket: 'RightCurlyBracket', - Tilde: 'Tilde', - Identifier: 'Identifier', - DecimalNumber: 'DecimalNumber' -}; -var NodeType = { - ArgumentsType: 'arguments', - AtkeywordType: 'atkeyword', - AtrulebType: 'atruleb', - AtrulerType: 'atruler', - AtrulerqType: 'atrulerq', - AtrulersType: 'atrulers', - AtrulesType: 'atrules', - AttribType: 'attrib', - AttrselectorType: 'attrselector', - BlockType: 'block', - BracesType: 'braces', - CdcType: 'cdc', - CdoType: 'cdo', - ClassType: 'class', - CombinatorType: 'combinator', - CommentMLType: 'commentML', - CommentSLType: 'commentSL', - ConditionType: 'condition', - DeclarationType: 'declaration', - DeclDelimType: 'declDelim', - DefaultType: 'default', - DelimType: 'delim', - DimensionType: 'dimension', - EscapedStringType: 'escapedString', - FilterType: 'filter', - FiltervType: 'filterv', - FunctionType: 'function', - FunctionBodyType: 'functionBody', - FunctionExpressionType: 'functionExpression', - IdentType: 'ident', - ImportantType: 'important', - IncludeType :'include', - InterpolatedVariableType: 'interpolatedVariable', - LoopType: 'loop', - MixinType: 'mixin', - NamespaceType: 'namespace', - NthType: 'nth', - NthselectorType: 'nthselector', - NumberType: 'number', - OperatorType: 'operator', - ParentSelectorType: 'parentselector', - PercentageType: 'percentage', - PlaceholderType: 'placeholder', - ProgidType: 'progid', - PropertyType: 'property', - PropertyDelimType: 'propertyDelim', - PseudocType: 'pseudoc', - PseudoeType: 'pseudoe', - RawType: 'raw', - RulesetType: 'ruleset', - SType: 's', - SelectorType: 'selector', - ShashType: 'shash', - SimpleselectorType: 'simpleselector', - StringType: 'string', - StylesheetType: 'stylesheet', - UnaryType: 'unary', - UnknownType: 'unknown', - UriType: 'uri', - ValueType: 'value', - VariableType: 'variable', - VariablesListType: 'variableslist', - VhashType: 'vhash' -}; -var getTokens = (function() { - var Punctuation, - urlMode = false, - blockMode = 0; - Punctuation = { - ' ': TokenType.Space, - '\n': TokenType.Newline, - '\r': TokenType.Newline, - '\t': TokenType.Tab, - '!': TokenType.ExclamationMark, - '"': TokenType.QuotationMark, - '#': TokenType.NumberSign, - '$': TokenType.DollarSign, - '%': TokenType.PercentSign, - '&': TokenType.Ampersand, - '\'': TokenType.Apostrophe, - '(': TokenType.LeftParenthesis, - ')': TokenType.RightParenthesis, - '*': TokenType.Asterisk, - '+': TokenType.PlusSign, - ',': TokenType.Comma, - '-': TokenType.HyphenMinus, - '.': TokenType.FullStop, - '/': TokenType.Solidus, - ':': TokenType.Colon, - ';': TokenType.Semicolon, - '<': TokenType.LessThanSign, - '=': TokenType.EqualsSign, - '>': TokenType.GreaterThanSign, - '?': TokenType.QuestionMark, - '@': TokenType.CommercialAt, - '[': TokenType.LeftSquareBracket, - ']': TokenType.RightSquareBracket, - '^': TokenType.CircumflexAccent, - '_': TokenType.LowLine, - '{': TokenType.LeftCurlyBracket, - '|': TokenType.VerticalLine, - '}': TokenType.RightCurlyBracket, - '~': TokenType.Tilde - }; - function isDecimalDigit(c) { - return '0123456789'.indexOf(c) >= 0; - } - function parseSpaces(css) { - var start = pos; - for (; pos < css.length; pos++) { - if (css.charAt(pos) !== ' ') break; - } - pushToken(TokenType.Space, css.substring(start, pos)); - pos--; - } - function parseString(css, q) { - var start = pos; - for (pos = pos + 1; pos < css.length; pos++) { - if (css.charAt(pos) === '\\') pos++; - else if (css.charAt(pos) === q) break; - } - pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1)); - } - function parseDecimalNumber(css) { - var start = pos; - for (; pos < css.length; pos++) { - if (!isDecimalDigit(css.charAt(pos))) break; - } - pushToken(TokenType.DecimalNumber, css.substring(start, pos)); - pos--; - } - function parseIdentifier(css) { - var start = pos; - while (css.charAt(pos) === '/') pos++; - for (; pos < css.length; pos++) { - if (css.charAt(pos) === '\\') pos++; - else if (css.charAt(pos) in Punctuation) break; - } - var ident = css.substring(start, pos); - urlMode = urlMode || ident === 'url'; - pushToken(TokenType.Identifier, ident); - pos--; - } - function _getTokens(css, syntax) { - var c, - cn; - tokens = []; - pos = 0; - tn = 0; - ln = 1; - for (pos = 0; pos < css.length; pos++) { - c = css.charAt(pos); - cn = css.charAt(pos + 1); - if (c === '/' && cn === '*') { - s.parseMLComment(css); - } - else if (!urlMode && c === '/' && cn === '/') { - if (syntax === 'css' && blockMode > 0) parseIdentifier(css); - else s.parseSLComment && s.parseSLComment(css); - } - else if (c === '"' || c === "'") { - parseString(css, c); - } - else if (c === ' ') { - parseSpaces(css) - } - else if (c in Punctuation) { - pushToken(Punctuation[c], c); - if (c === '\n' || c === '\r') ln++; - if (c === ')') urlMode = false; - if (c === '{') blockMode++; - if (c === '}') blockMode--; - } - else if (isDecimalDigit(c)) { - parseDecimalNumber(css); - } - else { - parseIdentifier(css); - } - } - } - return function(s, syntax) { - return _getTokens(s, syntax); - }; -}()); -var rules = { - 'arguments': function() { if (s.checkArguments(pos)) return s.getArguments() }, - 'atkeyword': function() { if (s.checkAtkeyword(pos)) return s.getAtkeyword() }, - 'atruleb': function() { if (s.checkAtruleb(pos)) return s.getAtruleb() }, - 'atruler': function() { if (s.checkAtruler(pos)) return s.getAtruler() }, - 'atrulerq': function() { if (s.checkAtrulerq(pos)) return s.getAtrulerq() }, - 'atrulers': function() { if (s.checkAtrulers(pos)) return s.getAtrulers() }, - 'atrules': function() { if (s.checkAtrules(pos)) return s.getAtrules() }, - 'attrib': function() { if (s.checkAttrib(pos)) return s.getAttrib() }, - 'attrselector': function() { if (s.checkAttrselector(pos)) return s.getAttrselector() }, - 'block': function() { if (s.checkBlock(pos)) return s.getBlock() }, - 'braces': function() { if (s.checkBraces(pos)) return s.getBraces() }, - 'class': function() { if (s.checkClass(pos)) return s.getClass() }, - 'combinator': function() { if (s.checkCombinator(pos)) return s.getCombinator() }, - 'commentML': function() { if (s.checkCommentML(pos)) return s.getCommentML() }, - 'commentSL': function() { if (s.checkCommentSL(pos)) return s.getCommentSL() }, - 'condition': function() { if (s.checkCondition(pos)) return s.getCondition() }, - 'declaration': function() { if (s.checkDeclaration(pos)) return s.getDeclaration() }, - 'declDelim': function() { if (s.checkDeclDelim(pos)) return s.getDeclDelim() }, - 'default': function () { if (s.checkDefault(pos)) return s.getDefault() }, - 'delim': function() { if (s.checkDelim(pos)) return s.getDelim() }, - 'dimension': function() { if (s.checkDimension(pos)) return s.getDimension() }, - 'escapedString': function() { if (s.checkEscapedString(pos)) return s.getEscapedString() }, - 'filter': function() { if (s.checkFilter(pos)) return s.getFilter() }, - 'filterv': function() { if (s.checkFilterv(pos)) return s.getFilterv() }, - 'functionExpression': function() { if (s.checkFunctionExpression(pos)) return s.getFunctionExpression() }, - 'function': function() { if (s.checkFunction(pos)) return s.getFunction() }, - 'ident': function() { if (s.checkIdent(pos)) return s.getIdent() }, - 'important': function() { if (s.checkImportant(pos)) return s.getImportant() }, - 'include': function () { if (s.checkInclude(pos)) return s.getInclude() }, - 'interpolatedVariable': function () { if (s.checkInterpolatedVariable(pos)) return s.getInterpolatedVariable() }, - 'loop': function() { if (s.checkLoop(pos)) return s.getLoop() }, - 'mixin': function () { if (s.checkMixin(pos)) return s.getMixin() }, - 'namespace': function() { if (s.checkNamespace(pos)) return s.getNamespace() }, - 'nth': function() { if (s.checkNth(pos)) return s.getNth() }, - 'nthselector': function() { if (s.checkNthselector(pos)) return s.getNthselector() }, - 'number': function() { if (s.checkNumber(pos)) return s.getNumber() }, - 'operator': function() { if (s.checkOperator(pos)) return s.getOperator() }, - 'parentselector': function () { if (s.checkParentSelector(pos)) return s.getParentSelector() }, - 'percentage': function() { if (s.checkPercentage(pos)) return s.getPercentage() }, - 'placeholder': function() { if (s.checkPlaceholder(pos)) return s.getPlaceholder() }, - 'progid': function() { if (s.checkProgid(pos)) return s.getProgid() }, - 'property': function() { if (s.checkProperty(pos)) return s.getProperty() }, - 'propertyDelim': function() { if (s.checkPropertyDelim(pos)) return s.getPropertyDelim() }, - 'pseudoc': function() { if (s.checkPseudoc(pos)) return s.getPseudoc() }, - 'pseudoe': function() { if (s.checkPseudoe(pos)) return s.getPseudoe() }, - 'ruleset': function() { if (s.checkRuleset(pos)) return s.getRuleset() }, - 's': function() { if (s.checkS(pos)) return s.getS() }, - 'selector': function() { if (s.checkSelector(pos)) return s.getSelector() }, - 'shash': function() { if (s.checkShash(pos)) return s.getShash() }, - 'simpleselector': function() { if (s.checkSimpleSelector(pos)) return s.getSimpleSelector() }, - 'string': function() { if (s.checkString(pos)) return s.getString() }, - 'stylesheet': function() { if (s.checkStylesheet(pos)) return s.getStylesheet() }, - 'unary': function() { if (s.checkUnary(pos)) return s.getUnary() }, - 'unknown': function() { if (s.checkUnknown(pos)) return s.getUnknown() }, - 'uri': function() { if (s.checkUri(pos)) return s.getUri() }, - 'value': function() { if (s.checkValue(pos)) return s.getValue() }, - 'variable': function () { if (s.checkVariable(pos)) return s.getVariable() }, - 'variableslist': function () { if (s.checkVariablesList(pos)) return s.getVariablesList() }, - 'vhash': function() { if (s.checkVhash(pos)) return s.getVhash() } -}; -syntaxes.css = { - checkAny: function(i) { - return this.checkBraces(i) || - this.checkString(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkFunctionExpression(i) || - this.checkFunction(i) || - this.checkIdent(i) || - this.checkClass(i) || - this.checkUnary(i); - }, - getAny: function() { - if (this.checkBraces(pos)) return this.getBraces(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkFunctionExpression(pos)) return this.getFunctionExpression(); - else if (this.checkFunction(pos)) return this.getFunction(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - else if (this.checkUnary(pos)) return this.getUnary(); - }, - checkAtkeyword: function(i) { - var l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.CommercialAt) return 0; - return (l = this.checkIdent(i)) ? l + 1 : 0; - }, - getAtkeyword: function() { - var startPos = pos, - x; - pos++; - x = [NodeType.AtkeywordType, this.getIdent()]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAttrib: function(i) { - if (i >= tokensLength || - tokens[i].type !== TokenType.LeftSquareBracket || - !tokens[i].right) return 0; - return tokens[i].right - i + 1; - }, - getAttrib: function() { - if (this.checkAttrib1(pos)) return this.getAttrib1(); - if (this.checkAttrib2(pos)) return this.getAttrib2(); - }, - checkAttrib1: function(i) { - var start = i, - l; - if (i++ >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkAttrselector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i) || this.checkString(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; - }, - getAttrib1: function() { - var startPos = pos, - x; - pos++; - x = [NodeType.AttribType] - .concat(this.getSC()) - .concat([this.getIdent()]) - .concat(this.getSC()) - .concat([this.getAttrselector()]) - .concat(this.getSC()) - .concat([this.checkString(pos)? this.getString() : this.getIdent()]) - .concat(this.getSC()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAttrib2: function(i) { - var start = i, - l; - if (i++ >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; - }, - getAttrib2: function() { - var startPos = pos, - x; - pos++; - x = [NodeType.AttribType] - .concat(this.getSC()) - .concat([this.getIdent()]) - .concat(this.getSC()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAttrselector: function(i) { - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.EqualsSign) return 1; - if (tokens[i].type === TokenType.VerticalLine && - (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign)) - return 1; - if (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign) return 0; - switch(tokens[i].type) { - case TokenType.Tilde: - case TokenType.CircumflexAccent: - case TokenType.DollarSign: - case TokenType.Asterisk: - case TokenType.VerticalLine: - return 2; - } - return 0; - }, - getAttrselector: function() { - var startPos = pos, - s = tokens[pos++].value, - x; - if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) s += tokens[pos++].value; - x = [NodeType.AttrselectorType, s]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrule: function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l; - if (l = this.checkAtruler(i)) tokens[i].atrule_type = 1; - else if (l = this.checkAtruleb(i)) tokens[i].atrule_type = 2; - else if (l = this.checkAtrules(i)) tokens[i].atrule_type = 3; - else return 0; - tokens[i].atrule_l = l; - return l; - }, - getAtrule: function() { - switch (tokens[pos].atrule_type) { - case 1: return this.getAtruler(); - case 2: return this.getAtruleb(); - case 3: return this.getAtrules(); - } - }, - checkAtruleb: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (l = this.checkTsets(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - return i - start; - }, - getAtruleb: function() { - var startPos = pos, - x; - x = [NodeType.AtrulebType, this.getAtkeyword()] - .concat(this.getTsets()) - .concat([this.getBlock()]); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtruler: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (l = this.checkAtrulerq(i)) i += l; - if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++; - else return 0; - if (l = this.checkAtrulers(i)) i += l; - if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++; - else return 0; - return i - start; - }, - getAtruler: function() { - var startPos = pos, - x; - x = [NodeType.AtrulerType, this.getAtkeyword(), this.getAtrulerq()]; - pos++; - x.push(this.getAtrulers()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrulerq: function(i) { - return this.checkTsets(i); - }, - getAtrulerq: function() { - var startPos = pos, - x; - x = [NodeType.AtrulerqType].concat(this.getTsets()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrulers: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - while (l = this.checkRuleset(i) || this.checkAtrule(i) || this.checkSC(i)) { - i += l; - } - tokens[i].atrulers_end = 1; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getAtrulers: function() { - var startPos = pos, - x; - x = [NodeType.AtrulersType].concat(this.getSC()); - while (!tokens[pos].atrulers_end) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else x.push(this.getAtrule()); - } - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkAtrules: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (l = this.checkTsets(i)) i += l; - return i - start; - }, - getAtrules: function() { - var startPos = pos, - x; - x = [NodeType.AtrulesType, this.getAtkeyword()].concat(this.getTsets()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkBlock: function(i) { - return i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket ? - tokens[i].right - i + 1 : 0; - }, - getBlock: function() { - var startPos = pos, - end = tokens[pos].right, - x = [NodeType.BlockType]; - pos++; - while (pos < end) { - if (this.checkBlockdecl(pos)) x = x.concat(this.getBlockdecl()); - else throwError(); - } - pos = end + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkBlockdecl: function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkBlockdecl1(i)) tokens[i].bd_type = 1; - else if (l = this.checkBlockdecl2(i)) tokens[i].bd_type = 2; - else if (l = this.checkBlockdecl3(i)) tokens[i].bd_type = 3; - else if (l = this.checkBlockdecl4(i)) tokens[i].bd_type = 4; - else return 0; - return l; - }, - getBlockdecl: function() { - switch (tokens[pos].bd_type) { - case 1: return this.getBlockdecl1(); - case 2: return this.getBlockdecl2(); - case 3: return this.getBlockdecl3(); - case 4: return this.getBlockdecl4(); - } - }, - checkBlockdecl1: function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkFilter(i)) tokens[i].bd_kind = 1; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 2; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 3; - else return 0; - i += l; - if (i < tokensLength && (l = this.checkDeclDelim(i))) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - return i - start; - }, - getBlockdecl1: function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getFilter(); - break; - case 2: - x = this.getDeclaration(); - break; - case 3: - x = this.getAtrule(); - break; - } - return sc - .concat([x]) - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }, - checkBlockdecl2: function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkFilter(i)) tokens[i].bd_kind = 1; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 2; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 3; - else return 0; - i += l; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getBlockdecl2: function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getFilter(); - break; - case 2: - x = this.getDeclaration(); - break; - case 3: - x = this.getAtrule(); - break; - } - return sc - .concat([x]) - .concat(this.getSC()); - }, - checkBlockdecl3: function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkDeclDelim(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getBlockdecl3: function() { - return this.getSC() - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }, - checkBlockdecl4: function(i) { - return this.checkSC(i); - }, - getBlockdecl4: function() { - return this.getSC(); - }, - checkBraces: function(i) { - if (i >= tokensLength || - (tokens[i].type !== TokenType.LeftParenthesis && - tokens[i].type !== TokenType.LeftSquareBracket)) return 0; - return tokens[i].right - i + 1; - }, - getBraces: function() { - var startPos = pos, - left = pos, - right = tokens[pos].right, - x; - pos++; - var tsets = this.getTsets(); - pos++; - x = [NodeType.BracesType, tokens[left].value, tokens[right].value] - .concat(tsets); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkClass: function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && (l = this.checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; - } - return 0; - }, - getClass: function() { - var startPos = pos, - x = [NodeType.ClassType]; - pos++; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkCombinator: function(i) { - if (i >= tokensLength) return 0; - switch (tokens[i].type) { - case TokenType.PlusSign: - case TokenType.GreaterThanSign: - case TokenType.Tilde: - return 1; - } - return 0; - }, - getCombinator: function() { - var startPos = pos, - x; - x = [NodeType.CombinatorType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkCommentML: function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0; - }, - getCommentML: function() { - var startPos = pos, - s = tokens[pos].value.substring(2), - l = s.length, - x; - if (s.charAt(l - 2) === '*' && s.charAt(l - 1) === '/') s = s.substring(0, l - 2); - pos++; - x = [NodeType.CommentMLType, s]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDeclaration: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkProperty(i)) i += l; - else return 0; - if (l = this.checkPropertyDelim(i)) i++; - else return 0; - if (l = this.checkValue(i)) i += l; - else return 0; - return i - start; - }, - getDeclaration: function() { - var startPos = pos, - x = [NodeType.DeclarationType]; - x.push(this.getProperty()); - x.push(this.getPropertyDelim()); - x.push(this.getValue()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDeclDelim: function(i) { - return i < tokensLength && tokens[i].type === TokenType.Semicolon ? 1 : 0; - }, - getDeclDelim: function() { - var startPos = pos, - x = [NodeType.DeclDelimType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDelim: function(i) { - return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0; - }, - getDelim: function() { - var startPos = pos, - x = [NodeType.DelimType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkDimension: function(i) { - var ln = this.checkNumber(i), - li; - if (i >= tokensLength || - !ln || - i + ln >= tokensLength) return 0; - return (li = this.checkNmName2(i + ln)) ? ln + li : 0; - }, - getDimension: function() { - var startPos = pos, - x = [NodeType.DimensionType, this.getNumber()], - ident = [NodeType.IdentType, this.getNmName2()]; - if (needInfo) ident.unshift(getInfo(startPos)); - x.push(ident); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFilter: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkFilterp(i)) i += l; - else return 0; - if (tokens[i].type === TokenType.Colon) i++; - else return 0; - if (l = this.checkFilterv(i)) i += l; - else return 0; - return i - start; - }, - getFilter: function() { - var startPos = pos, - x = [NodeType.FilterType, this.getFilterp()]; - pos++; - x.push(this.getFilterv()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFilterp: function(i) { - var start = i, - l, - x; - if (i >= tokensLength) return 0; - if (tokens[i].value === 'filter') l = 1; - else { - x = joinValues2(i, 2); - if (x === '-filter' || x === '_filter' || x === '*filter') l = 2; - else { - x = joinValues2(i, 4); - if (x === '-ms-filter') l = 4; - else return 0; - } - } - tokens[start].filterp_l = l; - i += l; - if (this.checkSC(i)) i += l; - return i - start; - }, - getFilterp: function() { - var startPos = pos, - ident = [NodeType.IdentType, joinValues2(pos, tokens[pos].filterp_l)], - x; - if (needInfo) ident.unshift(getInfo(startPos)); - pos += tokens[pos].filterp_l; - x = [NodeType.PropertyType, ident].concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFilterv: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkProgid(i)) i += l; - else return 0; - while (l = this.checkProgid(i)) { - i += l; - } - tokens[start].last_progid = i; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }, - getFilterv: function() { - var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - x = x.concat(this.getSC()); - while (pos < last_progid) { - x.push(this.getProgid()); - } - if (this.checkSC(pos)) x = x.concat(this.getSC()); - if (pos < tokensLength && this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFunctionExpression: function(i) { - var start = i; - if (i >= tokensLength || tokens[i++].value !== 'expression' || - i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0; - return tokens[i].right - start + 1; - }, - getFunctionExpression: function() { - var startPos = pos, - x, e; - pos++; - e = joinValues(pos + 1, tokens[pos].right - 1); - pos = tokens[pos].right + 1; - x = [NodeType.FunctionExpressionType, e]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkFunction: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkIdent(i)) i +=l; - else return 0; - return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? - tokens[i].right - start + 1 : 0; - }, - getFunction: function() { - var startPos = pos, - ident = this.getIdent(), - x = [NodeType.FunctionType, ident], - body; - pos++; - body = ident[needInfo ? 2 : 1] === 'not' ? this.getNotFunctionBody() : this.getFunctionBody(); - x.push(body); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - getFunctionBody: function() { - var startPos = pos, - x = [NodeType.FunctionBodyType], - body; - while (tokens[pos].type !== TokenType.RightParenthesis) { - if (this.checkDeclaration(pos)) x.push(this.getDeclaration()); - else if (this.checkTset(pos)) { - body = this.getTset(); - if ((needInfo && typeof body[1] === 'string') || typeof body[0] === 'string') x.push(body); - else x = x.concat(body); - } else if (this.checkClass(pos)) x.push(this.getClass()); - else throwError(); - } - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - getNotFunctionBody: function() { - var startPos = pos, - x = [NodeType.FunctionBodyType]; - while (tokens[pos].type !== TokenType.RightParenthesis) { - if (this.checkSimpleSelector(pos)) x.push(this.getSimpleSelector()); - else throwError(); - } - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkIdent: function(i) { - var start = i, - wasIdent, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.LowLine) return this.checkIdentLowLine(i); - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DollarSign || - tokens[i].type === TokenType.Asterisk) i++; - else return 0; - wasIdent = tokens[i - 1].type === TokenType.Identifier; - for (; i < tokensLength; i++) { - if (i >= tokensLength) break; - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine) { - if (tokens[i].type !== TokenType.Identifier && - (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; - else wasIdent = true; - } - } - if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; - tokens[start].ident_last = i - 1; - return i - start; - }, - checkIdentLowLine: function(i) { - var start = i; - if (i++ >= tokensLength) return 0; - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.DecimalNumber && - tokens[i].type !== TokenType.LowLine && - tokens[i].type !== TokenType.Identifier) break; - } - tokens[start].ident_last = i - 1; - return i - start; - }, - getIdent: function() { - var startPos = pos, - x = [NodeType.IdentType, joinValues(pos, tokens[pos].ident_last)]; - pos = tokens[pos].ident_last + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkImportant: function(i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.ExclamationMark) return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].value === 'important' ? i - start + 1 : 0; - }, - getImportant: function() { - var startPos = pos, - x = [NodeType.ImportantType]; - pos++; - x = x.concat(this.getSC()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNamespace: function(i) { - return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0; - }, - getNamespace: function() { - var startPos = pos, - x = [NodeType.NamespaceType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNmName: function(i) { - var start = i; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.LowLine || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DecimalNumber) i++; - else return 0; - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine && - tokens[i].type !== TokenType.Identifier && - tokens[i].type !== TokenType.DecimalNumber) break; - } - tokens[start].nm_name_last = i - 1; - return i - start; - }, - getNmName: function() { - var s = joinValues(pos, tokens[pos].nm_name_last); - pos = tokens[pos].nm_name_last + 1; - return s; - }, - checkNmName2: function(i) { - if (tokens[i].type === TokenType.Identifier) return 1; - else if (tokens[i].type !== TokenType.DecimalNumber) return 0; - i++; - return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1; - }, - getNmName2: function() { - var s = tokens[pos].value; - if (tokens[pos++].type === TokenType.DecimalNumber && - pos < tokensLength && - tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value; - return s; - }, - checkNth: function(i) { - if (i >= tokensLength) return 0; - return this.checkNth1(i) || this.checkNth2(i); - }, - checkNth1: function(i) { - var start = i; - for (; i < tokensLength; i++) { - if (tokens[i].type !== TokenType.DecimalNumber && - tokens[i].value !== 'n') break; - } - if (i !== start) tokens[start].nth_last = i - 1; - return i - start; - }, - getNth: function() { - var startPos = pos, - x = [NodeType.NthType]; - if (tokens[pos].nth_last) { - x.push(joinValues(pos, tokens[pos].nth_last)); - pos = tokens[pos].nth_last + 1; - } else { - x.push(tokens[pos++].value); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNth2: function(i) { - return tokens[i].value === 'even' || tokens[i].value === 'odd' ? 1 : 0; - }, - checkNthf: function(i) { - var start = i, - l = 0; - if (tokens[i++].type !== TokenType.Colon) return 0; - l++; - if (tokens[i++].value !== 'nth' || tokens[i++].value !== '-') return 0; - l += 2; - if ('child' === tokens[i].value) { - l += 1; - } else if ('last-child' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value) { - l += 3; - } else if ('of-type' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value) { - l += 3; - } else if ('last-of-type' === tokens[i].value + - tokens[i + 1].value + - tokens[i + 2].value + - tokens[i + 3].value + - tokens[i + 4].value) { - l += 5; - } else return 0; - tokens[start + 1].nthf_last = start + l - 1; - return l; - }, - getNthf: function() { - pos++; - var s = joinValues(pos, tokens[pos].nthf_last); - pos = tokens[pos].nthf_last + 1; - return s; - }, - checkNthselector: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkNthf(i)) i += l; - else return 0; - if (tokens[i].type !== TokenType.LeftParenthesis || !tokens[i].right) return 0; - l++; - var rp = tokens[i++].right; - while (i < rp) { - if (l = this.checkSC(i) || - this.checkUnary(i) || - this.checkNth(i)) i += l; - else return 0; - } - return rp - start + 1; - }, - getNthselector: function() { - var startPos = pos, - nthf = [NodeType.IdentType, this.getNthf()], - x = [NodeType.NthselectorType]; - if (needInfo) nthf.unshift(getInfo(startPos)); - x.push(nthf); - pos++; - while (tokens[pos].type !== TokenType.RightParenthesis) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkUnary(pos)) x.push(this.getUnary()); - else if (this.checkNth(pos)) x.push(this.getNth()); - } - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkNumber: function(i) { - if (i >= tokensLength) return 0; - if (tokens[i].number_l) return tokens[i].number_l; - if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && - (!tokens[i + 1] || - (tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop))) - return (tokens[i].number_l = 1, tokens[i].number_l); - if (i < tokensLength && - tokens[i].type === TokenType.DecimalNumber && - tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && - (!tokens[i + 2] || (tokens[i + 2].type !== TokenType.DecimalNumber))) - return (tokens[i].number_l = 2, tokens[i].number_l); - if (i < tokensLength && - tokens[i].type === TokenType.FullStop && - tokens[i + 1].type === TokenType.DecimalNumber) - return (tokens[i].number_l = 2, tokens[i].number_l); - if (i < tokensLength && - tokens[i].type === TokenType.DecimalNumber && - tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && - tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) - return (tokens[i].number_l = 3, tokens[i].number_l); - return 0; - }, - getNumber: function() { - var s = '', - startPos = pos, - l = tokens[pos].number_l, - x = [NodeType.NumberType]; - for (var j = 0; j < l; j++) { - s += tokens[pos + j].value; - } - pos += l; - x.push(s); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkOperator: function(i) { - if (i >= tokensLength) return 0; - switch(tokens[i].type) { - case TokenType.Solidus: - case TokenType.Comma: - case TokenType.Colon: - case TokenType.EqualsSign: - return 1; - } - return 0; - }, - getOperator: function() { - var startPos = pos, - x = [NodeType.OperatorType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPercentage: function(i) { - var x; - if (i >= tokensLength) return 0; - x = this.checkNumber(i); - if (!x || i + x >= tokensLength) return 0; - return tokens[i + x].type === TokenType.PercentSign ? x + 1 : 0; - }, - getPercentage: function() { - var startPos = pos, - x = [NodeType.PercentageType, this.getNumber()]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkProgid: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6; - else return 0; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (tokens[i].type === TokenType.LeftParenthesis) { - tokens[start].progid_end = tokens[i].right; - i = tokens[i].right + 1; - } else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getProgid: function() { - var startPos = pos, - progid_end = tokens[pos].progid_end, - x; - x = [NodeType.ProgidType] - .concat(this.getSC()) - .concat([this._getProgid(progid_end)]) - .concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - _getProgid: function(progid_end) { - var startPos = pos, - x = [NodeType.RawType, joinValues(pos, progid_end)]; - pos = progid_end + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkProperty: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - getProperty: function() { - var startPos = pos, - x = [NodeType.PropertyType]; - x.push(this.getIdent()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPropertyDelim: function(i) { - return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0; - }, - getPropertyDelim: function() { - var startPos = pos, - x = [NodeType.PropertyDelimType]; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPseudo: function(i) { - return this.checkPseudoe(i) || - this.checkPseudoc(i); - }, - getPseudo: function() { - if (this.checkPseudoe(pos)) return this.getPseudoe(); - if (this.checkPseudoc(pos)) return this.getPseudoc(); - }, - checkPseudoe: function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || - i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkIdent(i)) ? l + 2 : 0; - }, - getPseudoe: function() { - var startPos = pos, - x = [NodeType.PseudoeType]; - pos += 2; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkPseudoc: function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkFunction(i) || this.checkIdent(i)) ? l + 1 : 0; - }, - getPseudoc: function() { - var startPos = pos, - x = [NodeType.PseudocType]; - pos ++; - x.push(this.checkFunction(pos) ? this.getFunction() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkRuleset: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[start].ruleset_l) return tokens[start].ruleset_l; - while (i < tokensLength) { - if (l = this.checkBlock(i)) {i += l; break;} - else if (l = this.checkSelector(i)) i += l; - else return 0; - } - tokens[start].ruleset_l = i - start; - return i - start; - }, - getRuleset: function() { - var startPos = pos, - x = [NodeType.RulesetType]; - while (pos < tokensLength) { - if (this.checkBlock(pos)) {x.push(this.getBlock()); break;} - else if (this.checkSelector(pos)) x.push(this.getSelector()); - else break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkS: function(i) { - return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0; - }, - getS: function() { - var startPos = pos, - x = [NodeType.SType, joinValues(pos, tokens[pos].ws_last)]; - pos = tokens[pos].ws_last + 1; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkSC: function(i) { - var l, - lsc = 0; - while (i < tokensLength) { - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }, - getSC: function() { - var sc = []; - if (pos >= tokensLength) return sc; - while (pos < tokensLength) { - if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else break; - } - return sc; - }, - checkSelector: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector(i) || this.checkDelim(i)) i += l; - else break; - } - if (i !== start) tokens[start].selector_end = i - 1; - return i - start; - }, - getSelector: function() { - var startPos = pos, - x = [NodeType.SelectorType], - selector_end = tokens[pos].selector_end; - while (pos <= selector_end) { - x.push(this.checkDelim(pos) ? this.getDelim() : this.getSimpleSelector()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkShash: function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; - return (l = this.checkNmName(i + 1)) ? l + 1 : 0; - }, - getShash: function() { - var startPos = pos, - x = [NodeType.ShashType]; - pos++; - x.push(this.getNmName()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkSimpleSelector: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector1(i)) i += l; - else break; - } - return i - start; - }, - getSimpleSelector: function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t; - while (pos < tokensLength) { - if (!this.checkSimpleSelector1(pos)) break; - t = this.getSimpleSelector1(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkSimpleSelector1: function(i) { - return this.checkNthselector(i) || - this.checkCombinator(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkNamespace(i); - }, - getSimpleSelector1: function() { - if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkCombinator(pos)) return this.getCombinator(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkNamespace(pos)) return this.getNamespace(); - }, - checkString: function(i) { - return i < tokensLength && (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) ? 1 : 0; - }, - getString: function() { - var startPos = pos, - x = [NodeType.StringType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkStylesheet: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSC(i) || - this.checkDeclDelim(i) || - this.checkAtrule(i) || - this.checkRuleset(i) || - this.checkUnknown(i)) i += l; - else throwError(i); - } - return i - start; - }, - getStylesheet: function() { - var startPos = pos, - x = [NodeType.StylesheetType]; - while (pos < tokensLength) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else if (this.checkAtrule(pos)) x.push(this.getAtrule()); - else if (this.checkDeclDelim(pos)) x.push(this.getDeclDelim()); - else if (this.checkUnknown(pos)) x.push(this.getUnknown()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkTset: function(i) { - return this.checkVhash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkOperator(i); - }, - getTset: function() { - if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkOperator(pos)) return this.getOperator(); - }, - checkTsets: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - while (l = this.checkTset(i)) { - i += l; - } - return i - start; - }, - getTsets: function() { - var x = [], - t; - while (t = this.getTset()) { - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return x; - }, - checkUnary: function(i) { - return i < tokensLength && (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) ? 1 : 0; - }, - getUnary: function() { - var startPos = pos, - x = [NodeType.UnaryType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkUnknown: function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0; - }, - getUnknown: function() { - var startPos = pos, - x = [NodeType.UnknownType, tokens[pos++].value]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - checkUri: function(i) { - var start = i; - if (i >= tokensLength || tokens[i++].value !== 'url' || - i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) - return 0; - return tokens[i].right - start + 1; - }, - getUri: function() { - var startPos = pos, - uriExcluding = {}, - uri, - l, - raw; - pos += 2; - uriExcluding[TokenType.Space] = 1; - uriExcluding[TokenType.Tab] = 1; - uriExcluding[TokenType.Newline] = 1; - uriExcluding[TokenType.LeftParenthesis] = 1; - uriExcluding[TokenType.RightParenthesis] = 1; - if (this.checkUri1(pos)) { - uri = [NodeType.UriType] - .concat(this.getSC()) - .concat([this.getString()]) - .concat(this.getSC()); - pos++; - } else { - uri = [NodeType.UriType].concat(this.getSC()), - l = checkExcluding(uriExcluding, pos), - raw = [NodeType.RawType, joinValues(pos, pos + l)]; - if (needInfo) raw.unshift(getInfo(startPos)); - uri.push(raw); - pos += l + 1; - uri = uri.concat(this.getSC()); - pos++; - } - return needInfo ? (uri.unshift(getInfo(startPos)), uri) : uri; - }, - checkUri1: function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (tokens[i].type !== TokenType.StringDQ && tokens[i].type !== TokenType.StringSQ) return 0; - i++; - if (l = this.checkSC(i)) i += l; - return i - start; - }, - checkValue: function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this._checkValue(i)) i += l; - else break; - } - return i - start; - }, - _checkValue: function(i) { - return this.checkSC(i) || - this.checkVhash(i) || - this.checkAny(i) || - this.checkOperator(i) || - this.checkImportant(i); - }, - getValue: function() { - var startPos = pos, - x = [NodeType.ValueType], - t, - _pos; - while (pos < tokensLength) { - _pos = pos; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - _getValue: function() { - if (this.checkSC(pos)) return this.getSC(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - }, - checkVhash: function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; - return (l = this.checkNmName2(i + 1)) ? l + 1 : 0; - }, - getVhash: function() { - var startPos = pos, - x = [NodeType.VhashType]; - pos++; - x.push(this.getNmName2()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - markSC: function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.CommentML: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }, - markBrackets: function() { - var ps = [], - sbs = [], - cbs = [], - t; - for (var i = 0; i < tokens.length; i++) { - t = tokens[i]; - switch(t.type) { - case TokenType.LeftParenthesis: - ps.push(i); - break; - case TokenType.RightParenthesis: - if (ps.length) { - t.left = ps.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftSquareBracket: - sbs.push(i); - break; - case TokenType.RightSquareBracket: - if (sbs.length) { - t.left = sbs.pop(); - tokens[t.left].right = i; - } - break; - case TokenType.LeftCurlyBracket: - cbs.push(i); - break; - case TokenType.RightCurlyBracket: - if (cbs.length) { - t.left = cbs.pop(); - tokens[t.left].right = i; - } - break; - } - } - }, - parseMLComment: function(css) { - var start = pos; - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') { - pos++; - break; - } - } - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); - }, - parseSLComment: function(css) { - var start = pos; - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { - break; - } - } - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; - } -}; -(function() { - var scss = Object.create(syntaxes.css); - scss.checkAny = function(i) { - return this.checkBraces(i) || - this.checkString(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkPlaceholder(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkFunctionExpression(i) || - this.checkFunction(i) || - this.checkIdent(i) || - this.checkClass(i) || - this.checkUnary(i); - }; - scss.getAny = function() { - if (this.checkBraces(pos)) return this.getBraces(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkPlaceholder(pos)) return this.getPlaceholder(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkFunctionExpression(pos)) return this.getFunctionExpression(); - else if (this.checkFunction(pos)) return this.getFunction(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - else if (this.checkUnary(pos)) return this.getUnary(); - }; - scss.checkArguments = function (i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i].type !== TokenType.LeftParenthesis) return 0; - i++; - while (i < tokens[start].right) { - if (l = this.checkArgument(i)) i +=l; - else return 0; - } - return tokens[start].right - start + 1; - }; - scss.getArguments = function() { - var startPos = pos, - arguments = [], - x; - pos++; - while (x = this.getArgument()) { - if ((needInfo && typeof x[1] === 'string') || typeof x[0] === 'string') arguments.push(x); - else arguments = arguments.concat(x); - } - pos++; - x = [NodeType.ArgumentsType].concat(arguments); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkArgument = function(i) { - return this.checkDeclaration(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkSC(i) || - this.checkDelim(i) || - this.checkDeclDelim(i) || - this.checkString(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkIdent(i) || - this.checkVhash(i); - }; - scss.getArgument = function() { - if (this.checkDeclaration(pos)) return this.getDeclaration(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkDelim(pos)) return this.getDelim(); - else if (this.checkDeclDelim(pos)) return this.getDeclDelim(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkVhash(pos)) return this.getVhash(); - }; - scss.checkBlockdecl1 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkLoop(i)) tokens[i].bd_kind = 3; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 4; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 5; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 6; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 7; - else return 0; - i += l; - if (i < tokensLength && (l = this.checkDeclDelim(i))) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - return i - start; - }; - scss.getBlockdecl1 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getLoop(); - break; - case 4: - x = this.getFilter(); - break; - case 5: - x = this.getDeclaration(); - break; - case 6: - x = this.getAtrule(); - break; - case 7: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }; - scss.checkBlockdecl2 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkLoop(i)) tokens[i].bd_kind = 3; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 4; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 5; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 6; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 7; - else return 0; - i += l; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getBlockdecl2 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getLoop(); - break; - case 4: - x = this.getFilter(); - break; - case 5: - x = this.getDeclaration(); - break; - case 6: - x = this.getAtrule(); - break; - case 7: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat(this.getSC()); - }; - scss.checkClass = function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && - (l = this.checkInterpolatedVariable(i) || this.checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; - } - return 0; - }; - scss.getClass = function() { - var startPos = pos, - x = [NodeType.ClassType]; - pos++; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkCommentSL = function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0; - }; - scss.getCommentSL = function() { - var startPos = pos, - x; - x = [NodeType.CommentSLType, tokens[pos++].value.substring(2)]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkCondition = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['if', 'else'].indexOf(tokens[start + 1].value) < 0) return 0; - while (i < tokensLength) { - if (l = this.checkBlock(i)) break; - else if (l = this.checkVariable(i) || - this.checkIdent(i) || - this.checkSC(i) || - this.checkNumber(i) || - this.checkOperator(i) || - this.checkCombinator(i) || - this.checkString(i)) i += l; - else return 0; - } - return i - start; - }; - scss.getCondition = function() { - var startPos = pos, - x = [NodeType.ConditionType]; - x.push(this.getAtkeyword()); - while (pos < tokensLength) { - if (this.checkBlock(pos)) break; - else if (this.checkVariable(pos)) x.push(this.getVariable()); - else if (this.checkIdent(pos)) x.push(this.getIdent()); - else if (this.checkNumber(pos)) x.push(this.getNumber()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else if (this.checkCombinator(pos)) x.push(this.getCombinator()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkString(pos)) x.push(this.getString()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkDefault = function(i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.ExclamationMark) return 0; - if (l = this.checkSC(i)) i += l; - return tokens[i].value === 'default' ? i - start + 1 : 0; - }; - scss.getDefault = function() { - var startPos = pos, - x = [NodeType.DefaultType], - sc; - pos++; - sc = this.getSC(); - pos++; - x = x.concat(sc); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkIdent = function(i) { - var start = i, - wasIdent, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.LowLine) return this.checkIdentLowLine(i); - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DollarSign || - tokens[i].type === TokenType.Asterisk) i++; - else return 0; - wasIdent = tokens[i - 1].type === TokenType.Identifier; - for (; i < tokensLength; i++) { - if (l = this.checkInterpolatedVariable(i)) i += l; - if (i >= tokensLength) break; - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine) { - if (tokens[i].type !== TokenType.Identifier && - (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; - else wasIdent = true; - } - } - if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; - tokens[start].ident_last = i - 1; - return i - start; - }; - scss.checkInclude = function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkInclude1(i)) tokens[i].include_type = 1; - else if (l = this.checkInclude2(i)) tokens[i].include_type = 2; - else if (l = this.checkInclude3(i)) tokens[i].include_type = 3; - else if (l = this.checkInclude4(i)) tokens[i].include_type = 4; - return l; - }; - scss.getInclude = function() { - switch (tokens[pos].include_type) { - case 1: return this.getInclude1(); - case 2: return this.getInclude2(); - case 3: return this.getInclude3(); - case 4: return this.getInclude4(); - } - }; - scss.checkInclude1 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude1 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInclude2 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude2 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInclude3 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude3 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInclude4 = function(i) { - var start = i, - l; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['include', 'extend'].indexOf(tokens[start + 1].value) < 0) return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getInclude4 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getAtkeyword()); - x = x.concat(this.getSC()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkIncludeSelector = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector2(i)) i += l; - else break; - } - return i - start; - }; - scss.getIncludeSelector = function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t; - while (pos < tokensLength && this.checkSimpleSelector2(pos)) { - t = this.getSimpleSelector2(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkInterpolatedVariable = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type !== TokenType.NumberSign || - !tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket || - !tokens[i + 2] || tokens[i + 2].type !== TokenType.DollarSign) return 0; - i += 3; - if (l = this.checkIdent(i)) i += l; - else return 0; - return tokens[i].type === TokenType.RightCurlyBracket ? i - start + 1 : 0; - }; - scss.getInterpolatedVariable = function() { - var startPos = pos, - x = [NodeType.InterpolatedVariableType]; - pos += 3; - x.push(this.getIdent()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkLoop = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkAtkeyword(i)) i += l; - else return 0; - if (['for', 'each', 'while'].indexOf(tokens[start + 1].value) < 0) return 0; - while (i < tokensLength) { - if (l = this.checkBlock(i)) { - i += l; - break; - } else if (l = this.checkVariable(i) || - this.checkIdent(i) || - this.checkSC(i) || - this.checkNumber(i) || - this.checkOperator(i) || - this.checkCombinator(i) || - this.checkString(i)) i += l; - else return 0; - } - return i - start; - }; - scss.getLoop = function() { - var startPos = pos, - x = [NodeType.LoopType]; - x.push(this.getAtkeyword()); - while (pos < tokensLength) { - if (this.checkBlock(pos)) { - x.push(this.getBlock()); - break; - } - else if (this.checkVariable(pos)) x.push(this.getVariable()); - else if (this.checkIdent(pos)) x.push(this.getIdent()); - else if (this.checkNumber(pos)) x.push(this.getNumber()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else if (this.checkCombinator(pos)) x.push(this.getCombinator()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkString(pos)) x.push(this.getString()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkMixin = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if ((l = this.checkAtkeyword(i)) && tokens[i + 1].value === 'mixin') i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - return i - start; - }; - scss.getMixin = function() { - var startPos = pos, - x = [NodeType.MixinType, this.getAtkeyword()]; - x = x.concat(this.getSC()); - if (this.checkIdent(pos)) x.push(this.getIdent()); - x = x.concat(this.getSC()); - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkOperator = function(i) { - if (i >= tokensLength) return 0; - switch(tokens[i].type) { - case TokenType.Solidus: - case TokenType.Comma: - case TokenType.Colon: - case TokenType.EqualsSign: - case TokenType.LessThanSign: - case TokenType.GreaterThanSign: - case TokenType.Asterisk: - return 1; - } - return 0; - }; - scss.checkParentSelector = function(i) { - return i < tokensLength && tokens[i].type === TokenType.Ampersand ? 1 : 0; - }; - scss.getParentSelector = function() { - var startPos = pos, - x = [NodeType.ParentSelectorType, '&']; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkPlaceholder = function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].placeholder_l) return tokens[i].placeholder_l; - if (tokens[i].type === TokenType.PercentSign && (l = this.checkIdent(i + 1))) { - tokens[i].placeholder_l = l + 1; - return l + 1; - } else return 0; - }; - scss.getPlaceholder = function() { - var startPos = pos, - x = [NodeType.PlaceholderType]; - pos++; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkProperty = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i) || this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - scss.getProperty = function() { - var startPos = pos, - x = [NodeType.PropertyType]; - x.push(this.checkVariable(pos) ? this.getVariable() : this.getIdent()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkPseudoe = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || - i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkIdent(i)) ? l + 2 : 0; - }; - scss.getPseudoe = function() { - var startPos = pos, - x = [NodeType.PseudoeType]; - pos += 2; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkPseudoc = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkFunction(i) || this.checkIdent(i)) ? l + 1 : 0; - }; - scss.getPseudoc = function() { - var startPos = pos, - x = [NodeType.PseudocType]; - pos ++; - if (this.checkInterpolatedVariable(pos)) x.push(this.getInterpolatedVariable()); - else if (this.checkFunction(pos)) x.push(this.getFunction()); - else x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkSC = function(i) { - if (i >= tokensLength) return 0; - var l, - lsc = 0, - ln = tokens[i].ln; - while (i < tokensLength) { - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i)) && - !(l = this.checkCommentSL(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }; - scss.getSC = function() { - var sc = []; - if (pos >= tokensLength) return sc; - while (pos < tokensLength) { - if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else if (this.checkCommentSL(pos)) sc.push(this.getCommentSL()); - else break; - } - return sc; - }; - scss.checkSimpleSelector1 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkCombinator(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkNamespace(i); - }; - scss.getSimpleSelector1 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkCombinator(pos)) return this.getCombinator(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkNamespace(pos)) return this.getNamespace(); - }; - scss.checkSimpleSelector2 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkPlaceholder(i) || - this.checkIdent(i) || - this.checkClass(i); - }; - scss.getSimpleSelector2 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkPlaceholder(pos)) return this.getPlaceholder(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - }; - scss.checkStylesheet = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSC(i) || - this.checkDeclaration(i) || - this.checkDeclDelim(i) || - this.checkInclude(i) || - this.checkMixin(i) || - this.checkLoop(i) || - this.checkAtrule(i) || - this.checkRuleset(i)) i += l; - else throwError(i); - } - return i - start; - }; - scss.getStylesheet = function() { - var startPos = pos, - x = [NodeType.StylesheetType]; - while (pos < tokensLength) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else if (this.checkInclude(pos)) x.push(this.getInclude()); - else if (this.checkMixin(pos)) x.push(this.getMixin()); - else if (this.checkLoop(pos)) x.push(this.getLoop()); - else if (this.checkAtrule(pos)) x.push(this.getAtrule()); - else if (this.checkDeclaration(pos)) x.push(this.getDeclaration()); - else if (this.checkDeclDelim(pos)) x.push(this.getDeclDelim()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkValue = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this._checkValue(i)) i += l; - if (!l || this.checkBlock(i - l)) break; - } - return i - start; - }; - scss._checkValue = function(i) { - return this.checkSC(i) || - this.checkInterpolatedVariable(i) || - this.checkVariable(i) || - this.checkVhash(i) || - this.checkBlock(i) || - this.checkAny(i) || - this.checkAtkeyword(i) || - this.checkOperator(i) || - this.checkImportant(i) || - this.checkDefault(i); - }; - scss.getValue = function() { - var startPos = pos, - x = [NodeType.ValueType], - t, _pos; - while (pos < tokensLength) { - _pos = pos; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - if (this.checkBlock(_pos)) break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss._getValue = function() { - if (this.checkSC(pos)) return this.getSC(); - else if (this.checkInterpolatedVariable(pos)) return this.getInterpolatedVariable(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkBlock(pos)) return this.getBlock(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkAtkeyword(pos)) return this.getAtkeyword(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - else if (this.checkDefault(pos)) return this.getDefault(); - }; - scss.checkVariable = function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.DollarSign) return 0; - return (l = this.checkIdent(i + 1)) ? l + 1 : 0; - }; - scss.getVariable = function() { - var startPos = pos, - x = [NodeType.VariableType]; - pos++; - x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.checkVariablesList = function(i) { - var d = 0, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i)) i+= l; - else return 0; - while (i < tokensLength && tokens[i].type === TokenType.FullStop) { - d++; - i++; - } - return d === 3 ? l + d : 0; - }; - scss.getVariablesList = function() { - var startPos = pos, - x = [NodeType.VariablesListType, this.getVariable()]; - pos += 3; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - scss.markSC = function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.CommentML: - case TokenType.CommentSL: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }; - syntaxes.scss = scss; -})(); -(function() { - var sass = Object.create(syntaxes.scss); - sass.checkBlock = function(i) { - return i < tokensLength && tokens[i].block_end ? - tokens[i].block_end - i + 1 : 0; - }; - sass.getBlock = function() { - var startPos = pos, - end = tokens[pos].block_end, - x = [NodeType.BlockType]; - while (pos < end) { - if (this.checkBlockdecl(pos)) x = x.concat(this.getBlockdecl()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.getCommentML = function() { - var startPos = pos, - s = tokens[pos].value.substring(2), - l = s.length, - x; - pos++; - x = [NodeType.CommentMLType, s]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkDeclaration = function(i) { - return this.checkDeclaration1(i) || this.checkDeclaration2(i); - }; - sass.getDeclaration = function() { - return this.checkDeclaration1(pos) ? this.getDeclaration1() : this.getDeclaration2(); - }; - sass.checkDeclaration1 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkProperty(i)) i += l; - else return 0; - if (l = this.checkPropertyDelim(i)) i++; - else return 0; - if (l = this.checkValue(i)) i += l; - else return 0; - return i - start; - }; - sass.getDeclaration1 = function() { - var startPos = pos, - x = [NodeType.DeclarationType]; - x.push(this.getProperty()); - x.push(this.getPropertyDelim()); - x.push(this.getValue()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkDeclaration2 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkPropertyDelim(i)) i++; - else return 0; - if (l = this.checkProperty(i)) i += l; - else return 0; - if (l = this.checkValue(i)) i += l; - else return 0; - return i - start; - }; - sass.getDeclaration2 = function() { - var startPos = pos, - x = [NodeType.DeclarationType]; - x.push(this.getPropertyDelim()); - x.push(this.getProperty()); - x.push(this.getValue()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkDeclDelim = function(i) { - if (i >= tokensLength) return 0; - return (tokens[i].type === TokenType.Newline || - tokens[i].type === TokenType.Semicolon) ? 1 : 0; - }; - sass.checkFilterv = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkProgid(i)) i += l; - else return 0; - while (l = this.checkProgid(i)) { - i += l; - } - tokens[start].last_progid = i; - if (this.checkDeclDelim(i)) return i - start; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }; - sass.getFilterv = function() { - var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - while (pos < last_progid) { - x.push(this.getProgid()); - } - if (this.checkDeclDelim(pos)) return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - if (this.checkSC(pos)) x = x.concat(this.getSC()); - if (pos < tokensLength && this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude = function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkInclude1(i)) tokens[i].include_type = 1; - else if (l = this.checkInclude2(i)) tokens[i].include_type = 2; - else if (l = this.checkInclude3(i)) tokens[i].include_type = 3; - else if (l = this.checkInclude4(i)) tokens[i].include_type = 4; - else if (l = this.checkInclude5(i)) tokens[i].include_type = 5; - else if (l = this.checkInclude6(i)) tokens[i].include_type = 6; - else if (l = this.checkInclude7(i)) tokens[i].include_type = 7; - else if (l = this.checkInclude8(i)) tokens[i].include_type = 8; - return l; - }; - sass.getInclude = function() { - switch (tokens[pos].include_type) { - case 1: return this.getInclude1(); - case 2: return this.getInclude2(); - case 3: return this.getInclude3(); - case 4: return this.getInclude4(); - case 5: return this.getInclude5(); - case 6: return this.getInclude6(); - case 7: return this.getInclude7(); - case 8: return this.getInclude8(); - } - }; - sass.checkInclude5 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude5 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude6 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude6 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getArguments()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude7 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude7 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkInclude8 = function(i) { - var start = i, - l; - if (tokens[i].type === TokenType.PlusSign) i++; - else return 0; - if (l = this.checkIncludeSelector(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - sass.getInclude8 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.getOperator()); - x.push(this.getIncludeSelector()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkMixin = function(i) { - return this.checkMixin1(i) || this.checkMixin2(i); - }; - sass.getMixin = function() { - return this.checkMixin1(pos) ? this.getMixin1() : this.getMixin2(); - }; - sass.checkMixin1 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if ((l = this.checkAtkeyword(i)) && tokens[i + 1].value === 'mixin') i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else { - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - } - return i - start; - }; - sass.getMixin1 = function() { - var startPos = pos, - x = [NodeType.MixinType, this.getAtkeyword()]; - x = x.concat(this.getSC()); - if (this.checkIdent(pos)) x.push(this.getIdent()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - else { - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkMixin2 = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.EqualsSign) i++; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else { - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - } - return i - start; - }; - sass.getMixin2 = function() { - var startPos = pos, - x = [NodeType.MixinType, this.getOperator()]; - x = x.concat(this.getSC()); - if (this.checkIdent(pos)) x.push(this.getIdent()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - else { - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - x.push(this.getBlock()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkProgid = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6; - else return 0; - if (l = this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (tokens[i].type === TokenType.LeftParenthesis) { - tokens[start].progid_end = tokens[i].right; - i = tokens[i].right + 1; - } else return 0; - return i - start; - }; - sass.getProgid = function() { - var startPos = pos, - progid_end = tokens[pos].progid_end, - x; - x = [NodeType.ProgidType] - .concat(this.getSC()) - .concat([this._getProgid(progid_end)]); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkSC = function(i) { - if (!tokens[i]) return 0; - var l, - lsc = 0, - ln = tokens[i].ln; - while (i < tokensLength) { - if (tokens[i].ln !== ln) break; - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i)) && - !(l = this.checkCommentSL(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }; - sass.getSC = function() { - var sc = [], - ln; - if (pos >= tokensLength) return sc; - ln = tokens[pos].ln; - while (pos < tokensLength) { - if (tokens[pos].ln !== ln) break; - else if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else if (this.checkCommentSL(pos)) sc.push(this.getCommentSL()); - else break; - } - return sc; - }; - sass.checkSelector = function(i) { - var start = i, - l, ln; - if (i >= tokensLength) return 0; - ln = tokens[i].ln; - while (i < tokensLength) { - if (tokens[i].ln !== ln) break; - if ((l = this.checkDeclDelim(i) && this.checkBlock(i + l)) || this.checkSC(i)) i += l; - if (l = this.checkSimpleSelector(i) || this.checkDelim(i)) i += l; - else break; - } - tokens[start].selector_end = i - 1; - return i - start; - }; - sass.getSelector = function() { - var startPos = pos, - x = [NodeType.SelectorType], - selector_end = tokens[pos].selector_end, - ln = tokens[pos].ln; - while (pos <= selector_end) { - if (tokens[pos].ln !== ln) break; - if ((l = this.checkDeclDelim(pos)) && this.checkBlock(pos + l)) x.push(this.getDeclDelim()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - x.push(this.checkDelim(pos) ? this.getDelim() : this.getSimpleSelector()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkSimpleSelector = function(i) { - if (i >= tokensLength) return 0; - var start = i, - l, - ln = tokens[i].ln; - while (i < tokensLength) { - if (tokens[i].ln !== ln) break; - if (l = this.checkSimpleSelector1(i)) i += l; - else break; - } - return (i - start) || 0; - }; - sass.getSimpleSelector = function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t, - ln = tokens[pos].ln; - while (pos < tokensLength) { - if (tokens[pos].ln !== ln || - !this.checkSimpleSelector1(pos)) break; - t = this.getSimpleSelector1(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass.checkValue = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (this.checkDeclDelim(i)) break; - if (l = this._checkValue(i)) i += l; - if (!l || this.checkBlock(i - l)) break; - } - return i - start; - }; - sass.getValue = function() { - var startPos = pos, - x = [NodeType.ValueType], - t, _pos; - while (pos < tokensLength) { - _pos = pos; - if (this.checkDeclDelim(pos)) break; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - if (this.checkBlock(_pos)) break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - sass._checkValue = function(i) { - return this.checkS(i) || - this.checkCommentML(i) || - this.checkCommentSL(i) || - this.checkVhash(i) || - this.checkAny(i) || - this.checkOperator(i) || - this.checkImportant(i); - }; - sass._getValue = function() { - if (this.checkS(pos)) return this.getS(); - if (this.checkCommentML(pos)) return this.getCommentML(); - if (this.checkCommentSL(pos)) return this.getCommentSL(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - }; - sass.markSC = function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.Newline: - t.ws = true; - t.sc = true; - ws = ws === -1 ? i : ws; - sc = sc === -1 ? i : ws; - tokens[ws].ws_last = i; - tokens[sc].sc_last = i; - ws = -1; - sc = -1; - break; - case TokenType.CommentML: - case TokenType.CommentSL: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }; - sass.markBlocks = function() { - var blocks = [], - currentLN = 1, - currentIL = 0, - prevIL = 0, - i = 0, - l = tokens.length, - iw; - for (; i != l; i++) { - if (!tokens[i - 1]) continue; - if (tokens[i].ln == currentLN) continue; - else currentLN = tokens[i].ln; - prevIL = currentIL; - if (tokens[i].type !== TokenType.Space) currentIL = 0; - else { - if (!iw) iw = tokens[i].value.length; - prevIL = currentIL; - currentIL = tokens[i].value.length / iw; - } - if (prevIL === currentIL) continue; - else if (currentIL > prevIL) { - blocks.push(i); - continue; - } else { - var il = prevIL; - while (blocks.length > 0 && il !== currentIL) { - tokens[blocks.pop()].block_end = i - 1; - il--; - } - } - } - while (blocks.length > 0) { - tokens[blocks.pop()].block_end = i - 1; - } - }; - sass.parseMLComment = function(css) { - var start = pos; - var il = 0; - for (var _pos = pos - 1; _pos > -1; _pos--) { - if (css.charAt(_pos) === ' ') il++; - else break; - } - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n') { - var _il = 0; - for (var _pos = pos + 1; _pos < css.length; _pos++) { - if (css.charAt(_pos) === ' ') _il++; - else break; - } - if (_il > il) { - pos = _pos; - } else break; - } - } - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); - }; - sass.parseSLComment = function(css) { - var start = pos; - var il = 0; - var onlyToken = false; - for (var _pos = pos - 1; _pos > -1; _pos--) { - if (css.charAt(_pos) === ' ') il++; - else if (css.charAt(_pos) === '\n') { - onlyToken = true; - break; - } else break; - } - if (_pos === -1) onlyToken = true; - if (!onlyToken) { - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { - break; - } - } - } else { - for (pos = pos + 2; pos < css.length; pos++) { - if (css.charAt(pos) === '\n') { - var _il = 0; - for (var _pos = pos + 1; _pos < css.length; _pos++) { - if (css.charAt(_pos) === ' ') _il++; - else break; - } - if (_il > il) { - pos = _pos; - } else break; - } - } - } - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; - }; - syntaxes.sass = sass; -})(); -(function() { - var less = Object.create(syntaxes.css); - less.checkAny = function(i) { - return this.checkBraces(i) || - this.checkString(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkFunctionExpression(i) || - this.checkFunction(i) || - this.checkIdent(i) || - this.checkClass(i) || - this.checkUnary(i); - }; - less.getAny = function() { - if (this.checkBraces(pos)) return this.getBraces(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkFunctionExpression(pos)) return this.getFunctionExpression(); - else if (this.checkFunction(pos)) return this.getFunction(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - else if (this.checkUnary(pos)) return this.getUnary(); - }; - less.checkArguments = function (i) { - var start = i, - l; - if (i >= tokensLength || - tokens[i++].type !== TokenType.LeftParenthesis) return 0; - while (i < tokens[start].right) { - if (l = this.checkArgument(i)) i +=l; - else return 0; - } - return tokens[start].right - start + 1; - }; - less.getArguments = function() { - var startPos = pos, - arguments = [], - x; - pos++; - while (x = this.getArgument()) { - if ((needInfo && typeof x[1] === 'string') || typeof x[0] === 'string') arguments.push(x); - else arguments = arguments.concat(x); - } - pos++; - x = [NodeType.ArgumentsType].concat(arguments); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkArgument = function(i) { - return this.checkDeclaration(i) || - this.checkVariablesList(i) || - this.checkVariable(i) || - this.checkSC(i) || - this.checkDelim(i) || - this.checkDeclDelim(i) || - this.checkString(i) || - this.checkPercentage(i) || - this.checkDimension(i) || - this.checkNumber(i) || - this.checkUri(i) || - this.checkIdent(i) || - this.checkVhash(i); - }; - less.getArgument = function() { - if (this.checkDeclaration(pos)) return this.getDeclaration(); - else if (this.checkVariablesList(pos)) return this.getVariablesList(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkDelim(pos)) return this.getDelim(); - else if (this.checkDeclDelim(pos)) return this.getDeclDelim(); - else if (this.checkString(pos)) return this.getString(); - else if (this.checkPercentage(pos)) return this.getPercentage(); - else if (this.checkDimension(pos)) return this.getDimension(); - else if (this.checkNumber(pos)) return this.getNumber(); - else if (this.checkUri(pos)) return this.getUri(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkVhash(pos)) return this.getVhash(); - }; - less.checkBlockdecl1 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 3; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 4; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 5; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 6; - else return 0; - i += l; - if (i < tokensLength && (l = this.checkDeclDelim(i))) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - else return 0; - return i - start; - } - less.getBlockdecl1 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getFilter(); - break; - case 4: - x = this.getDeclaration(); - break; - case 5: - x = this.getAtrule(); - break; - case 6: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat([this.getDeclDelim()]) - .concat(this.getSC()); - }; - less.checkBlockdecl2 = function(i) { - var start = i, - l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkCondition(i)) tokens[i].bd_kind = 1; - else if (l = this.checkInclude(i)) tokens[i].bd_kind = 2; - else if (l = this.checkFilter(i)) tokens[i].bd_kind = 3; - else if (l = this.checkDeclaration(i)) tokens[i].bd_kind = 4; - else if (l = this.checkAtrule(i)) tokens[i].bd_kind = 5; - else if (l = this.checkRuleset(i)) tokens[i].bd_kind = 6; - else return 0; - i += l; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - less.getBlockdecl2 = function() { - var sc = this.getSC(), - x; - switch (tokens[pos].bd_kind) { - case 1: - x = this.getCondition(); - break; - case 2: - x = this.getInclude(); - break; - case 3: - x = this.getFilter(); - break; - case 4: - x = this.getDeclaration(); - break; - case 5: - x = this.getAtrule(); - break; - case 6: - x = this.getRuleset(); - break; - } - return sc - .concat([x]) - .concat(this.getSC()); - }; - less.checkClass = function(i) { - var l; - if (i >= tokensLength) return 0; - if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && - (l = this.checkInterpolatedVariable(i) || this.checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; - } - return 0; - }; - less.getClass = function() { - var startPos = pos, - x = [NodeType.ClassType]; - pos++; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkCommentSL = function(i) { - return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0; - }; - less.getCommentSL = function() { - var startPos = pos, - x; - x = [NodeType.CommentSLType, tokens[pos++].value.substring(2)]; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkCondition = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if ((l = this.checkIdent(i)) && tokens[i].value === 'when') i += l; - else return 0; - while (i < tokensLength) { - if (l = this.checkBlock(i)) break; - if (l = this.checkFunction(i) | - this.checkBraces(i) || - this.checkVariable(i) || - this.checkIdent(i) || - this.checkSC(i) || - this.checkNumber(i) || - this.checkDelim(i) || - this.checkOperator(i) || - this.checkCombinator(i) || - this.checkString(i)) i += l; - else return 0; - } - return i - start; - }; - less.getCondition = function() { - var startPos = pos, - x = [NodeType.ConditionType]; - x.push(this.getIdent()); - while (pos < tokensLength) { - if (this.checkBlock(pos)) break; - else if (this.checkFunction(pos)) x.push(this.getFunction()); - else if (this.checkBraces(pos)) x.push(this.getBraces()); - else if (this.checkVariable(pos)) x.push(this.getVariable()); - else if (this.checkIdent(pos)) x.push(this.getIdent()); - else if (this.checkNumber(pos)) x.push(this.getNumber()); - else if (this.checkDelim(pos)) x.push(this.getDelim()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else if (this.checkCombinator(pos)) x.push(this.getCombinator()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkString(pos)) x.push(this.getString()); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkEscapedString = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.Tilde && (l = this.checkString(i + 1))) return i + l - start; - else return 0; - }; - less.getEscapedString = function() { - var startPos = pos, - x = [NodeType.EscapedStringType]; - pos++; - x.push(tokens[pos++].value); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkFilterv = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkProgid(i) || this.checkEscapedString(i)) i += l; - else return 0; - while (l = this.checkProgid(i) || this.checkEscapedString(i)) { - i += l; - } - tokens[start].last_progid = i; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }; - less.getFilterv = function() { - var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - x = x.concat(this.getSC()); - while (pos < last_progid) { - x.push(this.checkProgid(pos) ? this.getProgid() : this.getEscapedString()); - } - if (this.checkSC(pos)) x = x.concat(this.getSC()); - if (pos < tokensLength && this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }, - less.checkIdent = function(i) { - var start = i, - wasIdent, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.LowLine) return this.checkIdentLowLine(i); - if (tokens[i].type === TokenType.HyphenMinus || - tokens[i].type === TokenType.Identifier || - tokens[i].type === TokenType.DollarSign || - tokens[i].type === TokenType.Asterisk) i++; - else return 0; - wasIdent = tokens[i - 1].type === TokenType.Identifier; - for (; i < tokensLength; i++) { - if (l = this.checkInterpolatedVariable(i)) i += l; - if (i >= tokensLength) break; - if (tokens[i].type !== TokenType.HyphenMinus && - tokens[i].type !== TokenType.LowLine) { - if (tokens[i].type !== TokenType.Identifier && - (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; - else wasIdent = true; - } - } - if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; - tokens[start].ident_last = i - 1; - return i - start; - }; - less.checkInclude = function(i) { - var l; - if (i >= tokensLength) return 0; - if (l = this.checkInclude1(i)) tokens[i].include_type = 1; - else if (l = this.checkInclude2(i)) tokens[i].include_type = 2; - return l; - }; - less.getInclude = function() { - switch (tokens[pos].include_type) { - case 1: return this.getInclude1(); - case 2: return this.getInclude2(); - } - }; - less.checkInclude1 = function(i) { - var start = i, - l; - if (l = this.checkClass(i) || this.checkShash(i)) i += l; - else return 0; - while (i < tokensLength) { - if (l = this.checkClass(i) || this.checkShash(i) || this.checkSC(i)) i += l; - else if (tokens[i].type == TokenType.GreaterThanSign) i++; - else break; - } - if (l = this.checkArguments(i)) i += l; - else return 0; - if (i < tokensLength && (l = this.checkSC(i))) i += l; - if (i < tokensLength && (l = this.checkImportant(i))) i += l; - return i - start; - }; - less.getInclude1 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.checkClass(pos) ? this.getClass() : this.getShash()); - while (pos < tokensLength) { - if (this.checkClass(pos)) x.push(this.getClass()); - else if (this.checkShash(pos)) x.push(this.getShash()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else break; - } - x.push(this.getArguments()); - x = x.concat(this.getSC()); - if (this.checkImportant(pos)) x.push(this.getImportant()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkInclude2 = function(i) { - var start = i, - l; - if (l = this.checkClass(i) || this.checkShash(i)) i += l; - else return 0; - while (i < tokensLength) { - if (l = this.checkClass(i) || this.checkShash(i) || this.checkSC(i)) i += l; - else if (tokens[i].type == TokenType.GreaterThanSign) i++; - else break; - } - return i - start; - }; - less.getInclude2 = function() { - var startPos = pos, - x = [NodeType.IncludeType]; - x.push(this.checkClass(pos) ? this.getClass() : this.getShash()); - while (pos < tokensLength) { - if (this.checkClass(pos)) x.push(this.getClass()); - else if (this.checkShash(pos)) x.push(this.getShash()); - else if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkOperator(pos)) x.push(this.getOperator()); - else break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkIncludeSelector = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSimpleSelector2(i)) i += l; - else break; - } - return i - start; - }; - less.getIncludeSelector = function() { - var startPos = pos, - x = [NodeType.SimpleselectorType], - t; - while (pos < tokensLength && this.checkSimpleSelector2(pos)) { - t = this.getSimpleSelector2(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkInterpolatedVariable = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (tokens[i].type !== TokenType.CommercialAt || - !tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket) return 0; - i += 2; - if (l = this.checkIdent(i)) i += l; - else return 0; - return tokens[i].type === TokenType.RightCurlyBracket ? i - start + 1 : 0; - }; - less.getInterpolatedVariable = function() { - var startPos = pos, - x = [NodeType.InterpolatedVariableType]; - pos += 2; - x.push(this.getIdent()); - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkMixin = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkClass(i) || this.checkShash(i)) i +=l; - else return 0; - if (l = this.checkSC(i)) i += l; - if (l = this.checkArguments(i)) i += l; - if (l = this.checkSC(i)) i += l; - if (l = this.checkBlock(i)) i += l; - else return 0; - return i - start; - }; - less.getMixin = function() { - var startPos = pos, - x = [NodeType.MixinType]; - x.push(this.checkClass(pos) ? this.getClass() : this.getShash()); - x = x.concat(this.getSC()); - if (this.checkArguments(pos)) x.push(this.getArguments()); - x = x.concat(this.getSC()); - if (this.checkBlock(pos)) x.push(this.getBlock()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkOperator = function(i) { - if (i >= tokensLength) return 0; - switch(tokens[i].type) { - case TokenType.Solidus: - case TokenType.Comma: - case TokenType.Colon: - case TokenType.EqualsSign: - case TokenType.LessThanSign: - case TokenType.GreaterThanSign: - case TokenType.Asterisk: - return 1; - } - return 0; - }; - less.checkParentSelector = function(i) { - return i < tokensLength && tokens[i].type === TokenType.Ampersand ? 1 : 0; - }; - less.getParentSelector = function() { - var startPos = pos, - x = [NodeType.ParentSelectorType, '&']; - pos++; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkProperty = function(i) { - var start = i, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i) || this.checkIdent(i)) i += l; - else return 0; - if (l = this.checkSC(i)) i += l; - return i - start; - }; - less.getProperty = function() { - var startPos = pos, - x = [NodeType.PropertyType]; - if (this.checkVariable(pos)) x.push(this.getVariable()); - else x.push(this.getIdent()); - x = x.concat(this.getSC()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkPseudoe = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || - i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkIdent(i)) ? l + 2 : 0; - }; - less.getPseudoe = function() { - var startPos = pos, - x = [NodeType.PseudoeType]; - pos += 2; - x.push(this.checkInterpolatedVariable(pos) ? this.getInterpolatedVariable() : this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkPseudoc = function(i) { - var l; - if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; - return (l = this.checkInterpolatedVariable(i) || this.checkFunction(i) || this.checkIdent(i)) ? l + 1 : 0; - }; - less.getPseudoc = function() { - var startPos = pos, - x = [NodeType.PseudocType]; - pos ++; - if (this.checkInterpolatedVariable(pos)) x.push(this.getInterpolatedVariable()); - else if (this.checkFunction(pos)) x.push(this.getFunction()); - else x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkSC = function(i) { - if (i >= tokensLength) return 0; - var l, - lsc = 0, - ln = tokens[i].ln; - while (i < tokensLength) { - if (!(l = this.checkS(i)) && - !(l = this.checkCommentML(i)) && - !(l = this.checkCommentSL(i))) break; - i += l; - lsc += l; - } - return lsc || 0; - }; - less.getSC = function() { - var sc = [], - ln; - if (pos >= tokensLength) return sc; - ln = tokens[pos].ln; - while (pos < tokensLength) { - if (this.checkS(pos)) sc.push(this.getS()); - else if (this.checkCommentML(pos)) sc.push(this.getCommentML()); - else if (this.checkCommentSL(pos)) sc.push(this.getCommentSL()); - else break; - } - return sc; - }; - less.checkSimpleSelector1 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkCombinator(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkAny(i) || - this.checkSC(i) || - this.checkNamespace(i); - }; - less.getSimpleSelector1 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkCombinator(pos)) return this.getCombinator(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkSC(pos)) return this.getSC(); - else if (this.checkNamespace(pos)) return this.getNamespace(); - }; - less.checkSimpleSelector2 = function(i) { - return this.checkParentSelector(i) || - this.checkNthselector(i) || - this.checkAttrib(i) || - this.checkPseudo(i) || - this.checkShash(i) || - this.checkIdent(i) || - this.checkClass(i); - }; - less.getSimpleSelector2 = function() { - if (this.checkParentSelector(pos)) return this.getParentSelector(); - else if (this.checkNthselector(pos)) return this.getNthselector(); - else if (this.checkAttrib(pos)) return this.getAttrib(); - else if (this.checkPseudo(pos)) return this.getPseudo(); - else if (this.checkShash(pos)) return this.getShash(); - else if (this.checkIdent(pos)) return this.getIdent(); - else if (this.checkClass(pos)) return this.getClass(); - }; - less.checkStylesheet = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this.checkSC(i) || - this.checkDeclaration(i) || - this.checkDeclDelim(i) || - this.checkInclude(i) || - this.checkMixin(i) || - this.checkAtrule(i) || - this.checkRuleset(i)) i += l; - else throwError(i); - } - return i - start; - }; - less.getStylesheet = function() { - var startPos = pos, - x = [NodeType.StylesheetType]; - while (pos < tokensLength) { - if (this.checkSC(pos)) x = x.concat(this.getSC()); - else if (this.checkRuleset(pos)) x.push(this.getRuleset()); - else if (this.checkInclude(pos)) x.push(this.getInclude()); - else if (this.checkMixin(pos)) x.push(this.getMixin()); - else if (this.checkAtrule(pos)) x.push(this.getAtrule()); - else if (this.checkDeclaration(pos)) x.push(this.getDeclaration()); - else if (this.checkDeclDelim(pos)) x.push(this.getDeclDelim()); - else throwError(); - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkValue = function(i) { - var start = i, - l; - while (i < tokensLength) { - if (l = this._checkValue(i)) i += l; - if (!l || this.checkBlock(i - l)) break; - } - return i - start; - }; - less._checkValue = function(i) { - return this.checkSC(i) || - this.checkEscapedString(i) || - this.checkInterpolatedVariable(i) || - this.checkVariable(i) || - this.checkVhash(i) || - this.checkBlock(i) || - this.checkAny(i) || - this.checkAtkeyword(i) || - this.checkOperator(i) || - this.checkImportant(i); - }; - less.getValue = function() { - var startPos = pos, - x = [NodeType.ValueType], - t, _pos; - while (pos < tokensLength) { - _pos = pos; - if (!this._checkValue(pos)) break; - t = this._getValue(); - if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); - else x = x.concat(t); - if (this.checkBlock(_pos)) break; - } - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less._getValue = function() { - if (this.checkSC(pos)) return this.getSC(); - else if (this.checkEscapedString(pos)) return this.getEscapedString(); - else if (this.checkInterpolatedVariable(pos)) return this.getInterpolatedVariable(); - else if (this.checkVariable(pos)) return this.getVariable(); - else if (this.checkVhash(pos)) return this.getVhash(); - else if (this.checkBlock(pos)) return this.getBlock(); - else if (this.checkAny(pos)) return this.getAny(); - else if (this.checkAtkeyword(pos)) return this.getAtkeyword(); - else if (this.checkOperator(pos)) return this.getOperator(); - else if (this.checkImportant(pos)) return this.getImportant(); - }; - less.checkVariable = function(i) { - var l; - if (i >= tokensLength || tokens[i].type !== TokenType.CommercialAt) return 0; - if (tokens[i - 1] && - tokens[i - 1].type === TokenType.CommercialAt && - tokens[i - 2] && - tokens[i - 2].type === TokenType.CommercialAt) return 0; - return (l = this.checkVariable(i + 1) || this.checkIdent(i + 1)) ? l + 1 : 0; - }; - less.getVariable = function() { - var startPos = pos, - x = [NodeType.VariableType]; - pos++; - if (this.checkVariable(pos)) x.push(this.getVariable()); - else x.push(this.getIdent()); - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.checkVariablesList = function(i) { - var d = 0, - l; - if (i >= tokensLength) return 0; - if (l = this.checkVariable(i)) i+= l; - else return 0; - while (tokens[i] && tokens[i].type === TokenType.FullStop) { - d++; - i++; - } - return d === 3 ? l + d : 0; - }; - less.getVariablesList = function() { - var startPos = pos, - x = [NodeType.VariablesListType, this.getVariable()]; - pos += 3; - return needInfo ? (x.unshift(getInfo(startPos)), x) : x; - }; - less.markSC = function() { - var ws = -1, - sc = -1, - t; - for (var i = 0; i < tokensLength; i++) { - t = tokens[i]; - switch (t.type) { - case TokenType.Space: - case TokenType.Tab: - case TokenType.Newline: - t.ws = true; - t.sc = true; - if (ws === -1) ws = i; - if (sc === -1) sc = i; - break; - case TokenType.CommentML: - case TokenType.CommentSL: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - t.sc = true; - break; - default: - if (ws !== -1) { - tokens[ws].ws_last = i - 1; - ws = -1; - } - if (sc !== -1) { - tokens[sc].sc_last = i - 1; - sc = -1; - } - } - } - if (ws !== -1) tokens[ws].ws_last = i - 1; - if (sc !== -1) tokens[sc].sc_last = i - 1; - }; - syntaxes.less = less; -})(); - return function(options) { - var css, rule, syntax; - if (!options) throw new Error('Please, pass a string to parse'); - css = typeof options === 'string'? options : options.css; - if (!css) throw new Error('String can not be empty'); - rule = options.rule || 'stylesheet'; - needInfo = options.needInfo || false; - syntax = options.syntax || 'css'; - if (!syntaxes[syntax]) throw new Error('Syntax "' + _syntax + - '" is not currently supported, sorry'); - s = syntaxes[syntax]; - getTokens(css, syntax); - tokensLength = tokens.length; - pos = 0; - s.markBrackets(); - s.markSC(); - s.markBlocks && s.markBlocks(); - return rules[rule](); - } -}()); diff --git a/node_modules/csscomb/package.json b/node_modules/csscomb/package.json index 9983399..b45619c 100644 --- a/node_modules/csscomb/package.json +++ b/node_modules/csscomb/package.json @@ -1,81 +1,116 @@ { - "name": "csscomb", - "description": "CSS coding style formatter", - "version": "3.0.0", - "homepage": "http://csscomb.com/", + "_args": [ + [ + "csscomb@3.1.8", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb" + ] + ], + "_from": "csscomb@3.1.8", + "_id": "csscomb@3.1.8", + "_inCache": true, + "_installable": true, + "_location": "/csscomb", + "_nodeVersion": "0.12.4", + "_npmUser": { + "email": "tonyganch+github@gmail.com", + "name": "tonyganch" + }, + "_npmVersion": "2.10.1", + "_phantomChildren": {}, + "_requested": { + "name": "csscomb", + "raw": "csscomb@3.1.8", + "rawSpec": "3.1.8", + "scope": null, + "spec": "3.1.8", + "type": "version" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/csscomb/-/csscomb-3.1.8.tgz", + "_shasum": "a8a738884f409baf35ec9461afc52e1c75bd23a2", + "_shrinkwrap": null, + "_spec": "csscomb@3.1.8", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb", "author": { - "name": "Mikhail Troshev", - "email": "mishanga@yandex-team.ru" + "email": "mishanga@yandex-team.ru", + "name": "Mikhail Troshev" }, - "repository": { - "type": "git", - "url": "https://github.com/csscomb/csscomb.js" + "bin": { + "csscomb": "./bin/csscomb" }, - "maintainers": [ - { - "name": "Mikhail Troshev", - "email": "mishanga@yandex-team.ru", - "url": "http://mishanga.pro/" - }, + "bugs": { + "url": "https://github.com/csscomb/csscomb.js/issues" + }, + "contributors": [ { - "name": "Tony Ganch", - "email": "tonyganch+github@gmail.com", - "url": "http://tonyganch.com/" + "name": "Igor Novak", + "email": "bezengi@gmail.com" }, { - "name": "Slava Oliyanchuk", - "email": "miripiruni@gmail.com", - "url": "http://miripiruni.org/" - } - ], - "contributors": [ - { - "name": "Sergey Puzankov", - "email": "puzankov@yandex-team.ru" + "name": "Roman Komarov", + "email": "kizmarh@ya.ru" }, { "name": "Denis Payase", "email": "lostsoul@yandex-team.ru" }, { - "name": "Igor Novak", - "email": "bezengi@gmail.com" + "name": "Mikhail Troshev", + "email": "mishanga@yandex-team.ru", + "url": "http://mishanga.pro/" }, { - "name": "Roman Komarov", - "email": "kizmarh@ya.ru" + "name": "Sergey Puzankov", + "email": "puzankov@yandex-team.ru" } ], - "engines": { - "node": ">= 0.10.0" - }, "dependencies": { "commander": "2.0.0", - "csscomb-core": "~2.0.0", - "gonzales-pe": "~3.0.0", + "csscomb-core": "3.0.0-3.1", + "gonzales-pe": "3.0.0-28", "vow": "0.4.4" }, + "description": "CSS coding style formatter", "devDependencies": { - "jshint-groups": "0.5.3", - "jshint": "2.3.0", "jscs": "1.4.5", - "mocha": "1.14.0" + "jshint": "2.3.0", + "jshint-groups": "0.5.3", + "mocha": "1.20.1" }, + "directories": {}, + "dist": { + "shasum": "a8a738884f409baf35ec9461afc52e1c75bd23a2", + "tarball": "http://registry.npmjs.org/csscomb/-/csscomb-3.1.8.tgz" + }, + "engines": { + "node": ">= 0.10.0" + }, + "files": [ + "bin", + "config", + "lib" + ], + "gitHead": "1fce22d58a504c1f425349f5ad39d2ac40f5637c", + "homepage": "http://csscomb.com/", "main": "./lib/csscomb.js", - "bin": { - "csscomb": "./bin/csscomb" + "maintainers": [ + { + "name": "tonyganch", + "email": "tonyganch+github@gmail.com" + } + ], + "name": "csscomb", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/csscomb/csscomb.js.git" }, "scripts": { "test": "jshint-groups && ./node_modules/.bin/jscs . && node test/mocha", "test-cov": "rm -rf lib-cov && jscoverage lib lib-cov && TEST_COV=true node test/mocha > ./test/test-coverage.html" }, - "readme": "# CSScomb [![CSSComb](logo.png)](http://csscomb.com/)\n[![Build Status](https://travis-ci.org/csscomb/csscomb.js.svg?branch=master)](http://travis-ci.org/csscomb/csscomb.js)\n[![NPM version](https://badge.fury.io/js/csscomb.svg)](http://badge.fury.io/js/csscomb)\n[![Dependency Status](https://david-dm.org/csscomb/csscomb.js.svg)](https://david-dm.org/csscomb/csscomb.js)\n[![devDependency Status](https://david-dm.org/csscomb/csscomb.js/dev-status.svg)](https://david-dm.org/csscomb/csscomb.js#info=devDependencies)\n\nCSScomb is a coding style formatter for CSS.\nYou can easily write your own [configuration](doc/configuration.md) to make\nyour style sheets beautiful and consistent.\n\nThe main feature is [sorting properties](doc/options.md#sort-order) in a specific order.\nIt was inspired by [@miripiruni](https://github.com/miripiruni)'s\n[PHP-based tool](https://github.com/csscomb/csscomb) of the same name.\nThis is the new JavaScript version, based on the powerful CSS parser\n[Gonzales PE](https://github.com/tonyganch/gonzales-pe).\n\n## 1. Install\n\nGlobal installation (for use as a command-line tool):\n\n```bash\nnpm install csscomb -g\n```\n\nLocal installation (for use as a command-line tool within current directory):\n\n```bash\nnpm install csscomb\n```\n\nTo install as a project dependency (the package will appear in your dependencies):\n\n```bash\nnpm install csscomb --save\n```\n\nTo install as a dev dependency (the package will appear in your devDependencies):\n\n```bash\nnpm install csscomb --save-dev\n```\n\n## 2. [Configure](doc/configuration.md)\n\nThere are a number of ways to configure CSScomb:\n\n- Use one of [predefined configs](config)\n- Put `.csscomb.json` file in the project root.\n- Set path to config's file\n- Use `*.css` file as a template\n\n## 3. Use\n\n### [Command Line](doc/usage-cli.md)\n\n```bash\ncsscomb assets/css\n```\n\n### [Node.js module](doc/usage-node.md)\n\n```js\nvar Comb = require('csscomb');\nvar comb = new Comb('zen');\ncomb.processPath('assets/css');\n```\n\n## 4. Contribute\n\nAnyone and everyone is welcome to contribute.\nPlease take a moment to review the [guidelines for contributing](CONTRIBUTE.md).\n\n## Authors\n\n[@mishanga](https://github.com/mishanga),\n[@tonyganch](https://github.com/tonyganch)\n\nThanks for assistance and contributions:\n\n[@miripiruni](https://github.com/miripiruni),\n[@anton-rudeshko](https://github.com/anton-rudeshko),\n[@cvrebert](https://github.com/cvrebert),\n[@filtercake](https://github.com/filtercake),\n[@ignovak](https://github.com/ignovak),\n[@kizu](https://github.com/kizu),\n[@lefoy](https://github.com/lefoy),\n[@L0stSoul](https://github.com/L0stSoul),\n[@mishaberezin](https://github.com/mishaberezin),\n[@puzankov](https://github.com/puzankov),\n[@schneyra](https://github.com/schneyra),\n[@thejameskyle](https://github.com/thejameskyle),\n[@vecmezoni](https://github.com/vecmezoni)\n\n## License\n\nThis software is released under the terms of the\n[MIT license](https://github.com/csscomb/csscomb.js/blob/master/LICENSE).\n\n## Other projects\n* https://github.com/senchalabs/cssbeautify\n* https://github.com/css/gonzales\n* https://github.com/tonyganch/gonzales-pe\n* https://github.com/css/csso\n* https://github.com/nzakas/parser-lib\n", - "readmeFilename": "README.md", - "gitHead": "2875c43992c0100704b5b9ced52b1973eb253503", - "bugs": { - "url": "https://github.com/csscomb/csscomb.js/issues" - }, - "_id": "csscomb@3.0.0", - "_shasum": "6c156c622bcd6b48c3ba9cb7a529227704e0e55a", - "_from": "csscomb@3.0.0" + "version": "3.1.8" } diff --git a/node_modules/csscomb/test/core/configure.js b/node_modules/csscomb/test/core/configure.js deleted file mode 100644 index 77d9fe5..0000000 --- a/node_modules/csscomb/test/core/configure.js +++ /dev/null @@ -1,48 +0,0 @@ -var Comb = process.env.TEST_COV ? require('../../lib-cov/csscomb') : require('../../lib/csscomb'); -var assert = require('assert'); - -describe('csscomb methods', function() { - var comb; - var input; - var output; - var expected; - - it('Passing no config to constructor should not configure anything', function() { - comb = new Comb(); - assert.equal(undefined, comb._handlers); - }); - - it('Passing valid config name to constructor should configure using correct config', function() { - comb = new Comb('zen'); - input = 'a { color: tomato; top: 0; }'; - expected = 'a {top: 0; color: tomato; }'; - output = comb.processString(input); - - assert.equal(expected, output); - }); - - it('Passing config object to constructor should configure using that object', function() { - comb = new Comb({ 'always-semicolon': true }); - input = 'a { color: tomato }'; - expected = 'a { color: tomato; }'; - output = comb.processString(input); - - assert.equal(expected, output); - }); - - it('new Comb() should be chainable', function() { - input = 'a { color: tomato; top: 0; }'; - expected = 'a {top: 0; color: tomato; }'; - output = new Comb('zen').processString(input); - - assert.equal(expected, output); - }); - - it('configure() should be chainable', function() { - input = 'a { color: tomato }'; - expected = 'a { color: tomato; }'; - output = new Comb().configure({ 'always-semicolon': true }).processString(input); - - assert.equal(expected, output); - }); -}); diff --git a/node_modules/csscomb/test/core/get-config.js b/node_modules/csscomb/test/core/get-config.js deleted file mode 100644 index e562ea8..0000000 --- a/node_modules/csscomb/test/core/get-config.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert'); - -describe('csscomb methods', function() { - it('getConfig()', function() { - var config = require('../../config/csscomb.json'); - - assert.equal(this.Comb.getConfig(), config); - }); - - it('getConfig(number)', function() { - assert.throws(function() { - this.Comb.getConfig(16); - }); - }); - - it('getConfig(boolean)', function() { - assert.throws(function() { - this.Comb.getConfig(true); - }); - }); - - it('getConfig(empty string)', function() { - var config = require('../../config/csscomb.json'); - - assert.equal(this.Comb.getConfig(''), config); - }); - - it('getConfig(invalid string)', function() { - assert.throws(function() { - this.Comb.getConfig('nani'); - }); - }); - - it('getConfig(csscomb)', function() { - var config = require('../../config/csscomb.json'); - - assert.equal(this.Comb.getConfig('csscomb'), config); - }); - - it('getConfig(zen)', function() { - var config = require('../../config/zen.json'); - - assert.equal(this.Comb.getConfig('zen'), config); - }); - - it('getConfig(yandex)', function() { - var config = require('../../config/yandex.json'); - - assert.equal(this.Comb.getConfig('yandex'), config); - }); -}); diff --git a/node_modules/csscomb/test/core/less.js b/node_modules/csscomb/test/core/less.js deleted file mode 100644 index dc5fefe..0000000 --- a/node_modules/csscomb/test/core/less.js +++ /dev/null @@ -1,42 +0,0 @@ -describe('LESS', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({}); - }); - - it('Should parse nested rules', function() { - this.shouldBeEqual('nested-rule.less'); - }); - - it('Should parse operations', function() { - this.shouldBeEqual('operation.less'); - }); - - it('Should parse parent selector &', function() { - this.shouldBeEqual('parent-selector.less'); - }); - - it('Should parse variables', function() { - this.shouldBeEqual('variable.less'); - }); - - it('Should parse interpolated variables inside selectors', function() { - this.shouldBeEqual('interpolated-variable-1.less'); - }); - - it('Should parse interpolated variables inside values', function() { - this.shouldBeEqual('interpolated-variable-2.less'); - }); - - it('Should parse @import', function() { - this.shouldBeEqual('import.less'); - }); - - it('Should parse included mixins', function() { - this.shouldBeEqual('mixin.less'); - }); - - it('Should parse nested @media', function() { - this.shouldBeEqual('nested-media.less'); - }); -}); diff --git a/node_modules/csscomb/test/core/less/import.less b/node_modules/csscomb/test/core/less/import.less deleted file mode 100644 index 8faa126..0000000 --- a/node_modules/csscomb/test/core/less/import.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - @import "foo.css"; - top: 0; -} diff --git a/node_modules/csscomb/test/core/less/interpolated-variable-1.less b/node_modules/csscomb/test/core/less/interpolated-variable-1.less deleted file mode 100644 index b0bc314..0000000 --- a/node_modules/csscomb/test/core/less/interpolated-variable-1.less +++ /dev/null @@ -1,4 +0,0 @@ -div.@{nani} { - color:tomato; - top:0; -} diff --git a/node_modules/csscomb/test/core/less/interpolated-variable-2.less b/node_modules/csscomb/test/core/less/interpolated-variable-2.less deleted file mode 100644 index 18a66ed..0000000 --- a/node_modules/csscomb/test/core/less/interpolated-variable-2.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: @{tomato}; - top:0; -} diff --git a/node_modules/csscomb/test/core/less/mixin.less b/node_modules/csscomb/test/core/less/mixin.less deleted file mode 100644 index 7e95951..0000000 --- a/node_modules/csscomb/test/core/less/mixin.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - .mixin; - top: 0; -} diff --git a/node_modules/csscomb/test/core/less/nested-media.less b/node_modules/csscomb/test/core/less/nested-media.less deleted file mode 100644 index 346ddbf..0000000 --- a/node_modules/csscomb/test/core/less/nested-media.less +++ /dev/null @@ -1,6 +0,0 @@ -div { - @media screen and (orientation: landscape) { - color: tomato; - } - top: 0; -} diff --git a/node_modules/csscomb/test/core/less/nested-rule.less b/node_modules/csscomb/test/core/less/nested-rule.less deleted file mode 100644 index 5f74a2d..0000000 --- a/node_modules/csscomb/test/core/less/nested-rule.less +++ /dev/null @@ -1,6 +0,0 @@ -div { - color: tomato; - a { - top: 0; - } -} diff --git a/node_modules/csscomb/test/core/less/operation.less b/node_modules/csscomb/test/core/less/operation.less deleted file mode 100644 index a3711aa..0000000 --- a/node_modules/csscomb/test/core/less/operation.less +++ /dev/null @@ -1,8 +0,0 @@ -div { - @base: 5%; - @filler: @base * 2; - @other: @base + @filler; - color: #888 / 4; - background-color: @base-color + #111; - height: 100% / 2 + @filler; -} diff --git a/node_modules/csscomb/test/core/less/parent-selector.less b/node_modules/csscomb/test/core/less/parent-selector.less deleted file mode 100644 index 6176030..0000000 --- a/node_modules/csscomb/test/core/less/parent-selector.less +++ /dev/null @@ -1,8 +0,0 @@ -div { - color: tomato; - &.top { - color: nani; - top: 0; - } - left: 0; -} diff --git a/node_modules/csscomb/test/core/less/variable.less b/node_modules/csscomb/test/core/less/variable.less deleted file mode 100644 index 8eba0cc..0000000 --- a/node_modules/csscomb/test/core/less/variable.less +++ /dev/null @@ -1,5 +0,0 @@ -@red: tomato; -div { - color: @tomato; - top: @@foo; -} diff --git a/node_modules/csscomb/test/core/scss.js b/node_modules/csscomb/test/core/scss.js deleted file mode 100644 index 925a116..0000000 --- a/node_modules/csscomb/test/core/scss.js +++ /dev/null @@ -1,107 +0,0 @@ -describe('SCSS', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({}); - }); - - it('Should parse nested rules', function() { - this.shouldBeEqual('nested-rule.scss'); - }); - - it('Should parse parent selector &', function() { - this.shouldBeEqual('parent-selector.scss'); - }); - - it('Should parse nested properties', function() { - this.shouldBeEqual('nested-property.scss'); - }); - - it('Should parse variables', function() { - this.shouldBeEqual('variable.scss'); - }); - - it('Should parse interpolated variables inside selectors', function() { - this.shouldBeEqual('interpolated-variable-1.scss'); - }); - - it('Should parse interpolated variables inside values', function() { - this.shouldBeEqual('interpolated-variable-2.scss'); - }); - - it('Should parse defaults', function() { - this.shouldBeEqual('default.scss'); - }); - - it('Should parse @import', function() { - this.shouldBeEqual('import.scss'); - }); - - it('Should parse @include', function() { - this.shouldBeEqual('include.scss'); - }); - - it('Should parse nested @media', function() { - this.shouldBeEqual('nested-media.scss'); - }); - - it('Should parse @extend with classes', function() { - this.shouldBeEqual('extend-1.scss'); - }); - - it('Should parse @extend with placeholders', function() { - this.shouldBeEqual('extend-2.scss'); - }); - - it('Should parse @warn', function() { - this.shouldBeEqual('warn.scss'); - }); - - it('Should parse @if', function() { - this.shouldBeEqual('if.scss'); - }); - - it('Should parse @if and @else', function() { - this.shouldBeEqual('if-else.scss'); - }); - - it('Should parse @if and @else if', function() { - this.shouldBeEqual('if-else-if.scss'); - }); - - it('Should parse @for', function() { - this.shouldBeEqual('for.scss'); - }); - - it('Should parse @each', function() { - this.shouldBeEqual('each.scss'); - }); - - it('Should parse @while', function() { - this.shouldBeEqual('while.scss'); - }); - - it('Should parse mixins', function() { - this.shouldBeEqual('mixin-1.scss'); - }); - - it('Should parse passing several variables to a mixin', function() { - this.shouldBeEqual('mixin-2.scss'); - }); - - it('Should parse passing a list of variables to a mixin', function() { - this.shouldBeEqual('mixin-3.scss'); - }); - - it('Should parse passing a content block to a mixin', function() { - this.shouldBeEqual('mixin-4.scss'); - }); - - it('Should parse @content', function() { - this.shouldBeEqual('content.scss'); - }); - - it('Should parse functions', function() { - this.shouldBeEqual('function.scss'); - }); -}); - diff --git a/node_modules/csscomb/test/core/scss/content.scss b/node_modules/csscomb/test/core/scss/content.scss deleted file mode 100644 index 6852bcc..0000000 --- a/node_modules/csscomb/test/core/scss/content.scss +++ /dev/null @@ -1,5 +0,0 @@ -@mixin nani { - a { - @content; - } -} diff --git a/node_modules/csscomb/test/core/scss/default.scss b/node_modules/csscomb/test/core/scss/default.scss deleted file mode 100644 index 12c10f9..0000000 --- a/node_modules/csscomb/test/core/scss/default.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato !default; - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/each.scss b/node_modules/csscomb/test/core/scss/each.scss deleted file mode 100644 index af596e6..0000000 --- a/node_modules/csscomb/test/core/scss/each.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - @each $animal in puma, sea-slug, erget { - .#{$animal}-icon { - background-image: url("/images/#{$animal}.png"); - } - } -} diff --git a/node_modules/csscomb/test/core/scss/extend-1.scss b/node_modules/csscomb/test/core/scss/extend-1.scss deleted file mode 100644 index c72afea..0000000 --- a/node_modules/csscomb/test/core/scss/extend-1.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - @extend .nani; - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/extend-2.scss b/node_modules/csscomb/test/core/scss/extend-2.scss deleted file mode 100644 index c7bf3b5..0000000 --- a/node_modules/csscomb/test/core/scss/extend-2.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - @extend %nani; - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/for.scss b/node_modules/csscomb/test/core/scss/for.scss deleted file mode 100644 index 64ff25a..0000000 --- a/node_modules/csscomb/test/core/scss/for.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - @for $i from 1 through 3 { - .item-#{$i} { - width: 2em * 1; - } - } -} diff --git a/node_modules/csscomb/test/core/scss/function.scss b/node_modules/csscomb/test/core/scss/function.scss deleted file mode 100644 index 8fcce43..0000000 --- a/node_modules/csscomb/test/core/scss/function.scss +++ /dev/null @@ -1,3 +0,0 @@ -@function nani($n) { - @return $n * 2; -} diff --git a/node_modules/csscomb/test/core/scss/if-else-if.scss b/node_modules/csscomb/test/core/scss/if-else-if.scss deleted file mode 100644 index f16e287..0000000 --- a/node_modules/csscomb/test/core/scss/if-else-if.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - @if $type == ocean { - top: 0; - } @else if $type == monster { - left: 0; - } -} diff --git a/node_modules/csscomb/test/core/scss/if-else.scss b/node_modules/csscomb/test/core/scss/if-else.scss deleted file mode 100644 index 236a621..0000000 --- a/node_modules/csscomb/test/core/scss/if-else.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - @if $type == ocean { - top: 0; - } @else { - left: 0; - } -} diff --git a/node_modules/csscomb/test/core/scss/if.scss b/node_modules/csscomb/test/core/scss/if.scss deleted file mode 100644 index af9f485..0000000 --- a/node_modules/csscomb/test/core/scss/if.scss +++ /dev/null @@ -1,5 +0,0 @@ -div { - @if $type == ocean { - top: 0; - } -} diff --git a/node_modules/csscomb/test/core/scss/import.scss b/node_modules/csscomb/test/core/scss/import.scss deleted file mode 100644 index 8faa126..0000000 --- a/node_modules/csscomb/test/core/scss/import.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - @import "foo.css"; - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/include.scss b/node_modules/csscomb/test/core/scss/include.scss deleted file mode 100644 index 2c91880..0000000 --- a/node_modules/csscomb/test/core/scss/include.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - @include nani($panda); - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/interpolated-variable-1.scss b/node_modules/csscomb/test/core/scss/interpolated-variable-1.scss deleted file mode 100644 index a6c28cf..0000000 --- a/node_modules/csscomb/test/core/scss/interpolated-variable-1.scss +++ /dev/null @@ -1,4 +0,0 @@ -div.#{$nani} { - color: tomato; - top:0; -} diff --git a/node_modules/csscomb/test/core/scss/interpolated-variable-2.scss b/node_modules/csscomb/test/core/scss/interpolated-variable-2.scss deleted file mode 100644 index a19498f..0000000 --- a/node_modules/csscomb/test/core/scss/interpolated-variable-2.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: #{$tomato}; - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/mixin-1.scss b/node_modules/csscomb/test/core/scss/mixin-1.scss deleted file mode 100644 index 32a7715..0000000 --- a/node_modules/csscomb/test/core/scss/mixin-1.scss +++ /dev/null @@ -1,6 +0,0 @@ -@mixin nani { - color: tomato; -} -.foo { - @include nani; -} diff --git a/node_modules/csscomb/test/core/scss/mixin-2.scss b/node_modules/csscomb/test/core/scss/mixin-2.scss deleted file mode 100644 index b779b6d..0000000 --- a/node_modules/csscomb/test/core/scss/mixin-2.scss +++ /dev/null @@ -1,6 +0,0 @@ -@mixin nani($tomato) { - color: $tomato; -} -.foo { - @include nani(red); -} diff --git a/node_modules/csscomb/test/core/scss/mixin-3.scss b/node_modules/csscomb/test/core/scss/mixin-3.scss deleted file mode 100644 index 2c19b35..0000000 --- a/node_modules/csscomb/test/core/scss/mixin-3.scss +++ /dev/null @@ -1,6 +0,0 @@ -@mixin nani($shadows...) { - box-shadow: $shadows; -} -.foo { - @include nani(0px 4px 5px #666, 2px 6px 10px #999); -} diff --git a/node_modules/csscomb/test/core/scss/mixin-4.scss b/node_modules/csscomb/test/core/scss/mixin-4.scss deleted file mode 100644 index 4e46ffe..0000000 --- a/node_modules/csscomb/test/core/scss/mixin-4.scss +++ /dev/null @@ -1,6 +0,0 @@ -.foo { - @include nani { - color: tomato; - top: 0 - } -} diff --git a/node_modules/csscomb/test/core/scss/nested-media.scss b/node_modules/csscomb/test/core/scss/nested-media.scss deleted file mode 100644 index 346ddbf..0000000 --- a/node_modules/csscomb/test/core/scss/nested-media.scss +++ /dev/null @@ -1,6 +0,0 @@ -div { - @media screen and (orientation: landscape) { - color: tomato; - } - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/nested-property.scss b/node_modules/csscomb/test/core/scss/nested-property.scss deleted file mode 100644 index 2f6384a..0000000 --- a/node_modules/csscomb/test/core/scss/nested-property.scss +++ /dev/null @@ -1,8 +0,0 @@ -div { - color: tomato; - font: 2px/3px { - family: fantasy; - size: 30em; - } - left: 0; -} diff --git a/node_modules/csscomb/test/core/scss/nested-rule.scss b/node_modules/csscomb/test/core/scss/nested-rule.scss deleted file mode 100644 index 5f74a2d..0000000 --- a/node_modules/csscomb/test/core/scss/nested-rule.scss +++ /dev/null @@ -1,6 +0,0 @@ -div { - color: tomato; - a { - top: 0; - } -} diff --git a/node_modules/csscomb/test/core/scss/parent-selector.scss b/node_modules/csscomb/test/core/scss/parent-selector.scss deleted file mode 100644 index 6176030..0000000 --- a/node_modules/csscomb/test/core/scss/parent-selector.scss +++ /dev/null @@ -1,8 +0,0 @@ -div { - color: tomato; - &.top { - color: nani; - top: 0; - } - left: 0; -} diff --git a/node_modules/csscomb/test/core/scss/variable.scss b/node_modules/csscomb/test/core/scss/variable.scss deleted file mode 100644 index d553b92..0000000 --- a/node_modules/csscomb/test/core/scss/variable.scss +++ /dev/null @@ -1,4 +0,0 @@ -$red: tomato; -div { - color: $tomato; -} diff --git a/node_modules/csscomb/test/core/scss/warn.scss b/node_modules/csscomb/test/core/scss/warn.scss deleted file mode 100644 index c7961a1..0000000 --- a/node_modules/csscomb/test/core/scss/warn.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - @warn "nani"; - top: 0; -} diff --git a/node_modules/csscomb/test/core/scss/while.scss b/node_modules/csscomb/test/core/scss/while.scss deleted file mode 100644 index 89c6cfa..0000000 --- a/node_modules/csscomb/test/core/scss/while.scss +++ /dev/null @@ -1,8 +0,0 @@ -div { - @while $i > 6 { - .item { - width: 2em * $i; - } - $i: $i - 2; - } -} diff --git a/node_modules/csscomb/test/core/use.js b/node_modules/csscomb/test/core/use.js deleted file mode 100644 index e14f43c..0000000 --- a/node_modules/csscomb/test/core/use.js +++ /dev/null @@ -1,41 +0,0 @@ -var assert = require('assert'); - -describe('.use()', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should set predefined options in correct order', function() { - var config = this.Comb.getConfig('csscomb'); - this.comb.configure(config); - var options = this.comb.getOptionsOrder(); - var expected = [ - 'always-semicolon', - 'remove-empty-rulesets', - 'color-case', - 'color-shorthand', - 'element-case', - 'eof-newline', - 'leading-zero', - 'quotes', - 'sort-order-fallback', - 'space-after-colon', - 'space-after-combinator', - 'space-after-opening-brace', - 'space-after-selector-delimiter', - 'space-before-colon', - 'space-before-combinator', - 'space-before-opening-brace', - 'space-before-selector-delimiter', - 'space-between-declarations', - 'block-indent', - 'sort-order', - 'strip-spaces', - 'space-before-closing-brace', - 'unitless-zero', - 'tab-size', - 'vendor-prefix-align' - ]; - assert.deepEqual(options, expected); - }); -}); diff --git a/node_modules/csscomb/test/mocha.js b/node_modules/csscomb/test/mocha.js deleted file mode 100644 index 5f5fb7a..0000000 --- a/node_modules/csscomb/test/mocha.js +++ /dev/null @@ -1,93 +0,0 @@ -var Comb = process.env.TEST_COV ? - require('../lib-cov/csscomb') : require('../lib/csscomb'); -var Mocha = require('mocha'); -var assert = require('assert'); -var fs = require('fs'); -var path = require('path'); - -var mocha = new Mocha(); -if (process.env.TEST_COV) mocha.reporter('html-cov'); - -// Tell mocha which tests to run: -['test/core', 'test/options'].forEach(function(dirname) { - fs.readdirSync(dirname).forEach(function(file) { - mocha.addFile(path.join(dirname, file)); - }); -}); - -// Add helpers (see tests for usage examples): -mocha.suite.beforeEach(function() { - this.Comb = Comb; - this.comb = new Comb(); - this.filename = ''; - - /** - * Read css file from test suite's directory. - * If run inside `test/core/cli.js` file, `this.readFile('nani.css')` will - * return content of `test/core/cli/nani.css` file. - * `this.filename = __filename` is required if this helper is used in a test - * case (see tests for examples). - * @param {String} filename Name of file that is located in test folder - * @returns {String} File's content - */ - this.readFile = function(filename) { - // Remove `.js` from test suite's name: - var dirname = this.filename.slice(0, -3); - return fs.readFileSync(dirname + '/' + filename, 'utf8'); - }; - - /** - * Comb a file and compare the result with expected. - * If `expected` is not defined, check that file's content does not change - * after combing. - * File names should be relative to test suite's folder. - * @param {String} input Name of file that should be combed - * @param {String} [expected] Name of file with expected content - */ - this.shouldBeEqual = function(input, expected) { - var syntax = input.split('.').pop(); - input = this.readFile(input); - expected = expected ? this.readFile(expected) : input; - assert.equal(this.comb.processString(input, { syntax: syntax }), expected); - }; - - /** - * Detect options in a file and compare result with expected. - * File names should be relative to test suite's folder. - * @param {Array} options List of options that should be detected - * @param {String} input Name of template file - * @param {Object} expected Expected config with detected options - */ - this.shouldDetect = function(options, input, expected) { - // We need to “sort” the input and expected objects, as their order may vary - function sortObject(o) { - var sorted = {}; - var key = []; - var a = []; - - for (key in o) { - if (o.hasOwnProperty(key)) { - a.push(key); - } - } - - a.sort(); - - for (key = 0; key < a.length; key++) { - sorted[a[key]] = o[a[key]]; - } - return sorted; - } - assert.equal( - JSON.stringify(sortObject(Comb.detectInString(input, options))), - JSON.stringify(sortObject(expected)) - ); - }; -}); - -mocha.run(function(failures) { - process.on('exit', function() { - process.exit(failures); - }); -}); - diff --git a/node_modules/csscomb/test/options/always-semicolon-less.js b/node_modules/csscomb/test/options/always-semicolon-less.js deleted file mode 100644 index b366c12..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less.js +++ /dev/null @@ -1,54 +0,0 @@ -describe('options/always-semicolon (scss)', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({ 'always-semicolon': true }); - }); - - it('Should not add semicolon to condition (single-line style)', function() { - this.shouldBeEqual('condition.less'); - }); - - it('Should not add semicolon to condition (multi-line style)', function() { - this.shouldBeEqual('condition-multiline.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 1 (single-line style)', function() { - this.shouldBeEqual('include-1.less', 'include-1.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 1 (multi-line style)', function() { - this.shouldBeEqual('include-1-multiline.less', 'include-1-multiline.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 2 (single-line style)', function() { - this.shouldBeEqual('include-2.less', 'include-2.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 2 (multi-line style)', function() { - this.shouldBeEqual('include-2-multiline.less', 'include-2-multiline.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 3 (single-line style)', function() { - this.shouldBeEqual('include-3.less', 'include-3.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 3 (multi-line style)', function() { - this.shouldBeEqual('include-3-multiline.less', 'include-3-multiline.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 4 (single-line style)', function() { - this.shouldBeEqual('include-4.less', 'include-4.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 4 (multi-line style)', function() { - this.shouldBeEqual('include-4-multiline.less', 'include-4-multiline.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 5 (single-line style)', function() { - this.shouldBeEqual('include-5.less', 'include-5.expected.less'); - }); - - it('Should add semicolon to last included mixin if missing. Test 5 (multi-line style)', function() { - this.shouldBeEqual('include-5-multiline.less', 'include-5-multiline.expected.less'); - }); -}); diff --git a/node_modules/csscomb/test/options/always-semicolon-less/condition-multiline.less b/node_modules/csscomb/test/options/always-semicolon-less/condition-multiline.less deleted file mode 100644 index b307117..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/condition-multiline.less +++ /dev/null @@ -1,6 +0,0 @@ -div { - @color: tomato; - when (@color = tomato) { - top: 0; - } - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/condition.less b/node_modules/csscomb/test/options/always-semicolon-less/condition.less deleted file mode 100644 index c0c4950..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/condition.less +++ /dev/null @@ -1 +0,0 @@ -div { @color: tomato; when (@color = tomato) { top: 0; } } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.expected.less deleted file mode 100644 index 77cf666..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.expected.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - .nani; - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.less b/node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.less deleted file mode 100644 index 9daab17..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-1-multiline.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - .nani - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-1.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-1.expected.less deleted file mode 100644 index 9058edc..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-1.expected.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; .nani; } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-1.less b/node_modules/csscomb/test/options/always-semicolon-less/include-1.less deleted file mode 100644 index 4e47017..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-1.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; .nani } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.expected.less deleted file mode 100644 index 6877e14..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.expected.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - .nani(2px); - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.less b/node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.less deleted file mode 100644 index c419ae5..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-2-multiline.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - .nani(2px) - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-2.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-2.expected.less deleted file mode 100644 index 3fb4335..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-2.expected.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; .nani(2px); } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-2.less b/node_modules/csscomb/test/options/always-semicolon-less/include-2.less deleted file mode 100644 index 1ed55fe..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-2.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; .nani(2px) } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.expected.less deleted file mode 100644 index d51df78..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.expected.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - .nani(2px) !important; - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.less b/node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.less deleted file mode 100644 index 4d628b8..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-3-multiline.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - .nani(2px) !important - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-3.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-3.expected.less deleted file mode 100644 index 117678f..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-3.expected.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; .nani(2px) !important; } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-3.less b/node_modules/csscomb/test/options/always-semicolon-less/include-3.less deleted file mode 100644 index 3098898..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-3.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; .nani(2px) !important } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.expected.less deleted file mode 100644 index 1efba9e..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.expected.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - #bundle > .button; - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.less b/node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.less deleted file mode 100644 index f16812d..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-4-multiline.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - #bundle > .button - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-4.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-4.expected.less deleted file mode 100644 index 1b3c6d8..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-4.expected.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; #bundle > .button; } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-4.less b/node_modules/csscomb/test/options/always-semicolon-less/include-4.less deleted file mode 100644 index 9221814..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-4.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; #bundle > .button } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.expected.less deleted file mode 100644 index 4c15e42..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.expected.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - @color: tomato; - #bundle > .button (@color); - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.less b/node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.less deleted file mode 100644 index 15d03fc..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-5-multiline.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - @color: tomato; - #bundle > .button (@color) - } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-5.expected.less b/node_modules/csscomb/test/options/always-semicolon-less/include-5.expected.less deleted file mode 100644 index 718c5c5..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-5.expected.less +++ /dev/null @@ -1 +0,0 @@ -div { @color: tomato; #bundle > .button (@color); } diff --git a/node_modules/csscomb/test/options/always-semicolon-less/include-5.less b/node_modules/csscomb/test/options/always-semicolon-less/include-5.less deleted file mode 100644 index 6bf447c..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-less/include-5.less +++ /dev/null @@ -1 +0,0 @@ -div { @color: tomato; #bundle > .button (@color) } diff --git a/node_modules/csscomb/test/options/always-semicolon-sass.js b/node_modules/csscomb/test/options/always-semicolon-sass.js deleted file mode 100644 index 3b96922..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-sass.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('options/always-semicolon (scss)', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({ 'always-semicolon': true }); - }); - - it('Should not add semicolon', function() { - this.shouldBeEqual('test.sass'); - }); -}); diff --git a/node_modules/csscomb/test/options/always-semicolon-sass/test.sass b/node_modules/csscomb/test/options/always-semicolon-sass/test.sass deleted file mode 100644 index 6284097..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-sass/test.sass +++ /dev/null @@ -1,7 +0,0 @@ -a - color: tomato - top: 0 - - p - a: b - c:d diff --git a/node_modules/csscomb/test/options/always-semicolon-scss.js b/node_modules/csscomb/test/options/always-semicolon-scss.js deleted file mode 100644 index 48ec6ec..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss.js +++ /dev/null @@ -1,62 +0,0 @@ -describe('options/always-semicolon (scss)', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({ 'always-semicolon': true }); - }); - - it('Should not add semicolon if last value is block (singl-line style)', function() { - this.shouldBeEqual('block-value.scss'); - }); - - it('Should not add semicolon if last value is block (multi-line style)', function() { - this.shouldBeEqual('block-value-multiline.scss'); - }); - - it('Should add semicolon to last included mixin if missing. Test 1 (single-line style)', function() { - this.shouldBeEqual('include-1.scss', 'include-1.expected.scss'); - }); - - it('Should add semicolon to last included mixin if missing. Test 1 (multi-line style)', function() { - this.shouldBeEqual('include-1-multiline.scss', 'include-1-multiline.expected.scss'); - }); - - it('Should add semicolon to last included mixin if missing. Test 2 (single-line style)', function() { - this.shouldBeEqual('include-2.scss', 'include-2.expected.scss'); - }); - - it('Should add semicolon to last included mixin if missing. Test 2 (multi-line style)', function() { - this.shouldBeEqual('include-2-multiline.scss', 'include-2-multiline.expected.scss'); - }); - - it('Should not add semicolon to last included mixin if there is a block (single-line style)', function() { - this.shouldBeEqual('block-include.scss'); - }); - - it('Should not add semicolon to last included mixin if there is a block (multi-line style)', function() { - this.shouldBeEqual('block-include-multiline.scss'); - }); - - it('Should add semicolon to last extend if missing (single-line style)', function() { - this.shouldBeEqual('extend.scss', 'extend.expected.scss'); - }); - - it('Should add semicolon to last extend if missing (multi-line style)', function() { - this.shouldBeEqual('extend-multiline.scss', 'extend-multiline.expected.scss'); - }); - - it('Should not add semicolon to condition (single-line style)', function() { - this.shouldBeEqual('condition.scss'); - }); - - it('Should not add semicolon to condition (multi-line style)', function() { - this.shouldBeEqual('condition-multiline.scss'); - }); - - it('Should not add semicolon to loop (single-line style)', function() { - this.shouldBeEqual('loop.scss'); - }); - - it('Should not add semicolon to loop (multi-line style)', function() { - this.shouldBeEqual('loop-multiline.scss'); - }); -}); diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/block-include-multiline.scss b/node_modules/csscomb/test/options/always-semicolon-scss/block-include-multiline.scss deleted file mode 100644 index a9e5aa9..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/block-include-multiline.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - color: tomato; - @include nani { - top: 0; - content: ''; - } - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/block-include.scss b/node_modules/csscomb/test/options/always-semicolon-scss/block-include.scss deleted file mode 100644 index 251fa78..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/block-include.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @include nani { top: 0; content: ''; } } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/block-value-multiline.scss b/node_modules/csscomb/test/options/always-semicolon-scss/block-value-multiline.scss deleted file mode 100644 index f654043..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/block-value-multiline.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - color: tomato; - font: { - family: fantasy; - size: 16px; - } - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/block-value.scss b/node_modules/csscomb/test/options/always-semicolon-scss/block-value.scss deleted file mode 100644 index 15f19e2..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/block-value.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; font: { family: fantasy; size: 16px; } } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/condition-multiline.scss b/node_modules/csscomb/test/options/always-semicolon-scss/condition-multiline.scss deleted file mode 100644 index 7aeb8af..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/condition-multiline.scss +++ /dev/null @@ -1,6 +0,0 @@ -div { - $color: tomato; - @if $color == tomato { - top: 0; - } - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/condition.scss b/node_modules/csscomb/test/options/always-semicolon-scss/condition.scss deleted file mode 100644 index 692cbca..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/condition.scss +++ /dev/null @@ -1 +0,0 @@ -div { $color: tomato; @if $color == tomato { top: 0; } } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.expected.scss b/node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.expected.scss deleted file mode 100644 index eaaa0c7..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.expected.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - @extend .nani; - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.scss b/node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.scss deleted file mode 100644 index 6493e72..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/extend-multiline.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - @extend .nani - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/extend.expected.scss b/node_modules/csscomb/test/options/always-semicolon-scss/extend.expected.scss deleted file mode 100644 index ec45b2e..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/extend.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @extend .nani; } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/extend.scss b/node_modules/csscomb/test/options/always-semicolon-scss/extend.scss deleted file mode 100644 index 8f545cc..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/extend.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @extend .nani } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.expected.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.expected.scss deleted file mode 100644 index d8db3e3..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.expected.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - @include nani; - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.scss deleted file mode 100644 index bf95505..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-1-multiline.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - @include nani - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-1.expected.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-1.expected.scss deleted file mode 100644 index 2feaaec..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-1.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @include nani; } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-1.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-1.scss deleted file mode 100644 index 204e35d..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-1.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @include nani } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.expected.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.expected.scss deleted file mode 100644 index e0c3600..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.expected.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - @include nani(10); - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.scss deleted file mode 100644 index ad05456..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-2-multiline.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - @include nani(10) - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-2.expected.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-2.expected.scss deleted file mode 100644 index 8771956..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-2.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @include nani(10); } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/include-2.scss b/node_modules/csscomb/test/options/always-semicolon-scss/include-2.scss deleted file mode 100644 index f5bccc9..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/include-2.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @include nani(10) } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/loop-multiline.scss b/node_modules/csscomb/test/options/always-semicolon-scss/loop-multiline.scss deleted file mode 100644 index 5768e29..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/loop-multiline.scss +++ /dev/null @@ -1,6 +0,0 @@ -div { - color: tomato; - @while 1 > 2 { - top: 0; - } - } diff --git a/node_modules/csscomb/test/options/always-semicolon-scss/loop.scss b/node_modules/csscomb/test/options/always-semicolon-scss/loop.scss deleted file mode 100644 index afb46f9..0000000 --- a/node_modules/csscomb/test/options/always-semicolon-scss/loop.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @while 1 > 2 { top: 0; } } diff --git a/node_modules/csscomb/test/options/always-semicolon.js b/node_modules/csscomb/test/options/always-semicolon.js deleted file mode 100644 index a20f8d3..0000000 --- a/node_modules/csscomb/test/options/always-semicolon.js +++ /dev/null @@ -1,125 +0,0 @@ -var assert = require('assert'); - -describe('options/always-semicolon', function() { - it('Should add semicolon for last property if missing. Test 1', function() { - this.comb.configure({ 'always-semicolon': true }); - assert.equal( - this.comb.processString( - 'div { height: 0 }' - ), - 'div { height: 0; }' - ); - }); - - it('Should add semicolon for last property if missing. Test 2', function() { - this.comb.configure({ 'always-semicolon': true }); - assert.equal( - this.comb.processString( - 'div {\nheight: 0\n}' - ), - 'div {\nheight: 0;\n}' - ); - }); - - it('Should add semicolon for last property if missing. Test 3', function() { - this.comb.configure({ 'always-semicolon': true }); - assert.equal( - this.comb.processString( - 'div {height: 0}' - ), - 'div {height: 0;}' - ); - }); - - it('Should add semicolon for last property if missing. Test 4', function() { - this.comb.configure({ 'always-semicolon': true }); - assert.equal( - this.comb.processString( - 'div {\nheight: 0 /* Comment */\n}' - ), - 'div {\nheight: 0; /* Comment */\n}' - ); - }); - - it('Should add semicolon for last property if missing. Test 5', function() { - this.comb.configure({ 'always-semicolon': true }); - assert.equal( - this.comb.processString( - 'div {\ntop: 1px;\nheight: 0 /* 1comment */ /* 2comment */\n}' - ), - 'div {\ntop: 1px;\nheight: 0; /* 1comment */ /* 2comment */\n}' - ); - }); - - it('Should detect semicolon for last property. Test 1', function() { - this.shouldDetect( - ['always-semicolon'], - 'div { height: 0 }', - { - 'always-semicolon': false - } - ); - }); - - it('Should detect semicolon for last property. Test 2', function() { - this.shouldDetect( - ['always-semicolon'], - 'div { height: 0; }', - { - 'always-semicolon': true - } - ); - }); - - it('Should detect semicolon for last property. Test 3', function() { - this.shouldDetect( - ['always-semicolon'], - 'div { height: 0; } div { height: 0 }', - { - 'always-semicolon': true - } - ); - }); - - it('Should detect semicolon for last property. Test 4', function() { - this.shouldDetect( - ['always-semicolon'], - 'div { height: 0 } div { height: 0; } div { height: 0 }', - { - 'always-semicolon': false - } - ); - }); - - it('Should detect semicolon for last property. Test 5', function() { - this.shouldDetect( - ['always-semicolon'], - 'div {\nheight: 0 /* Comment */\n} ' + - 'div { height: 0; }' + - 'div {\ntop: 1px;\nheight: 0 /* 1comment */ /* 2comment */\n}', - { - 'always-semicolon': false - } - ); - }); - - - it('Should detect semicolon for last property. Test 6', function() { - this.shouldDetect( - ['always-semicolon'], - 'a{\n border:0;\n}', - { - 'always-semicolon': true - } - ); - }); - - it('Should not detect semicolon for last property if there are no properties', function() { - this.shouldDetect( - ['always-semicolon'], - 'div {}', - {} - ); - }); - -}); diff --git a/node_modules/csscomb/test/options/block-indent-sass.js b/node_modules/csscomb/test/options/block-indent-sass.js deleted file mode 100644 index 33b6add..0000000 --- a/node_modules/csscomb/test/options/block-indent-sass.js +++ /dev/null @@ -1,21 +0,0 @@ -describe('options/block-indent (sass):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('First level ruleset\'s block', function() { - this.comb.configure({ 'block-indent': 2 }); - this.shouldBeEqual('block.sass', 'block.expected.sass'); - }); - - it('Nested ruleset', function() { - this.comb.configure({ 'block-indent': 2 }); - this.shouldBeEqual('nested-ruleset.sass', 'nested-ruleset.expected.sass'); - }); - - it('Mixin', function() { - this.comb.configure({ 'block-indent': 4 }); - this.shouldBeEqual('mixin.sass', 'mixin.expected.sass'); - }); -}); - diff --git a/node_modules/csscomb/test/options/block-indent-sass/block.expected.sass b/node_modules/csscomb/test/options/block-indent-sass/block.expected.sass deleted file mode 100644 index ddae383..0000000 --- a/node_modules/csscomb/test/options/block-indent-sass/block.expected.sass +++ /dev/null @@ -1,6 +0,0 @@ -a - color: tomato - top: 0 - -p - bottom: 0 diff --git a/node_modules/csscomb/test/options/block-indent-sass/block.sass b/node_modules/csscomb/test/options/block-indent-sass/block.sass deleted file mode 100644 index 9be6816..0000000 --- a/node_modules/csscomb/test/options/block-indent-sass/block.sass +++ /dev/null @@ -1,6 +0,0 @@ -a - color: tomato - top: 0 - -p - bottom: 0 diff --git a/node_modules/csscomb/test/options/block-indent-sass/mixin.expected.sass b/node_modules/csscomb/test/options/block-indent-sass/mixin.expected.sass deleted file mode 100644 index f935113..0000000 --- a/node_modules/csscomb/test/options/block-indent-sass/mixin.expected.sass +++ /dev/null @@ -1,8 +0,0 @@ -@mixin sexy-border($color, $width: 1px) - border: - color: $color - width: $width - style: dashed - -p - +sexy-border(blue) diff --git a/node_modules/csscomb/test/options/block-indent-sass/mixin.sass b/node_modules/csscomb/test/options/block-indent-sass/mixin.sass deleted file mode 100644 index d25771d..0000000 --- a/node_modules/csscomb/test/options/block-indent-sass/mixin.sass +++ /dev/null @@ -1,8 +0,0 @@ -@mixin sexy-border($color, $width: 1px) - border: - color: $color - width: $width - style: dashed - -p - +sexy-border(blue) diff --git a/node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.expected.sass b/node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.expected.sass deleted file mode 100644 index 2c7edc6..0000000 --- a/node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.expected.sass +++ /dev/null @@ -1,9 +0,0 @@ -a - color: tomato - top: 0 - - p - bottom: 0 - - &:hover - color: yellow diff --git a/node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.sass b/node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.sass deleted file mode 100644 index 8567d2e..0000000 --- a/node_modules/csscomb/test/options/block-indent-sass/nested-ruleset.sass +++ /dev/null @@ -1,9 +0,0 @@ -a - color: tomato - top: 0 - - p - bottom: 0 - - &:hover - color: yellow diff --git a/node_modules/csscomb/test/options/block-indent-scss.js b/node_modules/csscomb/test/options/block-indent-scss.js deleted file mode 100644 index 34130dc..0000000 --- a/node_modules/csscomb/test/options/block-indent-scss.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('options/block-indent (scss):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Issue 213', function() { - this.comb.configure({ 'block-indent': 2 }); - this.shouldBeEqual('nested-include.scss', 'nested-include.expected.scss'); - }); -}); diff --git a/node_modules/csscomb/test/options/block-indent-scss/nested-include.expected.scss b/node_modules/csscomb/test/options/block-indent-scss/nested-include.expected.scss deleted file mode 100644 index c419883..0000000 --- a/node_modules/csscomb/test/options/block-indent-scss/nested-include.expected.scss +++ /dev/null @@ -1,5 +0,0 @@ -li{ - @include respond-to(mobile){ float: none; } - float: left; - width: 25%; - } diff --git a/node_modules/csscomb/test/options/block-indent-scss/nested-include.scss b/node_modules/csscomb/test/options/block-indent-scss/nested-include.scss deleted file mode 100644 index 93504be..0000000 --- a/node_modules/csscomb/test/options/block-indent-scss/nested-include.scss +++ /dev/null @@ -1,5 +0,0 @@ -li{ - @include respond-to(mobile){ float: none; } - float: left; - width: 25%; -} diff --git a/node_modules/csscomb/test/options/block-indent.js b/node_modules/csscomb/test/options/block-indent.js deleted file mode 100644 index 9123961..0000000 --- a/node_modules/csscomb/test/options/block-indent.js +++ /dev/null @@ -1,66 +0,0 @@ -describe('options/block-indent:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'block-indent': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'block-indent': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'block-indent': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper number of spaces', function() { - this.comb.configure({ 'block-indent': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value => should set proper number of spaces', function() { - this.comb.configure({ 'block-indent': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Should detect nothing with an empty block, test 1', function() { - this.shouldDetect( - ['block-indent'], - 'a{ }', - {} - ); - }); - - it('Should detect nothing with an empty block, test 2', function() { - this.shouldDetect( - ['block-indent'], - 'a{}', - {} - ); - }); - - it('Should detect correct number of spaces', function() { - this.shouldDetect( - ['block-indent'], - 'a{\n top: 0;\n color: tomato;\n}', - { 'block-indent': ' ' } - ); - }); - - it('Should detect no indent for one-line code', function() { - this.shouldDetect( - ['block-indent'], - 'a{ top: 0; color: tomato; }', - {} - ); - }); - it('Valid string value => should set proper space after combnator', function() { - this.comb.configure({ 'block-indent': ' ', 'space-before-closing-brace': '\n' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); -}); diff --git a/node_modules/csscomb/test/options/block-indent/test-2.expected.css b/node_modules/csscomb/test/options/block-indent/test-2.expected.css deleted file mode 100644 index 467a932..0000000 --- a/node_modules/csscomb/test/options/block-indent/test-2.expected.css +++ /dev/null @@ -1,30 +0,0 @@ -a {color: tomato; top: 0;} - -a { color: tomato; - top: 0; } - -a { color: tomato; - top: 0; } - -a { - color: tomato; - top: 0; } - -a { - color: tomato; - top: 0; - } - -a { - color: tomato; - top: 0; - } - -@media print { a {color: tomato; top: 0; } } - -@media print { - a { - color: tomato; - top: 0; - } - } diff --git a/node_modules/csscomb/test/options/block-indent/test-3.expected.css b/node_modules/csscomb/test/options/block-indent/test-3.expected.css deleted file mode 100644 index 684ff98..0000000 --- a/node_modules/csscomb/test/options/block-indent/test-3.expected.css +++ /dev/null @@ -1,36 +0,0 @@ -a {color: tomato; top: 0; -} - -a { color: tomato; - top: 0; -} - -a { color: tomato; - top: 0; -} - -a { - color: tomato; - top: 0; -} - -a { - color: tomato; - top: 0; -} - -a { - color: tomato; - top: 0; -} - -@media print { a {color: tomato; top: 0; - } -} - -@media print { - a { - color: tomato; - top: 0; - } -} diff --git a/node_modules/csscomb/test/options/block-indent/test.css b/node_modules/csscomb/test/options/block-indent/test.css deleted file mode 100644 index b1b52eb..0000000 --- a/node_modules/csscomb/test/options/block-indent/test.css +++ /dev/null @@ -1,30 +0,0 @@ -a {color: tomato; top: 0;} - -a { color: tomato; -top: 0; } - -a { color: tomato; - top: 0; } - -a { -color: tomato; -top: 0; } - -a { -color: tomato; -top: 0; -} - - a { - color: tomato; - top: 0; - } - -@media print { a {color: tomato; top: 0; } } - - @media print { -a { - color: tomato; - top: 0; - } - } diff --git a/node_modules/csscomb/test/options/block-indent/test.expected.css b/node_modules/csscomb/test/options/block-indent/test.expected.css deleted file mode 100644 index 0c684ec..0000000 --- a/node_modules/csscomb/test/options/block-indent/test.expected.css +++ /dev/null @@ -1,30 +0,0 @@ -a {color: tomato; top: 0;} - -a { color: tomato; -top: 0; } - -a { color: tomato; -top: 0; } - -a { -color: tomato; -top: 0; } - -a { -color: tomato; -top: 0; -} - -a { -color: tomato; -top: 0; -} - -@media print { a {color: tomato; top: 0; } } - -@media print { -a { -color: tomato; -top: 0; -} -} diff --git a/node_modules/csscomb/test/options/color-case.js b/node_modules/csscomb/test/options/color-case.js deleted file mode 100644 index e94af2f..0000000 --- a/node_modules/csscomb/test/options/color-case.js +++ /dev/null @@ -1,102 +0,0 @@ -var assert = require('assert'); - -describe('options/color-case', function() { - it('Should switch colors to upper case', function() { - this.comb.configure({ 'color-case': 'upper' }); - assert.equal( - this.comb.processString( - 'div { color: #fff }' - ), - 'div { color: #FFF }' - ); - }); - - it('Should switch colors to lower case', function() { - this.comb.configure({ 'color-case': 'lower' }); - assert.equal( - this.comb.processString( - 'div { color: #FFF }' - ), - 'div { color: #fff }' - ); - }); - - it('Should switch color-case in complex rules', function() { - this.comb.configure({ 'color-case': 'lower' }); - assert.equal( - this.comb.processString( - 'div { background: url(img.png#RND) #E3E3E3 0 100% no-repeat;' + - ' box-shadow: 1px 2px 3px 4px #F0F0F0 inset; }' - ), - 'div { background: url(img.png#RND) #e3e3e3 0 100% no-repeat;' + - ' box-shadow: 1px 2px 3px 4px #f0f0f0 inset; }' - ); - }); - - it('Should not switch selector case', function() { - this.comb.configure({ 'color-case': 'lower' }); - assert.equal( - this.comb.processString( - '#Header { color: #FFF }' - ), - '#Header { color: #fff }' - ); - }); - - it('Should detect uppercase color', function() { - this.shouldDetect( - ['color-case'], - 'a { color: #F3F3F3 }', - { - 'color-case': 'upper' - } - ); - }); - - it('Should detect lowercase color', function() { - this.shouldDetect( - ['color-case'], - 'a { color: #f6f6f6 }', - { - 'color-case': 'lower' - } - ); - }); - - it('Should detect uppercase color in a shorthand', function() { - this.shouldDetect( - ['color-case'], - 'a { color: #FFF }', - { - 'color-case': 'upper' - } - ); - }); - - it('Should detect lowercase color in a shorthand', function() { - this.shouldDetect( - ['color-case'], - 'a { color: #fff }', - { - 'color-case': 'lower' - } - ); - }); - - it('Shouldn’t detect color case if it contains only digits', function() { - this.shouldDetect( - ['color-case'], - 'a { color: #333 }', - {} - ); - }); - - it('Shouldn’t detect color case if it is in mixed case', function() { - this.shouldDetect( - ['color-case'], - 'a { color: #fFfFfF }', - {} - ); - }); - -}); diff --git a/node_modules/csscomb/test/options/color-shorthand.js b/node_modules/csscomb/test/options/color-shorthand.js deleted file mode 100644 index d1708c0..0000000 --- a/node_modules/csscomb/test/options/color-shorthand.js +++ /dev/null @@ -1,70 +0,0 @@ -var assert = require('assert'); - -describe('options/color-shorthand', function() { - it('Should shrink hexadecimal colors to 3 symbols', function() { - this.comb.configure({ 'color-shorthand': true }); - assert.equal( - this.comb.processString( - 'div { color: #aabbcc }' - ), - 'div { color: #abc }' - ); - }); - - it('Should expand hexadecimal colors to 6 symbols', function() { - this.comb.configure({ 'color-shorthand': false }); - assert.equal( - this.comb.processString( - 'div { color: #7ad }' - ), - 'div { color: #77aadd }' - ); - }); - - it('Should save case while processing', function() { - this.comb.configure({ 'color-shorthand': true }); - assert.equal( - this.comb.processString( - 'div { color: #fFAafF }' - ), - 'div { color: #fAf }' - ); - }); - - - it('Should detect non-shorthanded color', function() { - this.shouldDetect( - ['color-shorthand'], - 'a { color: #FF33EE }', - { - 'color-shorthand': false - } - ); - }); - - it('Should detect shorthanded color', function() { - this.shouldDetect( - ['color-shorthand'], - 'a { color: #fff }', - { - 'color-shorthand': true - } - ); - }); - - it('Shouldn’t detect if a color is shorthanded if it can’t be shorthanded', function() { - this.shouldDetect( - ['color-shorthand'], - 'a { color: #F3F3F3 }', - {} - ); - }); - - it('Shouldn’t detect if a color is shorthanded if it is not a vhash', function() { - this.shouldDetect( - ['color-shorthand'], - 'a { color: rgba(0,0,0,0.5) }', - {} - ); - }); -}); diff --git a/node_modules/csscomb/test/options/element-case-scss.js b/node_modules/csscomb/test/options/element-case-scss.js deleted file mode 100644 index 468ffe2..0000000 --- a/node_modules/csscomb/test/options/element-case-scss.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('options/element-case (scss):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should not touch mixin names', function() { - this.comb.configure({ 'element-case': 'lower' }); - this.shouldBeEqual('mixin.scss', 'mixin.expected.scss'); - }); -}); diff --git a/node_modules/csscomb/test/options/element-case-scss/mixin.expected.scss b/node_modules/csscomb/test/options/element-case-scss/mixin.expected.scss deleted file mode 100644 index 8700a0e..0000000 --- a/node_modules/csscomb/test/options/element-case-scss/mixin.expected.scss +++ /dev/null @@ -1,3 +0,0 @@ -a { - @include boxSizingContent(); -} diff --git a/node_modules/csscomb/test/options/element-case-scss/mixin.scss b/node_modules/csscomb/test/options/element-case-scss/mixin.scss deleted file mode 100644 index d2b5c33..0000000 --- a/node_modules/csscomb/test/options/element-case-scss/mixin.scss +++ /dev/null @@ -1,3 +0,0 @@ -A { - @include boxSizingContent(); -} diff --git a/node_modules/csscomb/test/options/element-case.js b/node_modules/csscomb/test/options/element-case.js deleted file mode 100644 index fb95287..0000000 --- a/node_modules/csscomb/test/options/element-case.js +++ /dev/null @@ -1,99 +0,0 @@ -var assert = require('assert'); - -describe('options/element-case', function() { - it('Invalid String should not change case of elements', function() { - this.comb.configure({ 'element-case': 'foobar' }); - assert.equal( - this.comb.processString( - 'LI a { color : red }' - ), - 'LI a { color : red }' - ); - }); - - it('Should switch tag name to upper case', function() { - this.comb.configure({ 'element-case': 'upper' }); - assert.equal( - this.comb.processString( - 'div { color: #fff }' - ), - 'DIV { color: #fff }' - ); - }); - - it('Should switch tag name to lower case', function() { - this.comb.configure({ 'element-case': 'lower' }); - assert.equal( - this.comb.processString( - 'DIV { color: #FFF }' - ), - 'div { color: #FFF }' - ); - }); - - it('Should switch element-case in complex rules', function() { - this.comb.configure({ 'element-case': 'lower' }); - assert.equal( - this.comb.processString( - 'UL > LI > .foo:not(A) { color: red }' - ), - 'ul > li > .foo:not(a) { color: red }' - ); - }); - - it('Should detect lowercase elements', function() { - this.shouldDetect( - ['element-case'], - 'a { color: red }', - { - 'element-case': 'lower' - } - ); - }); - - it('Should detect uppercase elements', function() { - this.shouldDetect( - ['element-case'], - 'A { color: red }', - { - 'element-case': 'upper' - } - ); - }); - - it('Should detect lowercase elements in a long selector', function() { - this.shouldDetect( - ['element-case'], - 'ul li:not(:hover) A { color: red }', - { - 'element-case': 'lower' - } - ); - }); - - it('Should detect uppercase elements in a long selector', function() { - this.shouldDetect( - ['element-case'], - 'ul .lol:not(LI) A { color: red }', - { - 'element-case': 'upper' - } - ); - }); - - it('Shouldn’t detect case of elements in a mixed case', function() { - this.shouldDetect( - ['element-case'], - 'aRtIcLe { color: red }', - {} - ); - }); - - it('Shouldn’t detect case of elements when there are no such', function() { - this.shouldDetect( - ['element-case'], - '*.lol { color: red }', - {} - ); - }); -}); diff --git a/node_modules/csscomb/test/options/eof-newline.js b/node_modules/csscomb/test/options/eof-newline.js deleted file mode 100644 index ead5fcf..0000000 --- a/node_modules/csscomb/test/options/eof-newline.js +++ /dev/null @@ -1,69 +0,0 @@ -var assert = require('assert'); - -describe('options/eof-newline', function() { - it('Invalid value should not change trim trailing brac', function() { - this.comb.configure({ 'eof-newline': 'foobar' }); - assert.equal( - this.comb.processString('a { color: red } \n'), - 'a { color: red } \n' - ); - }); - it('Boolean true value should insert line-break at eof', function() { - this.comb.configure({ 'eof-newline': true }); - assert.equal( - this.comb.processString( - 'a {color:red} ' - ), - 'a {color:red} \n' - ); - }); - it('Boolean false value should remove line-break from eof', function() { - this.comb.configure({ 'eof-newline': false }); - assert.equal( - this.comb.processString( - 'a {color:red} \n' - ), - 'a {color:red} ' - ); - }); - - it('Shouldn’t detect eof newline', function() { - this.shouldDetect( - ['eof-newline'], - 'a { color: red }', - { - 'eof-newline': false - } - ); - }); - - it('Should detect eof newline', function() { - this.shouldDetect( - ['eof-newline'], - 'a { color: red }\n', - { - 'eof-newline': true - } - ); - }); - - it('Shouldn’t detect eof newline with spaces at the end', function() { - this.shouldDetect( - ['eof-newline'], - 'a { color: red } ', - { - 'eof-newline': false - } - ); - }); - - it('Should detect eof newline with mixed spaces at the end', function() { - this.shouldDetect( - ['eof-newline'], - 'a { color: red } \n ', - { - 'eof-newline': true - } - ); - }); -}); diff --git a/node_modules/csscomb/test/options/integral.js b/node_modules/csscomb/test/options/integral.js deleted file mode 100644 index 624598d..0000000 --- a/node_modules/csscomb/test/options/integral.js +++ /dev/null @@ -1,28 +0,0 @@ -var assert = require('assert'); - -describe('integral test', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Process result must be equal to expected.css', function() { - var config = this.Comb.getConfig('csscomb'); - this.comb.configure(config); - this.shouldBeEqual('integral.css', 'integral.expected.css'); - }); - - it('Issue 252', function() { - var config = this.Comb.getConfig('csscomb'); - this.comb.configure(config); - this.shouldBeEqual('issue-252.sass', 'issue-252.expected.sass'); - }); - - it('Should detect everything in integral test', function() { - var input = this.readFile('integral.expected.css'); - // Clone the required config object, otherwise other tests would fail - var expected = JSON.parse(JSON.stringify(this.Comb.getConfig('csscomb'))); - delete expected['sort-order']; - delete expected['exclude']; - this.shouldDetect(undefined, input, expected); - }); -}); diff --git a/node_modules/csscomb/test/options/integral/integral.css b/node_modules/csscomb/test/options/integral/integral.css deleted file mode 100644 index cb280a3..0000000 --- a/node_modules/csscomb/test/options/integral/integral.css +++ /dev/null @@ -1,129 +0,0 @@ -/* foobar */ -@media all and (min-width:0px) {.radio-button_theme_normal .radio-button__radio:before - { - background: rgba(0,0,0,0.4); - background: -webkit-linear-gradient(top, rgba(0,0,0,0.2) 0,rgba(0,0,0,0.4) 100%); - background: -moz-linear-gradient(top, rgba(0,0,0,0.2) 0, rgba(0,0,0,0.4) 100%); - background: -o-linear-gradient(top, rgba(0,0,0,0.2) 0,rgba(0,0,0,0.4) 100%); - background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0,rgba(0,0,0,0.4) 100%); - - -moz-box-shadow: 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 1px 0 rgba(0,0,0,.07); - } - - /* :after — фон */ - .radio-button_theme_normal .radio-button__radio[class^="radio"]:after - { - background: #fFf; - background: -webkit-linear-gradient(top, #FffFff 0,#eeeeEe 100%); - background: -moz-linear-gradient(top, #fff 0, #eEe 100%); - background: -o-linear-gradient(top, #fff 0,#eee 100%); - background: linear-gradient(to bottom, #ffffff 0,#eeEeee 100%); - content: "it's something different"; - } - - /* _focused_yes */ - .radio-button_theme_normal .radio-button__radio_focused_yes:before - { - content: "hello"; - -moz-box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0px 1px 0px rgba(0,0,0,.07); - box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0px 1px 0px rgba(0,0,0,.07); - } - -} - -/* Фигурные скобки. Вариант 1 */ -a, b, i /* foobar */ { - padding:0; - margin:0; - } - div p{ - font-size:1px; - top:0; - } - div p em{ - font-style:italic; - border-bottom:1px solid red; -} - -@media all and (min-width:0px){ - /* В нажатом состоянии смещается вниз на 1px вся кнопка, текст не смещается */ - .button_pressed_yes.button_shadow_yes - { - top: 1px; - } - - .button_pressed_yes.button_shadow_yes .button__text - { - top: 0; - } -} - -@media all /* media */ - { /* foobar */ -.input__control -{ - color: #000; - font-size: 100%; - margin: 0; - position: relative; - width: 100%; - z-index: 3; -}} - -@media screen and (min-width: 35em) /* screen */, - print and (min-width: 40em) /* print */ { /* foobar */ -.input__control -{ - -moz-box-sizing: border-box; - background: none; - border: 0; - box-sizing: border-box; - outline: 0; - padding: 0.4em 0; -} -}.empty-rule{} - -/* Фигурные скобки. Вариант 2 */ -div -{ - padding:0; - margin:0; -} - div p - { - font-size:1px; - top:0; - } - div p em - { - font-style:italic;/* inline comment*/ - border-bottom:1px solid red; - } - -/* Фигурные скобки. Вариант 3 */ -div { - padding:0; - margin:0; -} -/* foo */ div~p { - font-size:1px; - top:0 - } - div> P +EM { - /* upline comment*/ - font-style:italic; - - border-bottom:1px solid red /* trololo */ /* trololo */ - } - - a:not(B){ -top: 0;/* ololo */margin :0;} - b - { -top :0/* trololo */;margin : 0} -.empty-rule{} - - - - diff --git a/node_modules/csscomb/test/options/integral/integral.expected.css b/node_modules/csscomb/test/options/integral/integral.expected.css deleted file mode 100644 index f59d0a2..0000000 --- a/node_modules/csscomb/test/options/integral/integral.expected.css +++ /dev/null @@ -1,151 +0,0 @@ -/* foobar */ -@media all and (min-width:0) -{ - .radio-button_theme_normal .radio-button__radio:before - { - background: rgba(0,0,0,.4); - background: -webkit-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: -moz-linear-gradient(top, rgba(0,0,0,.2) 0, rgba(0,0,0,.4) 100%); - background: -o-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: linear-gradient(to bottom, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - -moz-box-shadow: 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 1px 0 rgba(0,0,0,.07); - } - - /* :after — фон */ - .radio-button_theme_normal .radio-button__radio[class^='radio']:after - { - content: 'it\'s something different'; - - background: #fff; - background: -webkit-linear-gradient(top, #fff 0,#eee 100%); - background: -moz-linear-gradient(top, #fff 0, #eee 100%); - background: -o-linear-gradient(top, #fff 0,#eee 100%); - background: linear-gradient(to bottom, #fff 0,#eee 100%); - } - - /* _focused_yes */ - .radio-button_theme_normal .radio-button__radio_focused_yes:before - { - content: 'hello'; - - -moz-box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0 1px 0 rgba(0,0,0,.07); - } -} - -/* Фигурные скобки. Вариант 1 */ -a, -b, -i /* foobar */ -{ - margin: 0; - padding: 0; -} -div p -{ - font-size: 1px; - - top: 0; -} -div p em -{ - font-style: italic; - - border-bottom: 1px solid red; -} - -@media all and (min-width:0) -{ - /* В нажатом состоянии смещается вниз на 1px вся кнопка, текст не смещается */ - .button_pressed_yes.button_shadow_yes - { - top: 1px; - } - - .button_pressed_yes.button_shadow_yes .button__text - { - top: 0; - } -} - -@media all /* media */ -{ - /* foobar */ - .input__control - { - font-size: 100%; - - position: relative; - z-index: 3; - - width: 100%; - margin: 0; - - color: #000; - } -} - -@media screen and (min-width: 35em) /* screen */, - print and (min-width: 40em) /* print */ -{ - /* foobar */ - .input__control - { - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: .4em 0; - - border: 0; - outline: 0; - background: none; - } -} - -/* Фигурные скобки. Вариант 2 */ -div -{ - margin: 0; - padding: 0; -} -div p -{ - font-size: 1px; - - top: 0; -} -div p em -{ - font-style: italic;/* inline comment*/ - - border-bottom: 1px solid red; -} - -/* Фигурные скобки. Вариант 3 */ -div -{ - margin: 0; - padding: 0; -} -/* foo */ div ~ p -{ - font-size: 1px; - - top: 0; -} -div > p + em -{ - /* upline comment*/ - font-style: italic; - - border-bottom: 1px solid red; /* trololo */ /* trololo */ -} - -a:not(b) -{ - top: 0;/* ololo */margin: 0; -} -b -{ - top: 0/* trololo */;margin: 0; -} diff --git a/node_modules/csscomb/test/options/integral/issue-252.expected.sass b/node_modules/csscomb/test/options/integral/issue-252.expected.sass deleted file mode 100644 index f3fb55f..0000000 --- a/node_modules/csscomb/test/options/integral/issue-252.expected.sass +++ /dev/null @@ -1,11 +0,0 @@ -.partner - font-size: 0 - - color: transparent - - +inline-block - &--motor - background-image: url('/i/partners1.png') - &--motor - background-image: url('/i/partners2.png') - diff --git a/node_modules/csscomb/test/options/integral/issue-252.sass b/node_modules/csscomb/test/options/integral/issue-252.sass deleted file mode 100644 index 6369eef..0000000 --- a/node_modules/csscomb/test/options/integral/issue-252.sass +++ /dev/null @@ -1,8 +0,0 @@ -.partner - +inline-block - font-size: 0 - color: transparent - &--motor - background-image: url('/i/partners1.png') - &--motor - background-image: url('/i/partners2.png') diff --git a/node_modules/csscomb/test/options/leading-zero.js b/node_modules/csscomb/test/options/leading-zero.js deleted file mode 100644 index dbd5c2b..0000000 --- a/node_modules/csscomb/test/options/leading-zero.js +++ /dev/null @@ -1,51 +0,0 @@ -var assert = require('assert'); - -describe('options/leading-zero', function() { - it('Should add leading zero in dimensions', function() { - this.comb.configure({ 'leading-zero': true }); - assert.equal( - this.comb.processString( - 'div { margin: .5em }' - ), - 'div { margin: 0.5em }' - ); - }); - - it('Should remove leading zero in dimensions', function() { - this.comb.configure({ 'leading-zero': false }); - assert.equal( - this.comb.processString( - 'div { margin: 0.5em }' - ), - 'div { margin: .5em }' - ); - }); - - it('Should detect leading zero option', function() { - this.shouldDetect( - ['leading-zero'], - 'a { width: 0.5em }', - { - 'leading-zero': true - } - ); - }); - - it('Should detect leading zero option set to false', function() { - this.shouldDetect( - ['leading-zero'], - 'a { width: .5em }', - { - 'leading-zero': false - } - ); - }); - - it('Shouldn’t detect leading zero option', function() { - this.shouldDetect( - ['leading-zero'], - 'a { width: 10.5em }', - {} - ); - }); -}); diff --git a/node_modules/csscomb/test/options/quotes.js b/node_modules/csscomb/test/options/quotes.js deleted file mode 100644 index 5ed3a89..0000000 --- a/node_modules/csscomb/test/options/quotes.js +++ /dev/null @@ -1,120 +0,0 @@ -var assert = require('assert'); - -describe('options/quotes', function() { - it('Invalid String should not change quotes', function() { - this.comb.configure({ quotes: 3 }); - assert.equal( - this.comb.processString( - 'a { content: "" }' + - 'b { content: \'\' }' - ), - 'a { content: "" }' + - 'b { content: \'\' }' - ); - }); - - it('`single` value should set the quotes to single', function() { - this.comb.configure({ quotes: 'single' }); - assert.equal( - this.comb.processString( - 'a { content: "" }' + - 'b { content: \'\' }' - ), - 'a { content: \'\' }' + - 'b { content: \'\' }' - ); - }); - - it('`double` value should set the quotes to double', function() { - this.comb.configure({ quotes: 'double' }); - assert.equal( - this.comb.processString( - 'a { content: "" }' + - 'b { content: \'\' }' - ), - 'a { content: "" }' + - 'b { content: "" }' - ); - }); - - it('`double` value should set the quotes to double in attrs and urls', function() { - this.comb.configure({ quotes: 'double' }); - assert.equal( - this.comb.processString( - 'a[class^=\'foo\'] { background: url(\'foo.png\') }' - ), - 'a[class^="foo"] { background: url("foo.png") }' - ); - }); - - it('`double` value should escape the unescaped double quotes on change', function() { - this.comb.configure({ quotes: 'double' }); - assert.equal( - this.comb.processString( - 'a { content: "\\"" }' + - 'b { content: \'"\' }' - ), - 'a { content: "\\"" }' + - 'b { content: "\\"" }' - ); - }); - - - it('`single` value should unescape the escaped double quotes on change', function() { - this.comb.configure({ quotes: 'single' }); - assert.equal( - this.comb.processString( - 'a { content: "\\"" }' - ), - 'a { content: \'"\' }' - ); - }); - - it('Should not detect quotes when there are none', function() { - this.shouldDetect( - ['quotes'], - 'a { color:red }', - {} - ); - }); - - it('Should detect double quotes', function() { - this.shouldDetect( - ['quotes'], - 'a { content: "foo" }', - { - quotes: 'double' - } - ); - }); - - it('Should detect single quotes', function() { - this.shouldDetect( - ['quotes'], - 'a { content: \'foo\' }', - { - quotes: 'single' - } - ); - }); - - it('Should detect single quotes in attribute', function() { - this.shouldDetect( - ['quotes'], - 'a[class^=\'foo\'] { color: red }', - { - quotes: 'single' - } - ); - }); - - it('Should detect double quotes in url', function() { - this.shouldDetect( - ['quotes'], - 'a { background: url("foo.png") }', - { - quotes: 'double' - } - ); - }); -}); diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-less.js b/node_modules/csscomb/test/options/remove-empty-rulesets-less.js deleted file mode 100644 index 8cf54fc..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-less.js +++ /dev/null @@ -1,27 +0,0 @@ -var assert = require('assert'); - -describe('options/remove-empty-rulesets (less):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Issue 201. Test 1', function() { - this.comb.configure({ 'remove-empty-rulesets': true }); - this.shouldBeEqual('1.less', '1.expected.less'); - }); - - it('Issue 201. Test 2', function() { - this.comb.configure({ 'remove-empty-rulesets': true }); - var string = '#a {#b {} #d {}}'; - assert.equal(this.comb.processString(string, { syntax: 'less' }), ''); - }); - - it('Issue 201. Test 3', function() { - this.comb.configure({ - 'remove-empty-rulesets': false, - 'always-semicolon': true - }); - var string = '#a {#b {} #d {}}'; - assert.equal(this.comb.processString(string, { syntax: 'less' }), string); - }); -}); diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-less/1.expected.less b/node_modules/csscomb/test/options/remove-empty-rulesets-less/1.expected.less deleted file mode 100644 index fbb7651..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-less/1.expected.less +++ /dev/null @@ -1,14 +0,0 @@ -#a { - - #b { - text-align: right; - } - - - - #d { - .e { - text-align: center; - } - } -} diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-less/1.less b/node_modules/csscomb/test/options/remove-empty-rulesets-less/1.less deleted file mode 100644 index 6abc247..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-less/1.less +++ /dev/null @@ -1,14 +0,0 @@ -#a { - - #b { - text-align: right; - } - - #c { } - - #d { - .e { - text-align: center; - } - } -} diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-scss.js b/node_modules/csscomb/test/options/remove-empty-rulesets-scss.js deleted file mode 100644 index 237b0e3..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-scss.js +++ /dev/null @@ -1,22 +0,0 @@ -describe('options/remove-empty-rulesets (scss)', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({ 'remove-empty-rulesets': true }); - }); - - it('Should not remove rulesets which contain only includes', function() { - this.shouldBeEqual('include.scss'); - }); - - it('Should remove rulesets with contain only empty nested rules', function() { - this.shouldBeEqual('empty-nested-rule.scss', 'empty-nested-rule.expected.scss'); - }); - - it('Should not remove rulesets with non-empty nested rules. Test 1', function() { - this.shouldBeEqual('nested-rule-1.scss'); - }); - - it('Should not remove rulesets with non-empty nested rules. Test 2', function() { - this.shouldBeEqual('nested-rule-2.scss', 'nested-rule-2.expected.scss'); - }); -}); diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.expected.scss b/node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.expected.scss deleted file mode 100644 index 8b13789..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.expected.scss +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.scss b/node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.scss deleted file mode 100644 index 89b0d97..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/empty-nested-rule.scss +++ /dev/null @@ -1,5 +0,0 @@ -.parent { - .child { - .grandchild { } - } -} diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/include.scss b/node_modules/csscomb/test/options/remove-empty-rulesets-scss/include.scss deleted file mode 100644 index 70d39a5..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/include.scss +++ /dev/null @@ -1,4 +0,0 @@ -.parent { - @include mix-all; - @include mix-top; -} diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-1.scss b/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-1.scss deleted file mode 100644 index f69f70a..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-1.scss +++ /dev/null @@ -1,6 +0,0 @@ -.parent { - .child { - @include mix-all; - @include mix-top; - } -} diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.expected.scss b/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.expected.scss deleted file mode 100644 index b020e30..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.expected.scss +++ /dev/null @@ -1,7 +0,0 @@ -.parent { - .child1 { - @include mix-all; - @include mix-top; - } - -} diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.scss b/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.scss deleted file mode 100644 index f5eedd4..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets-scss/nested-rule-2.scss +++ /dev/null @@ -1,9 +0,0 @@ -.parent { - .child1 { - @include mix-all; - @include mix-top; - } - .child2 { - .grandchild { } - } -} diff --git a/node_modules/csscomb/test/options/remove-empty-rulesets.js b/node_modules/csscomb/test/options/remove-empty-rulesets.js deleted file mode 100644 index a516227..0000000 --- a/node_modules/csscomb/test/options/remove-empty-rulesets.js +++ /dev/null @@ -1,112 +0,0 @@ -var assert = require('assert'); - -describe('options/remove-empty-rulesets', function() { - it('Configured with invalid value, should not remove empty ruleset', function() { - this.comb.configure({ 'remove-empty-rulesets': 'foobar' }); - assert.equal(this.comb.processString('a { width: 10px; } b {}'), 'a { width: 10px; } b {}'); - }); - - describe('configured with Boolean "true" value', function() { - beforeEach(function() { - this.comb.configure({ 'remove-empty-rulesets': true }); - }); - - it('should remove empty ruleset', function() { - assert.equal(this.comb.processString(' b {} '), ' '); - }); - - it('should remove ruleset with spaces', function() { - assert.equal(this.comb.processString(' b { } '), ' '); - }); - - it('should leave ruleset with declarations', function() { - assert.equal(this.comb.processString('a { width: 10px; }\nb {} '), 'a { width: 10px; }\n '); - }); - - it('should leave ruleset with comments', function() { - assert.equal(this.comb.processString('a { /* comment */ }\nb {} '), 'a { /* comment */ }\n '); - }); - }); - - describe('detecting the value', function() { - it('Should detect this option set to `true`', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - 'a { color: red }', - { - 'remove-empty-rulesets': true - } - ); - }); - - it('Should detect this option set to `false` with empty block', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - 'a {}', - { - 'remove-empty-rulesets': false - } - ); - }); - - it('Should detect this option set to `false` with block containing whitespace', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - 'a { }', - { - 'remove-empty-rulesets': false - } - ); - }); - - it('Should detect this option set to `true` with block containing comment', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - 'a { /* Hello */ }', - { - 'remove-empty-rulesets': true - } - ); - }); - - it('Should detect this option set to `true` with media query containing block', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - '@media all and (min-width:0) { a { /* Hello */ } }', - { - 'remove-empty-rulesets': true - } - ); - }); - - it('Should detect this option set to `true` with media query containing comment', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - '@media all and (min-width:0) {/* Hello */}', - { - 'remove-empty-rulesets': true - } - ); - }); - - it('Should detect this option set to `false` with empty media query', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - '@media all and (min-width:0) {}', - { - 'remove-empty-rulesets': false - } - ); - }); - - it('Should detect this option set to `false` with media query containing whitespace', function() { - this.shouldDetect( - ['remove-empty-rulesets'], - '@media all and (min-width:0) { \n }', - { - 'remove-empty-rulesets': false - } - ); - }); - }); -}); diff --git a/node_modules/csscomb/test/options/sass.js b/node_modules/csscomb/test/options/sass.js deleted file mode 100644 index 1593c33..0000000 --- a/node_modules/csscomb/test/options/sass.js +++ /dev/null @@ -1,108 +0,0 @@ -describe('Sass', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({}); - }); - - it('Should parse nested rules', function() { - this.shouldBeEqual('nested-rule.sass'); - }); - - it('Should parse parent selector &', function() { - this.shouldBeEqual('parent-selector.sass'); - }); - - it('Should parse nested properties', function() { - this.shouldBeEqual('nested-property.sass'); - }); - - it('Should parse variables', function() { - this.shouldBeEqual('variable.sass'); - }); - - it('Should parse interpolated variables inside selectors', function() { - this.shouldBeEqual('interpolated-variable-1.sass'); - }); - - it('Should parse interpolated variables inside values', function() { - this.shouldBeEqual('interpolated-variable-2.sass'); - }); - - it('Should parse defaults', function() { - this.shouldBeEqual('default.sass'); - }); - - it('Should parse @import', function() { - this.shouldBeEqual('import.sass'); - }); - - it('Should parse @include', function() { - this.shouldBeEqual('include.sass'); - }); - - it('Should parse nested @media', function() { - this.shouldBeEqual('nested-media.sass'); - }); - - it('Should parse @extend with classes', function() { - this.shouldBeEqual('extend-1.sass'); - }); - - it('Should parse @extend with placeholders', function() { - this.shouldBeEqual('extend-2.sass'); - }); - - it('Should parse @warn', function() { - this.shouldBeEqual('warn.sass'); - }); - - it('Should parse @if', function() { - this.shouldBeEqual('if.sass'); - }); - - it('Should parse @if and @else', function() { - this.shouldBeEqual('if-else.sass'); - }); - - it('Should parse @if and @else if', function() { - this.shouldBeEqual('if-else-if.sass'); - }); - - it('Should parse @for', function() { - this.shouldBeEqual('for.sass'); - }); - - it('Should parse @each', function() { - this.shouldBeEqual('each.sass'); - }); - - it('Should parse @while', function() { - this.shouldBeEqual('while.sass'); - }); - - it('Should parse mixins', function() { - this.shouldBeEqual('mixin-1.sass'); - }); - - it('Should parse passing several variables to a mixin', function() { - this.shouldBeEqual('mixin-2.sass'); - }); - - it('Should parse passing a list of variables to a mixin', function() { - this.shouldBeEqual('mixin-3.sass'); - }); - - it('Should parse passing a content block to a mixin', function() { - this.shouldBeEqual('mixin-4.sass'); - }); - - it('Should parse @content', function() { - this.shouldBeEqual('content.sass'); - }); - - it('Should parse functions', function() { - this.shouldBeEqual('function.sass'); - }); -}); - - diff --git a/node_modules/csscomb/test/options/sass/content.sass b/node_modules/csscomb/test/options/sass/content.sass deleted file mode 100644 index e1bb2b9..0000000 --- a/node_modules/csscomb/test/options/sass/content.sass +++ /dev/null @@ -1,3 +0,0 @@ -@mixin nani - a - @content diff --git a/node_modules/csscomb/test/options/sass/default.sass b/node_modules/csscomb/test/options/sass/default.sass deleted file mode 100644 index 3c10834..0000000 --- a/node_modules/csscomb/test/options/sass/default.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - $color: tomato !default - top: 0 diff --git a/node_modules/csscomb/test/options/sass/each.sass b/node_modules/csscomb/test/options/sass/each.sass deleted file mode 100644 index 477c5de..0000000 --- a/node_modules/csscomb/test/options/sass/each.sass +++ /dev/null @@ -1,4 +0,0 @@ -div - @each $animal in puma, sea-slug, erget - .#{$animal}-icon - background-image: url("/images/#{$animal}.png") diff --git a/node_modules/csscomb/test/options/sass/extend-1.sass b/node_modules/csscomb/test/options/sass/extend-1.sass deleted file mode 100644 index ef4beac..0000000 --- a/node_modules/csscomb/test/options/sass/extend-1.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - @extend .nani - top: 0 diff --git a/node_modules/csscomb/test/options/sass/extend-2.sass b/node_modules/csscomb/test/options/sass/extend-2.sass deleted file mode 100644 index 8da2b0d..0000000 --- a/node_modules/csscomb/test/options/sass/extend-2.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - @extend %nani - top: 0 diff --git a/node_modules/csscomb/test/options/sass/for.sass b/node_modules/csscomb/test/options/sass/for.sass deleted file mode 100644 index 9449c47..0000000 --- a/node_modules/csscomb/test/options/sass/for.sass +++ /dev/null @@ -1,4 +0,0 @@ -div - @for $i from 1 through 3 - .item-#{$i} - width: 2em * 1 diff --git a/node_modules/csscomb/test/options/sass/function.sass b/node_modules/csscomb/test/options/sass/function.sass deleted file mode 100644 index 33901cb..0000000 --- a/node_modules/csscomb/test/options/sass/function.sass +++ /dev/null @@ -1,2 +0,0 @@ -@function nani($n) - @return $n * 2 diff --git a/node_modules/csscomb/test/options/sass/if-else-if.sass b/node_modules/csscomb/test/options/sass/if-else-if.sass deleted file mode 100644 index 91648b8..0000000 --- a/node_modules/csscomb/test/options/sass/if-else-if.sass +++ /dev/null @@ -1,5 +0,0 @@ -div - @if $type == ocean - top: 0 - @else if $type == monster - left: 0 diff --git a/node_modules/csscomb/test/options/sass/if-else.sass b/node_modules/csscomb/test/options/sass/if-else.sass deleted file mode 100644 index 2863d4d..0000000 --- a/node_modules/csscomb/test/options/sass/if-else.sass +++ /dev/null @@ -1,5 +0,0 @@ -div - @if $type == ocean - top: 0 - @else - left: 0 diff --git a/node_modules/csscomb/test/options/sass/if.sass b/node_modules/csscomb/test/options/sass/if.sass deleted file mode 100644 index ab29f15..0000000 --- a/node_modules/csscomb/test/options/sass/if.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - @if $type == ocean - top: 0 diff --git a/node_modules/csscomb/test/options/sass/import.sass b/node_modules/csscomb/test/options/sass/import.sass deleted file mode 100644 index ed47208..0000000 --- a/node_modules/csscomb/test/options/sass/import.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - @import "foo.css" - top: 0 diff --git a/node_modules/csscomb/test/options/sass/include.sass b/node_modules/csscomb/test/options/sass/include.sass deleted file mode 100644 index 3b753a7..0000000 --- a/node_modules/csscomb/test/options/sass/include.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - @include nani($panda) - top: 0 diff --git a/node_modules/csscomb/test/options/sass/interpolated-variable-1.sass b/node_modules/csscomb/test/options/sass/interpolated-variable-1.sass deleted file mode 100644 index 3ba50e5..0000000 --- a/node_modules/csscomb/test/options/sass/interpolated-variable-1.sass +++ /dev/null @@ -1,3 +0,0 @@ -div.#{$nani} - color: tomato - top:0 diff --git a/node_modules/csscomb/test/options/sass/interpolated-variable-2.sass b/node_modules/csscomb/test/options/sass/interpolated-variable-2.sass deleted file mode 100644 index 3f134b4..0000000 --- a/node_modules/csscomb/test/options/sass/interpolated-variable-2.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - color: #{$tomato} - top: 0 diff --git a/node_modules/csscomb/test/options/sass/mixin-1.sass b/node_modules/csscomb/test/options/sass/mixin-1.sass deleted file mode 100644 index f633d80..0000000 --- a/node_modules/csscomb/test/options/sass/mixin-1.sass +++ /dev/null @@ -1,4 +0,0 @@ -@mixin nani - color: tomato -.foo - @include nani diff --git a/node_modules/csscomb/test/options/sass/mixin-2.sass b/node_modules/csscomb/test/options/sass/mixin-2.sass deleted file mode 100644 index 0e3513e..0000000 --- a/node_modules/csscomb/test/options/sass/mixin-2.sass +++ /dev/null @@ -1,4 +0,0 @@ -@mixin nani($tomato) - color: $tomato -.foo - @include nani(red) diff --git a/node_modules/csscomb/test/options/sass/mixin-3.sass b/node_modules/csscomb/test/options/sass/mixin-3.sass deleted file mode 100644 index cf20ed5..0000000 --- a/node_modules/csscomb/test/options/sass/mixin-3.sass +++ /dev/null @@ -1,4 +0,0 @@ -@mixin nani($shadows...) - box-shadow: $shadows -.foo - @include nani(0px 4px 5px #666, 2px 6px 10px #999) diff --git a/node_modules/csscomb/test/options/sass/mixin-4.sass b/node_modules/csscomb/test/options/sass/mixin-4.sass deleted file mode 100644 index d22987c..0000000 --- a/node_modules/csscomb/test/options/sass/mixin-4.sass +++ /dev/null @@ -1,4 +0,0 @@ -.foo - @include nani - color: tomato - top: 0 diff --git a/node_modules/csscomb/test/options/sass/nested-media.sass b/node_modules/csscomb/test/options/sass/nested-media.sass deleted file mode 100644 index 244755f..0000000 --- a/node_modules/csscomb/test/options/sass/nested-media.sass +++ /dev/null @@ -1,4 +0,0 @@ -div - @media screen and (orientation: landscape) - color: tomato - top: 0 diff --git a/node_modules/csscomb/test/options/sass/nested-property.sass b/node_modules/csscomb/test/options/sass/nested-property.sass deleted file mode 100644 index 84af654..0000000 --- a/node_modules/csscomb/test/options/sass/nested-property.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - color: tomato - font: 2px/3px - family: fantasy - size: 30em - left: 0 diff --git a/node_modules/csscomb/test/options/sass/nested-rule.sass b/node_modules/csscomb/test/options/sass/nested-rule.sass deleted file mode 100644 index 8e90913..0000000 --- a/node_modules/csscomb/test/options/sass/nested-rule.sass +++ /dev/null @@ -1,4 +0,0 @@ -div - color: tomato - a - top: 0 diff --git a/node_modules/csscomb/test/options/sass/parent-selector.sass b/node_modules/csscomb/test/options/sass/parent-selector.sass deleted file mode 100644 index 388fecd..0000000 --- a/node_modules/csscomb/test/options/sass/parent-selector.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - color: tomato - &.top - color: nani - top: 0 - left: 0 diff --git a/node_modules/csscomb/test/options/sass/variable.sass b/node_modules/csscomb/test/options/sass/variable.sass deleted file mode 100644 index 24f437d..0000000 --- a/node_modules/csscomb/test/options/sass/variable.sass +++ /dev/null @@ -1,3 +0,0 @@ -$red: tomato -div - color: $tomato diff --git a/node_modules/csscomb/test/options/sass/warn.sass b/node_modules/csscomb/test/options/sass/warn.sass deleted file mode 100644 index ebf821b..0000000 --- a/node_modules/csscomb/test/options/sass/warn.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - @warn "nani" - top: 0 diff --git a/node_modules/csscomb/test/options/sass/while.sass b/node_modules/csscomb/test/options/sass/while.sass deleted file mode 100644 index 8b07b31..0000000 --- a/node_modules/csscomb/test/options/sass/while.sass +++ /dev/null @@ -1,5 +0,0 @@ -div - @while $i > 6 - .item - width: 2em * $i - $i: $i - 2 diff --git a/node_modules/csscomb/test/options/sort-order-fallback.js b/node_modules/csscomb/test/options/sort-order-fallback.js deleted file mode 100644 index 418fcfd..0000000 --- a/node_modules/csscomb/test/options/sort-order-fallback.js +++ /dev/null @@ -1,36 +0,0 @@ -describe('options/sort-order-fallback', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should sort leftovers alphabetically if `sort-order-fallback` is set', function() { - var config = { - 'sort-order-fallback': 'abc', - 'sort-order': [ - ['top', 'left'], - ['...'], - ['color'] - ] - }; - this.comb.configure(config); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Should sort unknown properties alphabetically if `sort-order-fallback` is set', function() { - var config = { - 'sort-order-fallback': 'abc', - 'sort-order': ['top', 'left'] - }; - this.comb.configure(config); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Should leave leftovers as is if `sort-order-fallback` is not set', function() { - var config = { - 'sort-order': ['top', 'left'] - }; - this.comb.configure(config); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); -}); - diff --git a/node_modules/csscomb/test/options/sort-order-fallback/test-2.expected.css b/node_modules/csscomb/test/options/sort-order-fallback/test-2.expected.css deleted file mode 100644 index dd35868..0000000 --- a/node_modules/csscomb/test/options/sort-order-fallback/test-2.expected.css +++ /dev/null @@ -1,11 +0,0 @@ -a { - top: 0; - left: 0; - - -moz-color: zebra; - color: tomato; - -webkit-float: left; - float: right; - font-size: 1em; - position: absolute; - } diff --git a/node_modules/csscomb/test/options/sort-order-fallback/test-3.expected.css b/node_modules/csscomb/test/options/sort-order-fallback/test-3.expected.css deleted file mode 100644 index 8e31298..0000000 --- a/node_modules/csscomb/test/options/sort-order-fallback/test-3.expected.css +++ /dev/null @@ -1,11 +0,0 @@ -a { - top: 0; - left: 0; - - color: tomato; - font-size: 1em; - position: absolute; - -webkit-float: left; - -moz-color: zebra; - float: right; - } diff --git a/node_modules/csscomb/test/options/sort-order-fallback/test.css b/node_modules/csscomb/test/options/sort-order-fallback/test.css deleted file mode 100644 index d57de84..0000000 --- a/node_modules/csscomb/test/options/sort-order-fallback/test.css +++ /dev/null @@ -1,10 +0,0 @@ -a { - color: tomato; - font-size: 1em; - top: 0; - position: absolute; - left: 0; - -webkit-float: left; - -moz-color: zebra; - float: right; - } diff --git a/node_modules/csscomb/test/options/sort-order-fallback/test.expected.css b/node_modules/csscomb/test/options/sort-order-fallback/test.expected.css deleted file mode 100644 index ec1c2a8..0000000 --- a/node_modules/csscomb/test/options/sort-order-fallback/test.expected.css +++ /dev/null @@ -1,12 +0,0 @@ -a { - top: 0; - left: 0; - - -moz-color: zebra; - -webkit-float: left; - float: right; - font-size: 1em; - position: absolute; - - color: tomato; - } diff --git a/node_modules/csscomb/test/options/sort-order-less.js b/node_modules/csscomb/test/options/sort-order-less.js deleted file mode 100644 index f0c36a5..0000000 --- a/node_modules/csscomb/test/options/sort-order-less.js +++ /dev/null @@ -1,96 +0,0 @@ -describe('options/sort-order (less)', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should sort properties inside rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('rule.less', 'rule.expected.less'); - }); - - it('Should sort properties inside nested rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('nested-rule-1.less', 'nested-rule-1.expected.less'); - }); - - it('Should sort properties divided by nested rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'left', 'color'] - ] }); - this.shouldBeEqual('nested-rule-2.less', 'nested-rule-2.expected.less'); - }); - - it('Should group declarations with proper comments and spaces (single line)', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('comments-1.less', 'comments-1.expected.less'); - }); - - it('Should group declarations with proper comments and spaces (multiple lines). Test 1', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('comments-2.less', 'comments-2.expected.less'); - }); - - it('Should group declarations with proper comments and spaces (multiple lines). Test 2', function() { - this.comb.configure({ 'sort-order': [ - ['$variable', 'color'] - ] }); - this.shouldBeEqual('comments-3.less', 'comments-3.expected.less'); - }); - - it('Should group declarations with proper comments and spaces (multiple lines). Test 3', function() { - this.comb.configure({ 'sort-order': [ - ['$variable', 'color'] - ] }); - this.shouldBeEqual('comments-3.less', 'comments-3.expected.less'); - }); - - it('Should divide properties from different groups with an empty line', function() { - this.comb.configure({ 'sort-order': [ - ['top'], ['color'] - ] }); - this.shouldBeEqual('different-groups.less', 'different-groups.expected.less'); - }); - - it('Should sort variables', function() { - this.comb.configure({ 'sort-order': [ - ['$variable', 'color'] - ] }); - this.shouldBeEqual('variable.less', 'variable.expected.less'); - }); - - it('Should sort imports', function() { - this.comb.configure({ 'sort-order': [ - ['$import', 'color'] - ] }); - this.shouldBeEqual('import.less', 'import.expected.less'); - }); - - it('Should sort included mixins. Test 1', function() { - this.comb.configure({ 'sort-order': [ - ['$include', 'color', 'border-top', 'border-bottom'] - ] }); - this.shouldBeEqual('mixin-1.less', 'mixin-1.expected.less'); - }); - - it('Should sort included mixins. Test 2', function() { - this.comb.configure({ 'sort-order': [ - ['$include', 'top', 'color'] - ] }); - this.shouldBeEqual('mixin-2.less', 'mixin-2.expected.less'); - }); - - it('Should sort included mixins. Test 3', function() { - this.comb.configure({ 'sort-order': [ - ['$include', 'border', 'color'] - ] }); - this.shouldBeEqual('mixin-3.less', 'mixin-3.expected.less'); - }); -}); diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-1.expected.less b/node_modules/csscomb/test/options/sort-order-less/comments-1.expected.less deleted file mode 100644 index a9b2976..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-1.expected.less +++ /dev/null @@ -1 +0,0 @@ -div {top: 0; /* 3 */ /* 4 *//* 1 */ color: tomato; /* 2 */ } diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-1.less b/node_modules/csscomb/test/options/sort-order-less/comments-1.less deleted file mode 100644 index 617d4fd..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-1.less +++ /dev/null @@ -1 +0,0 @@ -div {/* 1 */ color: tomato; /* 2 */ top: 0; /* 3 */ /* 4 */} diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-2.expected.less b/node_modules/csscomb/test/options/sort-order-less/comments-2.expected.less deleted file mode 100644 index 0aa257a..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-2.expected.less +++ /dev/null @@ -1,7 +0,0 @@ -div { - /* 2 */ - /* 3 */ - top: 0; /* 4 */ - color: tomato; /* 1 */ - /* 5 */ -} diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-2.less b/node_modules/csscomb/test/options/sort-order-less/comments-2.less deleted file mode 100644 index 18e6319..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-2.less +++ /dev/null @@ -1,7 +0,0 @@ -div { - color: tomato; /* 1 */ - /* 2 */ - /* 3 */ - top: 0; /* 4 */ - /* 5 */ -} diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-3.expected.less b/node_modules/csscomb/test/options/sort-order-less/comments-3.expected.less deleted file mode 100644 index 7bf0938..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-3.expected.less +++ /dev/null @@ -1,6 +0,0 @@ -p { - // Get in line! - @var: white; - /* One hell of a comment */ - color: tomato; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-3.less b/node_modules/csscomb/test/options/sort-order-less/comments-3.less deleted file mode 100644 index c7f0a84..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-3.less +++ /dev/null @@ -1,6 +0,0 @@ -p { - /* One hell of a comment */ - color: tomato; - // Get in line! - @var: white; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-4.expected.less b/node_modules/csscomb/test/options/sort-order-less/comments-4.expected.less deleted file mode 100644 index 349b770..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-4.expected.less +++ /dev/null @@ -1,4 +0,0 @@ -p { - @var: white; // Get in line! - color: tomato; /* One hell of a comment */ - } diff --git a/node_modules/csscomb/test/options/sort-order-less/comments-4.less b/node_modules/csscomb/test/options/sort-order-less/comments-4.less deleted file mode 100644 index b1db838..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/comments-4.less +++ /dev/null @@ -1,4 +0,0 @@ -p { - color: tomato; /* One hell of a comment */ - @var: white; // Get in line! - } diff --git a/node_modules/csscomb/test/options/sort-order-less/different-groups.expected.less b/node_modules/csscomb/test/options/sort-order-less/different-groups.expected.less deleted file mode 100644 index dddc16f..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/different-groups.expected.less +++ /dev/null @@ -1,5 +0,0 @@ -div { - top: 0; - - color: tomato; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/different-groups.less b/node_modules/csscomb/test/options/sort-order-less/different-groups.less deleted file mode 100644 index 7ffa908..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/different-groups.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - top: 0; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/import.expected.less b/node_modules/csscomb/test/options/sort-order-less/import.expected.less deleted file mode 100644 index 9c403df..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/import.expected.less +++ /dev/null @@ -1 +0,0 @@ -div {@import "foo.css"; color: tomato; } diff --git a/node_modules/csscomb/test/options/sort-order-less/import.less b/node_modules/csscomb/test/options/sort-order-less/import.less deleted file mode 100644 index 681ccd0..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/import.less +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @import "foo.css"; } diff --git a/node_modules/csscomb/test/options/sort-order-less/mixin-1.expected.less b/node_modules/csscomb/test/options/sort-order-less/mixin-1.expected.less deleted file mode 100644 index 11ac5fa..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/mixin-1.expected.less +++ /dev/null @@ -1,12 +0,0 @@ -.bordered { - border-top: dotted 1px black; - border-bottom: solid 2px black; -} -#menu a { - .bordered; - color: #111; - } -.post a { - .bordered; - color: red; - } diff --git a/node_modules/csscomb/test/options/sort-order-less/mixin-1.less b/node_modules/csscomb/test/options/sort-order-less/mixin-1.less deleted file mode 100644 index e5d5ad0..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/mixin-1.less +++ /dev/null @@ -1,12 +0,0 @@ -.bordered { - border-bottom: solid 2px black; - border-top: dotted 1px black; -} -#menu a { - color: #111; - .bordered; - } -.post a { - color: red; - .bordered; - } diff --git a/node_modules/csscomb/test/options/sort-order-less/mixin-2.expected.less b/node_modules/csscomb/test/options/sort-order-less/mixin-2.expected.less deleted file mode 100644 index 1535db1..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/mixin-2.expected.less +++ /dev/null @@ -1,6 +0,0 @@ -.test { - .test1(); - .test2(); - top: 0; - color: tomato; - } diff --git a/node_modules/csscomb/test/options/sort-order-less/mixin-2.less b/node_modules/csscomb/test/options/sort-order-less/mixin-2.less deleted file mode 100644 index cbd0c8e..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/mixin-2.less +++ /dev/null @@ -1,6 +0,0 @@ -.test { - .test1(); - color: tomato; - .test2(); - top: 0; - } diff --git a/node_modules/csscomb/test/options/sort-order-less/mixin-3.expected.less b/node_modules/csscomb/test/options/sort-order-less/mixin-3.expected.less deleted file mode 100644 index 0e4c018..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/mixin-3.expected.less +++ /dev/null @@ -1,5 +0,0 @@ -.foo { - .linear-gradient(#fff; #000); - border: 1px solid #f00; - color: #0f0; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/mixin-3.less b/node_modules/csscomb/test/options/sort-order-less/mixin-3.less deleted file mode 100644 index fce214a..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/mixin-3.less +++ /dev/null @@ -1,5 +0,0 @@ -.foo { - color: #0f0; - border: 1px solid #f00; - .linear-gradient(#fff; #000); -} diff --git a/node_modules/csscomb/test/options/sort-order-less/nested-rule-1.expected.less b/node_modules/csscomb/test/options/sort-order-less/nested-rule-1.expected.less deleted file mode 100644 index e85581f..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/nested-rule-1.expected.less +++ /dev/null @@ -1,6 +0,0 @@ -div { - color: tomato; a { - top: 0; - color: nani; - } -} diff --git a/node_modules/csscomb/test/options/sort-order-less/nested-rule-1.less b/node_modules/csscomb/test/options/sort-order-less/nested-rule-1.less deleted file mode 100644 index af11594..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/nested-rule-1.less +++ /dev/null @@ -1,6 +0,0 @@ -div { - color: tomato; a { - color: nani; - top: 0; - } -} diff --git a/node_modules/csscomb/test/options/sort-order-less/nested-rule-2.expected.less b/node_modules/csscomb/test/options/sort-order-less/nested-rule-2.expected.less deleted file mode 100644 index 30c8b65..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/nested-rule-2.expected.less +++ /dev/null @@ -1,7 +0,0 @@ -div { - left: 0; - color: tomato; a { - top: 0; - color: nani; - } -} diff --git a/node_modules/csscomb/test/options/sort-order-less/nested-rule-2.less b/node_modules/csscomb/test/options/sort-order-less/nested-rule-2.less deleted file mode 100644 index 52df599..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/nested-rule-2.less +++ /dev/null @@ -1,7 +0,0 @@ -div { - color: tomato; a { - color: nani; - top: 0; - } - left: 0; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/rule.expected.less b/node_modules/csscomb/test/options/sort-order-less/rule.expected.less deleted file mode 100644 index 918bd37..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/rule.expected.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - top: 0; - color: tomato; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/rule.less b/node_modules/csscomb/test/options/sort-order-less/rule.less deleted file mode 100644 index 7ffa908..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/rule.less +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - top: 0; -} diff --git a/node_modules/csscomb/test/options/sort-order-less/variable.expected.less b/node_modules/csscomb/test/options/sort-order-less/variable.expected.less deleted file mode 100644 index e391754..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/variable.expected.less +++ /dev/null @@ -1 +0,0 @@ -div {@red: tomato; color: @red; } diff --git a/node_modules/csscomb/test/options/sort-order-less/variable.less b/node_modules/csscomb/test/options/sort-order-less/variable.less deleted file mode 100644 index 5c6756b..0000000 --- a/node_modules/csscomb/test/options/sort-order-less/variable.less +++ /dev/null @@ -1 +0,0 @@ -div { color: @red; @red: tomato; } diff --git a/node_modules/csscomb/test/options/sort-order-sass.js b/node_modules/csscomb/test/options/sort-order-sass.js deleted file mode 100644 index d6997e5..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass.js +++ /dev/null @@ -1,89 +0,0 @@ -describe('options/sort-order (sass)', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should sort properties inside rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('rule.sass', 'rule.expected.sass'); - }); - - it('Should sort properties inside nested rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('nested-rule-1.sass', 'nested-rule-1.expected.sass'); - }); - - it('Should sort properties divided by nested rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'left', 'color'] - ] }); - this.shouldBeEqual('nested-rule-2.sass', 'nested-rule-2.expected.sass'); - }); - - it('Should group declarations with proper comments and spaces (multiple lines)', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('comments.sass', 'comments.expected.sass'); - }); - - it('Should divide properties from different groups with an empty line', function() { - this.comb.configure({ 'sort-order': [ - ['top'], ['color'] - ] }); - this.shouldBeEqual('different-groups.sass', 'different-groups.expected.sass'); - }); - - it('Should sort variables', function() { - this.comb.configure({ 'sort-order': [ - ['$variable', 'color'] - ] }); - this.shouldBeEqual('variable.sass', 'variable.expected.sass'); - }); - - it('Should sort imports', function() { - this.comb.configure({ 'sort-order': [ - ['$import', 'color'] - ] }); - this.shouldBeEqual('import.sass', 'import.expected.sass'); - }); - - it('Should sort @include-s', function() { - this.comb.configure({ 'sort-order': [ - ['$include', 'color'] - ] }); - this.shouldBeEqual('include.sass', 'include.expected.sass'); - }); - - it('Should sort @extend-s', function() { - this.comb.configure({ 'sort-order': [ - ['$include', 'color'] - ] }); - this.shouldBeEqual('extend.sass', 'extend.expected.sass'); - }); - - it('Should sort properties inside blocks passed to mixins', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('mixin.sass', 'mixin.expected.sass'); - }); - - it('Should handle properties preceeding rulesets', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'left', 'color'] - ] }); - this.shouldBeEqual('ruleset.sass', 'ruleset.expected.sass'); - }); - - it('Should handle properties preceeding conditions', function() { - this.comb.configure({ 'sort-order': [ - ['font-size', 'display', 'top', 'color'] - ] }); - this.shouldBeEqual('condition.sass', 'condition.expected.sass'); - }); -}); diff --git a/node_modules/csscomb/test/options/sort-order-sass/comments.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/comments.expected.sass deleted file mode 100644 index a798642..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/comments.expected.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - /* 2 */ - /* 3 */ - top: 0 // 4 - color: tomato // 1 - /* 5 */ diff --git a/node_modules/csscomb/test/options/sort-order-sass/comments.sass b/node_modules/csscomb/test/options/sort-order-sass/comments.sass deleted file mode 100644 index 5f3f7cc..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/comments.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - color: tomato // 1 - /* 2 */ - /* 3 */ - top: 0 // 4 - /* 5 */ diff --git a/node_modules/csscomb/test/options/sort-order-sass/condition.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/condition.expected.sass deleted file mode 100644 index 8ffeb9f..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/condition.expected.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - top: 0 - color: tomato - @if $color == tomato - font-size: 2px - display: block diff --git a/node_modules/csscomb/test/options/sort-order-sass/condition.sass b/node_modules/csscomb/test/options/sort-order-sass/condition.sass deleted file mode 100644 index 66379ee..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/condition.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - color: tomato - @if $color == tomato - display: block - font-size: 2px - top: 0 diff --git a/node_modules/csscomb/test/options/sort-order-sass/different-groups.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/different-groups.expected.sass deleted file mode 100644 index 2ffd199..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/different-groups.expected.sass +++ /dev/null @@ -1,4 +0,0 @@ -div - top: 0 - - color: tomato diff --git a/node_modules/csscomb/test/options/sort-order-sass/different-groups.sass b/node_modules/csscomb/test/options/sort-order-sass/different-groups.sass deleted file mode 100644 index 6d835e2..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/different-groups.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - color: tomato - top: 0 diff --git a/node_modules/csscomb/test/options/sort-order-sass/extend.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/extend.expected.sass deleted file mode 100644 index a0ba2c9..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/extend.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ - div - @extend %nani - color: tomato diff --git a/node_modules/csscomb/test/options/sort-order-sass/extend.sass b/node_modules/csscomb/test/options/sort-order-sass/extend.sass deleted file mode 100644 index fe9c177..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/extend.sass +++ /dev/null @@ -1,3 +0,0 @@ - div - color: tomato - @extend %nani diff --git a/node_modules/csscomb/test/options/sort-order-sass/import.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/import.expected.sass deleted file mode 100644 index f1f2c6a..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/import.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ - div - @import "foo.css" - color: tomato diff --git a/node_modules/csscomb/test/options/sort-order-sass/import.sass b/node_modules/csscomb/test/options/sort-order-sass/import.sass deleted file mode 100644 index 659f76e..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/import.sass +++ /dev/null @@ -1,3 +0,0 @@ - div - color: tomato - @import "foo.css" diff --git a/node_modules/csscomb/test/options/sort-order-sass/include.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/include.expected.sass deleted file mode 100644 index f7a50a7..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/include.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - @include .nani - color: tomato diff --git a/node_modules/csscomb/test/options/sort-order-sass/include.sass b/node_modules/csscomb/test/options/sort-order-sass/include.sass deleted file mode 100644 index 9c7ac8b..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/include.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - color: tomato - @include .nani diff --git a/node_modules/csscomb/test/options/sort-order-sass/mixin.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/mixin.expected.sass deleted file mode 100644 index e441062..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/mixin.expected.sass +++ /dev/null @@ -1,4 +0,0 @@ -.foo - @include nani - top: 0 - color: tomato diff --git a/node_modules/csscomb/test/options/sort-order-sass/mixin.sass b/node_modules/csscomb/test/options/sort-order-sass/mixin.sass deleted file mode 100644 index d22987c..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/mixin.sass +++ /dev/null @@ -1,4 +0,0 @@ -.foo - @include nani - color: tomato - top: 0 diff --git a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.expected.sass deleted file mode 100644 index 101521f..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.expected.sass +++ /dev/null @@ -1,5 +0,0 @@ -div - color: tomato - a - top: 0 - color: nani diff --git a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.sass b/node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.sass deleted file mode 100644 index 3394a7c..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-1.sass +++ /dev/null @@ -1,5 +0,0 @@ -div - color: tomato - a - color: nani - top: 0 diff --git a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.expected.sass deleted file mode 100644 index 54a0fb8..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.expected.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - left: 0 - color: tomato - a - top: 0 - color: nani diff --git a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.sass b/node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.sass deleted file mode 100644 index 9815840..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/nested-rule-2.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - color: tomato - a - color: nani - top: 0 - left: 0 diff --git a/node_modules/csscomb/test/options/sort-order-sass/rule.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/rule.expected.sass deleted file mode 100644 index c6e1f54..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/rule.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - top: 0 - color: tomato diff --git a/node_modules/csscomb/test/options/sort-order-sass/rule.sass b/node_modules/csscomb/test/options/sort-order-sass/rule.sass deleted file mode 100644 index 6d835e2..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/rule.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - color: tomato - top: 0 diff --git a/node_modules/csscomb/test/options/sort-order-sass/ruleset.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/ruleset.expected.sass deleted file mode 100644 index 54a0fb8..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/ruleset.expected.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - left: 0 - color: tomato - a - top: 0 - color: nani diff --git a/node_modules/csscomb/test/options/sort-order-sass/ruleset.sass b/node_modules/csscomb/test/options/sort-order-sass/ruleset.sass deleted file mode 100644 index 9815840..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/ruleset.sass +++ /dev/null @@ -1,6 +0,0 @@ -div - color: tomato - a - color: nani - top: 0 - left: 0 diff --git a/node_modules/csscomb/test/options/sort-order-sass/variable.expected.sass b/node_modules/csscomb/test/options/sort-order-sass/variable.expected.sass deleted file mode 100644 index c7c3634..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/variable.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - $red: tomato - color: $tomato diff --git a/node_modules/csscomb/test/options/sort-order-sass/variable.sass b/node_modules/csscomb/test/options/sort-order-sass/variable.sass deleted file mode 100644 index 31bc5a3..0000000 --- a/node_modules/csscomb/test/options/sort-order-sass/variable.sass +++ /dev/null @@ -1,3 +0,0 @@ -div - color: $tomato - $red: tomato diff --git a/node_modules/csscomb/test/options/sort-order-scss.js b/node_modules/csscomb/test/options/sort-order-scss.js deleted file mode 100644 index 517724d..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss.js +++ /dev/null @@ -1,116 +0,0 @@ -describe('options/sort-order (scss)', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should sort properties inside rules (single line)', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('rule.scss', 'rule.expected.scss'); - }); - - it('Should sort properties inside rules (multiple lines)', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('rule.scss', 'rule.expected.scss'); - }); - - it('Should sort properties inside nested rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('nested-rule-1.scss', 'nested-rule-1.expected.scss'); - }); - - it('Should sort properties divided by nested rules', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'left', 'color'] - ] }); - this.shouldBeEqual('nested-rule-2.scss', 'nested-rule-2.expected.scss'); - }); - - it('Should group declarations with proper comments and spaces (multiple lines)', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('comments-1.scss', 'comments-1.expected.scss'); - }); - - it('Should group declarations with proper comments and spaces (single line)', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('comments-2.scss', 'comments-2.expected.scss'); - }); - - it('Should divide properties from different groups with an empty line', function() { - this.comb.configure({ 'sort-order': [ - ['top'], ['color'] - ] }); - this.shouldBeEqual('different-groups.scss', 'different-groups.expected.scss'); - }); - - it('Should sort variables', function() { - this.comb.configure({ 'sort-order': [ - ['$variable', 'color'] - ] }); - this.shouldBeEqual('variable.scss', 'variable.expected.scss'); - }); - - it('Should sort imports', function() { - this.comb.configure({ 'sort-order': [ - ['$import', 'color'] - ] }); - this.shouldBeEqual('import.scss', 'import.expected.scss'); - }); - - it('Should sort @include-s', function() { - this.comb.configure({ 'sort-order': [ - ['$include', 'color'] - ] }); - this.shouldBeEqual('include.scss', 'include.expected.scss'); - }); - - it('Should sort @extend-s', function() { - this.comb.configure({ 'sort-order': [ - ['$include', 'color'] - ] }); - this.shouldBeEqual('extend.scss', 'extend.expected.scss'); - }); - - it('Should sort properties inside blocks passed to mixins', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'color'] - ] }); - this.shouldBeEqual('mixin.scss', 'mixin.expected.scss'); - }); - - it('Should handle properties preceeding rulesets', function() { - this.comb.configure({ 'sort-order': [ - ['top', 'left', 'color'] - ] }); - this.shouldBeEqual('ruleset.scss', 'ruleset.expected.scss'); - }); - - it('Should handle properties preceeding conditions', function() { - this.comb.configure({ 'sort-order': [ - ['font-size', 'display', 'top', 'color'] - ] }); - this.shouldBeEqual('condition.scss', 'condition.expected.scss'); - }); - - it('Should sort complex case with leftovers', function() { - this.comb.configure({ - "sort-order": [ - ["$variable"], - ["position"], - ["...", "border"], - ["$include"], - ["font"] - ] - }); - this.shouldBeEqual('leftovers.scss', 'leftovers.expected.scss'); - }); -}); diff --git a/node_modules/csscomb/test/options/sort-order-scss/comments-1.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/comments-1.expected.scss deleted file mode 100644 index 0aa257a..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/comments-1.expected.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - /* 2 */ - /* 3 */ - top: 0; /* 4 */ - color: tomato; /* 1 */ - /* 5 */ -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/comments-1.scss b/node_modules/csscomb/test/options/sort-order-scss/comments-1.scss deleted file mode 100644 index 18e6319..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/comments-1.scss +++ /dev/null @@ -1,7 +0,0 @@ -div { - color: tomato; /* 1 */ - /* 2 */ - /* 3 */ - top: 0; /* 4 */ - /* 5 */ -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/comments-2.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/comments-2.expected.scss deleted file mode 100644 index a9b2976..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/comments-2.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div {top: 0; /* 3 */ /* 4 *//* 1 */ color: tomato; /* 2 */ } diff --git a/node_modules/csscomb/test/options/sort-order-scss/comments-2.scss b/node_modules/csscomb/test/options/sort-order-scss/comments-2.scss deleted file mode 100644 index 617d4fd..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/comments-2.scss +++ /dev/null @@ -1 +0,0 @@ -div {/* 1 */ color: tomato; /* 2 */ top: 0; /* 3 */ /* 4 */} diff --git a/node_modules/csscomb/test/options/sort-order-scss/condition.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/condition.expected.scss deleted file mode 100644 index e56af51..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/condition.expected.scss +++ /dev/null @@ -1,8 +0,0 @@ -div { - top: 0; - color: tomato; - @if @color == tomato { - font-size: 2px; - display: block; - } - } diff --git a/node_modules/csscomb/test/options/sort-order-scss/condition.scss b/node_modules/csscomb/test/options/sort-order-scss/condition.scss deleted file mode 100644 index 9211813..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/condition.scss +++ /dev/null @@ -1,8 +0,0 @@ -div { - color: tomato; - @if @color == tomato { - display: block; - font-size: 2px; - } - top: 0; - } diff --git a/node_modules/csscomb/test/options/sort-order-scss/different-groups.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/different-groups.expected.scss deleted file mode 100644 index dddc16f..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/different-groups.expected.scss +++ /dev/null @@ -1,5 +0,0 @@ -div { - top: 0; - - color: tomato; -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/different-groups.scss b/node_modules/csscomb/test/options/sort-order-scss/different-groups.scss deleted file mode 100644 index 7ffa908..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/different-groups.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - top: 0; -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/extend.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/extend.expected.scss deleted file mode 100644 index a1ac4c7..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/extend.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div {@extend %nani; color: tomato; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/extend.scss b/node_modules/csscomb/test/options/sort-order-scss/extend.scss deleted file mode 100644 index 381bc92..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/extend.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @extend %nani; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/import.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/import.expected.scss deleted file mode 100644 index 9c403df..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/import.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div {@import "foo.css"; color: tomato; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/import.scss b/node_modules/csscomb/test/options/sort-order-scss/import.scss deleted file mode 100644 index 681ccd0..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/import.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @import "foo.css"; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/include.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/include.expected.scss deleted file mode 100644 index ea381a7..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/include.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div {@include .nani; color: tomato; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/include.scss b/node_modules/csscomb/test/options/sort-order-scss/include.scss deleted file mode 100644 index c0ed134..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/include.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; @include .nani; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/leftovers.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/leftovers.expected.scss deleted file mode 100644 index bac4c99..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/leftovers.expected.scss +++ /dev/null @@ -1,36 +0,0 @@ -a { - $red: tomato; - - position: $tomato; - - leftover: yay; - border: 1px solid; - - @include .nani; - - font: 20px/16px Arial, sans-serif; -} -b { - $red: tomato; - - position: $tomato; - - leftover: yay; - border: 1px solid; - - @include .nani; - - font: 20px/16px Arial, sans-serif; -} -c { - $red: tomato; - - position: $tomato; - - leftover: yay; - border: 1px solid; - - @include .nani; - - font: 20px/16px Arial, sans-serif; -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/leftovers.scss b/node_modules/csscomb/test/options/sort-order-scss/leftovers.scss deleted file mode 100644 index 0068e54..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/leftovers.scss +++ /dev/null @@ -1,24 +0,0 @@ -a { - leftover: yay; - border: 1px solid; - @include .nani; - font: 20px/16px Arial, sans-serif; - position: $tomato; - $red: tomato; -} -b { - border: 1px solid; - @include .nani; - position: $tomato; - leftover: yay; - font: 20px/16px Arial, sans-serif; - $red: tomato; -} -c { - border: 1px solid; - @include .nani; - font: 20px/16px Arial, sans-serif; - position: $tomato; - $red: tomato; - leftover: yay; -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/mixin.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/mixin.expected.scss deleted file mode 100644 index abfbef4..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/mixin.expected.scss +++ /dev/null @@ -1 +0,0 @@ -.foo { @include nani {top: 0; color: tomato; } } diff --git a/node_modules/csscomb/test/options/sort-order-scss/mixin.scss b/node_modules/csscomb/test/options/sort-order-scss/mixin.scss deleted file mode 100644 index b174d3b..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/mixin.scss +++ /dev/null @@ -1 +0,0 @@ -.foo { @include nani { color: tomato; top: 0; } } diff --git a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.expected.scss deleted file mode 100644 index 54dada6..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; a {top: 0; color: nani; } } diff --git a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.scss b/node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.scss deleted file mode 100644 index ee50453..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-1.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; a { color: nani; top: 0; } } diff --git a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.expected.scss deleted file mode 100644 index f5c2e9f..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div { left: 0; color: tomato; a {top: 0; color: nani; }} diff --git a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.scss b/node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.scss deleted file mode 100644 index 0bc6212..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/nested-rule-2.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; a { color: nani; top: 0; } left: 0; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/rule-multiline.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/rule-multiline.expected.scss deleted file mode 100644 index 5f6d5e3..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/rule-multiline.expected.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - top: 0; - color: tomato; - } diff --git a/node_modules/csscomb/test/options/sort-order-scss/rule-multiline.scss b/node_modules/csscomb/test/options/sort-order-scss/rule-multiline.scss deleted file mode 100644 index 8ae2931..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/rule-multiline.scss +++ /dev/null @@ -1,4 +0,0 @@ -div { - color: tomato; - top: 0; - } diff --git a/node_modules/csscomb/test/options/sort-order-scss/rule.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/rule.expected.scss deleted file mode 100644 index a7669bd..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/rule.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div {top: 0; color: tomato; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/rule.scss b/node_modules/csscomb/test/options/sort-order-scss/rule.scss deleted file mode 100644 index 561b980..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/rule.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: tomato; top: 0; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/ruleset.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/ruleset.expected.scss deleted file mode 100644 index 194ff87..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/ruleset.expected.scss +++ /dev/null @@ -1,8 +0,0 @@ -div { - left: 0; - color: tomato; - a { - top: 0; - color: nani; - } -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/ruleset.scss b/node_modules/csscomb/test/options/sort-order-scss/ruleset.scss deleted file mode 100644 index d7ed641..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/ruleset.scss +++ /dev/null @@ -1,8 +0,0 @@ -div { - color: tomato; - a { - color: nani; - top: 0; - } - left: 0; -} diff --git a/node_modules/csscomb/test/options/sort-order-scss/variable.expected.scss b/node_modules/csscomb/test/options/sort-order-scss/variable.expected.scss deleted file mode 100644 index c17c634..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/variable.expected.scss +++ /dev/null @@ -1 +0,0 @@ -div {$red: tomato; color: $tomato; } diff --git a/node_modules/csscomb/test/options/sort-order-scss/variable.scss b/node_modules/csscomb/test/options/sort-order-scss/variable.scss deleted file mode 100644 index f759f22..0000000 --- a/node_modules/csscomb/test/options/sort-order-scss/variable.scss +++ /dev/null @@ -1 +0,0 @@ -div { color: $tomato; $red: tomato; } diff --git a/node_modules/csscomb/test/options/sort-order.js b/node_modules/csscomb/test/options/sort-order.js deleted file mode 100644 index c8f7077..0000000 --- a/node_modules/csscomb/test/options/sort-order.js +++ /dev/null @@ -1,115 +0,0 @@ -var assert = require('assert'); - -describe('options/sort-order', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should be in expected order in case properties are not grouped', function() { - this.comb.configure({ 'sort-order': ['position', 'z-index'] }); - this.shouldBeEqual('single-group.css', 'single-group.expected.css'); - }); - - it('Should be in expected order in case of 1 group', function() { - this.comb.configure({ 'sort-order': [ - ['position', 'z-index'] - ] }); - this.shouldBeEqual('single-group.css', 'single-group.expected.css'); - }); - - it('Shuld be in expected order in case of multiple groups', function() { - this.comb.configure({ 'sort-order': [ - ['position', 'z-index'], - ['width', 'height'] - ] }); - this.shouldBeEqual('multiple-groups.css', 'multiple-groups.expected.css'); - - }); - - it('Should work correctly with comments in case of 1 group', function() { - this.comb.configure({ 'sort-order': [ - ['border-bottom', 'font-style'], - ] }); - this.shouldBeEqual('single-group-comments.css', 'single-group-comments.expected.css'); - }); - - it('Should work correctly with comments in case of multiple groups', function() { - this.comb.configure({ 'sort-order': [ - ['margin'], - ['padding'] - ] }); - this.shouldBeEqual('multiple-groups-comments.css', 'multiple-groups-comments.expected.css'); - }); - - it('Should parse semicolons inside data uri correctly', function() { - this.comb.configure({ - 'sort-order': [ - ['position', 'background', 'color'] - ] - }); - this.shouldBeEqual('data-uri.css', 'data-uri.expected.css'); - }); - - it('Should not add more than 1 line between groups', function() { - var input = this.readFile('multiple-groups-2.css'); - var expected = this.readFile('multiple-groups-2.expected.css'); - this.comb.configure({ - 'sort-order': [ - ['top'], ['color'] - ] - }); - - for (var i = 6; i--;) { - input = this.comb.processString(input); - } - assert.equal(input, expected); - }); - - it('Issue 94. Test 1', function() { - var config = this.Comb.getConfig('csscomb'); - this.comb.configure(config); - this.shouldBeEqual('issue-94-1.css', 'issue-94-1.expected.css'); - }); - - it('Issue 94. Test 2', function() { - var config = this.Comb.getConfig('csscomb'); - this.comb.configure(config); - this.shouldBeEqual('issue-94-2.css', 'issue-94-2.expected.css'); - }); - - it('Issue 94. Test 3', function() { - var config = this.Comb.getConfig('csscomb'); - this.comb.configure(config); - this.shouldBeEqual('issue-94-3.css', 'issue-94-3.expected.css'); - }); - - it('Should place the leftovers in the end', function() { - var config = this.Comb.getConfig('csscomb'); - this.comb.configure(config); - this.shouldBeEqual('leftovers-1.css', 'leftovers-1.expected.css'); - }); - - it('Should place the leftovers in the beginning', function() { - var config = this.Comb.getConfig('csscomb'); - config['sort-order'][0].unshift(['...']); - this.comb.configure(config); - this.shouldBeEqual('leftovers-2.css', 'leftovers-2.expected.css'); - config['sort-order'][0].shift(); - }); - - it('Should place the leftovers in the beginning of its group', function() { - var config = this.Comb.getConfig('csscomb'); - config['sort-order'][1].unshift('...'); - this.comb.configure(config); - this.shouldBeEqual('leftovers-3.css', 'leftovers-3.expected.css'); - config['sort-order'][1].shift(); - }); - - it('Should place the leftovers in the middle of its group', function() { - var config = this.Comb.getConfig('csscomb'); - config['sort-order'][1].splice(1, 0, '...'); - this.comb.configure(config); - this.shouldBeEqual('leftovers-4.css', 'leftovers-4.expected.css'); - config['sort-order'][1].splice(1, 1); - }); -}); diff --git a/node_modules/csscomb/test/options/sort-order/data-uri.css b/node_modules/csscomb/test/options/sort-order/data-uri.css deleted file mode 100644 index 3552dfe..0000000 --- a/node_modules/csscomb/test/options/sort-order/data-uri.css +++ /dev/null @@ -1,7 +0,0 @@ -a -{ - color: tomato; - background: #D2D2D2 no-repeat url('data:image/svg+xml;charset=US-ASCII.naninani'); - position: absolute; -} - diff --git a/node_modules/csscomb/test/options/sort-order/data-uri.expected.css b/node_modules/csscomb/test/options/sort-order/data-uri.expected.css deleted file mode 100644 index 74b14a2..0000000 --- a/node_modules/csscomb/test/options/sort-order/data-uri.expected.css +++ /dev/null @@ -1,7 +0,0 @@ -a -{ - position: absolute; - background: #D2D2D2 no-repeat url('data:image/svg+xml;charset=US-ASCII.naninani'); - color: tomato; -} - diff --git a/node_modules/csscomb/test/options/sort-order/issue-94-1.css b/node_modules/csscomb/test/options/sort-order/issue-94-1.css deleted file mode 100644 index 54131c5..0000000 --- a/node_modules/csscomb/test/options/sort-order/issue-94-1.css +++ /dev/null @@ -1,18 +0,0 @@ -.test -{ - position: absolute; - top: -1px; - right: -1px; - bottom: -1px; - left: -1px; - - border: 1px solid transparent; - border-color: rgba(0,0,0,0.38) rgba(0,0,0,0.27) rgba(0,0,0,0.16); - - background: -webkit-linear-gradient(#fff, #fff); - background: linear-gradient(#fff, #fff); - background-clip: padding-box; - background-size: 16px 16px; - - -webkit-appearance: textfield; -} diff --git a/node_modules/csscomb/test/options/sort-order/issue-94-1.expected.css b/node_modules/csscomb/test/options/sort-order/issue-94-1.expected.css deleted file mode 100644 index 0943808..0000000 --- a/node_modules/csscomb/test/options/sort-order/issue-94-1.expected.css +++ /dev/null @@ -1,17 +0,0 @@ -.test -{ - position: absolute; - top: -1px; - right: -1px; - bottom: -1px; - left: -1px; - - border: 1px solid transparent; - border-color: rgba(0,0,0,.38) rgba(0,0,0,.27) rgba(0,0,0,.16); - background: -webkit-linear-gradient(#fff, #fff); - background: linear-gradient(#fff, #fff); - background-clip: padding-box; - background-size: 16px 16px; - - -webkit-appearance: textfield; -} diff --git a/node_modules/csscomb/test/options/sort-order/issue-94-2.css b/node_modules/csscomb/test/options/sort-order/issue-94-2.css deleted file mode 100644 index 0365913..0000000 --- a/node_modules/csscomb/test/options/sort-order/issue-94-2.css +++ /dev/null @@ -1,19 +0,0 @@ -.test -{ - width: 0; - width: 100%; - height: 0; - - background: #fff; - color: #000; - - display: -moz-inline-stack; - display: inline-block; - - position: absolute; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; -} diff --git a/node_modules/csscomb/test/options/sort-order/issue-94-2.expected.css b/node_modules/csscomb/test/options/sort-order/issue-94-2.expected.css deleted file mode 100644 index 85e618d..0000000 --- a/node_modules/csscomb/test/options/sort-order/issue-94-2.expected.css +++ /dev/null @@ -1,19 +0,0 @@ -.test -{ - position: absolute; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - - display: -moz-inline-stack; - display: inline-block; - - width: 0; - width: 100%; - height: 0; - - color: #000; - background: #fff; -} diff --git a/node_modules/csscomb/test/options/sort-order/issue-94-3.css b/node_modules/csscomb/test/options/sort-order/issue-94-3.css deleted file mode 100644 index 872eddc..0000000 --- a/node_modules/csscomb/test/options/sort-order/issue-94-3.css +++ /dev/null @@ -1,21 +0,0 @@ -.input-view { - position: absolute; - -webkit-appearance: none; - right: -1px; - bottom: -1px; - left: -1px; - - border: 1px solid transparent; - - top: -1px; - - background: -webkit-linear-gradient(#FFF, #FFF); - background: linear-gradient(#FFF, #FFF); - background-clip: padding-box; - background-size: 16px 16px; - box-shadow: 0 1px 0 rgba(255,255,255,0.2), inset 0 1px 1px rgba(0,0,0,0.1); - - border-color: rgba(0,0,0,0.27); - border-top-color: rgba(0,0,0,0.38); - border-bottom-color: rgba(0,0,0,0.16); -} diff --git a/node_modules/csscomb/test/options/sort-order/issue-94-3.expected.css b/node_modules/csscomb/test/options/sort-order/issue-94-3.expected.css deleted file mode 100644 index 92f2943..0000000 --- a/node_modules/csscomb/test/options/sort-order/issue-94-3.expected.css +++ /dev/null @@ -1,20 +0,0 @@ -.input-view -{ - position: absolute; - top: -1px; - right: -1px; - bottom: -1px; - left: -1px; - - border: 1px solid transparent; - border-color: rgba(0,0,0,.27); - border-top-color: rgba(0,0,0,.38); - border-bottom-color: rgba(0,0,0,.16); - background: -webkit-linear-gradient(#fff, #fff); - background: linear-gradient(#fff, #fff); - background-clip: padding-box; - background-size: 16px 16px; - box-shadow: 0 1px 0 rgba(255,255,255,.2), inset 0 1px 1px rgba(0,0,0,.1); - - -webkit-appearance: none; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-1.css b/node_modules/csscomb/test/options/sort-order/leftovers-1.css deleted file mode 100644 index d559d4e..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-1.css +++ /dev/null @@ -1,20 +0,0 @@ -a -{ - leftover: yay; - z-index: 1; - position: absolute; -} - -b -{ - z-index: 2; - leftover: yay; - position: absolute; -} - -c -{ - z-index: 3; - position: absolute; - leftover: yay; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-1.expected.css b/node_modules/csscomb/test/options/sort-order/leftovers-1.expected.css deleted file mode 100644 index 145b83d..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-1.expected.css +++ /dev/null @@ -1,23 +0,0 @@ -a -{ - position: absolute; - z-index: 1; - - leftover: yay; -} - -b -{ - position: absolute; - z-index: 2; - - leftover: yay; -} - -c -{ - position: absolute; - z-index: 3; - - leftover: yay; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-2.css b/node_modules/csscomb/test/options/sort-order/leftovers-2.css deleted file mode 100644 index d559d4e..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-2.css +++ /dev/null @@ -1,20 +0,0 @@ -a -{ - leftover: yay; - z-index: 1; - position: absolute; -} - -b -{ - z-index: 2; - leftover: yay; - position: absolute; -} - -c -{ - z-index: 3; - position: absolute; - leftover: yay; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-2.expected.css b/node_modules/csscomb/test/options/sort-order/leftovers-2.expected.css deleted file mode 100644 index 05c8292..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-2.expected.css +++ /dev/null @@ -1,23 +0,0 @@ -a -{ - leftover: yay; - - position: absolute; - z-index: 1; -} - -b -{ - leftover: yay; - - position: absolute; - z-index: 2; -} - -c -{ - leftover: yay; - - position: absolute; - z-index: 3; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-3.css b/node_modules/csscomb/test/options/sort-order/leftovers-3.css deleted file mode 100644 index d559d4e..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-3.css +++ /dev/null @@ -1,20 +0,0 @@ -a -{ - leftover: yay; - z-index: 1; - position: absolute; -} - -b -{ - z-index: 2; - leftover: yay; - position: absolute; -} - -c -{ - z-index: 3; - position: absolute; - leftover: yay; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-3.expected.css b/node_modules/csscomb/test/options/sort-order/leftovers-3.expected.css deleted file mode 100644 index 9522dc5..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-3.expected.css +++ /dev/null @@ -1,20 +0,0 @@ -a -{ - leftover: yay; - position: absolute; - z-index: 1; -} - -b -{ - leftover: yay; - position: absolute; - z-index: 2; -} - -c -{ - leftover: yay; - position: absolute; - z-index: 3; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-4.css b/node_modules/csscomb/test/options/sort-order/leftovers-4.css deleted file mode 100644 index d559d4e..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-4.css +++ /dev/null @@ -1,20 +0,0 @@ -a -{ - leftover: yay; - z-index: 1; - position: absolute; -} - -b -{ - z-index: 2; - leftover: yay; - position: absolute; -} - -c -{ - z-index: 3; - position: absolute; - leftover: yay; -} diff --git a/node_modules/csscomb/test/options/sort-order/leftovers-4.expected.css b/node_modules/csscomb/test/options/sort-order/leftovers-4.expected.css deleted file mode 100644 index 874c72a..0000000 --- a/node_modules/csscomb/test/options/sort-order/leftovers-4.expected.css +++ /dev/null @@ -1,20 +0,0 @@ -a -{ - position: absolute; - leftover: yay; - z-index: 1; -} - -b -{ - position: absolute; - leftover: yay; - z-index: 2; -} - -c -{ - position: absolute; - leftover: yay; - z-index: 3; -} diff --git a/node_modules/csscomb/test/options/sort-order/multiple-groups-2.css b/node_modules/csscomb/test/options/sort-order/multiple-groups-2.css deleted file mode 100644 index 79291ab..0000000 --- a/node_modules/csscomb/test/options/sort-order/multiple-groups-2.css +++ /dev/null @@ -1,6 +0,0 @@ -a -{ - color: tomato; - top: 0; -} - diff --git a/node_modules/csscomb/test/options/sort-order/multiple-groups-2.expected.css b/node_modules/csscomb/test/options/sort-order/multiple-groups-2.expected.css deleted file mode 100644 index 96a0ec2..0000000 --- a/node_modules/csscomb/test/options/sort-order/multiple-groups-2.expected.css +++ /dev/null @@ -1,7 +0,0 @@ -a -{ - top: 0; - - color: tomato; -} - diff --git a/node_modules/csscomb/test/options/sort-order/multiple-groups-comments.css b/node_modules/csscomb/test/options/sort-order/multiple-groups-comments.css deleted file mode 100644 index 5012f20..0000000 --- a/node_modules/csscomb/test/options/sort-order/multiple-groups-comments.css +++ /dev/null @@ -1,5 +0,0 @@ -a, b, i /* foobar */ -{ - padding: 0; - margin: 0; - } diff --git a/node_modules/csscomb/test/options/sort-order/multiple-groups-comments.expected.css b/node_modules/csscomb/test/options/sort-order/multiple-groups-comments.expected.css deleted file mode 100644 index 49a1ba8..0000000 --- a/node_modules/csscomb/test/options/sort-order/multiple-groups-comments.expected.css +++ /dev/null @@ -1,6 +0,0 @@ -a, b, i /* foobar */ -{ - margin: 0; - - padding: 0; - } diff --git a/node_modules/csscomb/test/options/sort-order/multiple-groups.css b/node_modules/csscomb/test/options/sort-order/multiple-groups.css deleted file mode 100644 index a16d45e..0000000 --- a/node_modules/csscomb/test/options/sort-order/multiple-groups.css +++ /dev/null @@ -1,7 +0,0 @@ -a -{ - z-index: 2; - position: absolute; - height: 2px; - width: 2px; -} diff --git a/node_modules/csscomb/test/options/sort-order/multiple-groups.expected.css b/node_modules/csscomb/test/options/sort-order/multiple-groups.expected.css deleted file mode 100644 index 3f27b45..0000000 --- a/node_modules/csscomb/test/options/sort-order/multiple-groups.expected.css +++ /dev/null @@ -1,8 +0,0 @@ -a -{ - position: absolute; - z-index: 2; - - width: 2px; - height: 2px; -} diff --git a/node_modules/csscomb/test/options/sort-order/single-group-comments.css b/node_modules/csscomb/test/options/sort-order/single-group-comments.css deleted file mode 100644 index dc78ba3..0000000 --- a/node_modules/csscomb/test/options/sort-order/single-group-comments.css +++ /dev/null @@ -1,5 +0,0 @@ -div p em { - /* upline comment */ - font-style:italic; - border-bottom:1px solid red; /* trololo */ /* trololo */ -} diff --git a/node_modules/csscomb/test/options/sort-order/single-group-comments.expected.css b/node_modules/csscomb/test/options/sort-order/single-group-comments.expected.css deleted file mode 100644 index ca4e166..0000000 --- a/node_modules/csscomb/test/options/sort-order/single-group-comments.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -div p em { - border-bottom:1px solid red; /* trololo */ /* trololo */ - /* upline comment */ - font-style:italic; -} diff --git a/node_modules/csscomb/test/options/sort-order/single-group.css b/node_modules/csscomb/test/options/sort-order/single-group.css deleted file mode 100644 index ed8925d..0000000 --- a/node_modules/csscomb/test/options/sort-order/single-group.css +++ /dev/null @@ -1,5 +0,0 @@ -a -{ - z-index: 2; - position: absolute; -} diff --git a/node_modules/csscomb/test/options/sort-order/single-group.expected.css b/node_modules/csscomb/test/options/sort-order/single-group.expected.css deleted file mode 100644 index 5bcb46c..0000000 --- a/node_modules/csscomb/test/options/sort-order/single-group.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a -{ - position: absolute; - z-index: 2; -} diff --git a/node_modules/csscomb/test/options/space-after-colon-sass.js b/node_modules/csscomb/test/options/space-after-colon-sass.js deleted file mode 100644 index 98f14be..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-sass.js +++ /dev/null @@ -1,15 +0,0 @@ -describe('options/space-after-colon (sass):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should set proper space if colon is after property name', function() { - this.comb.configure({ 'space-after-colon': 2 }); - this.shouldBeEqual('colon-after-property-name.sass', 'colon-after-property-name.expected.sass'); - }); - - it('Should not change space after colon which is before property name', function() { - this.comb.configure({ 'space-after-colon': 1 }); - this.shouldBeEqual('colon-before-property-name.sass', 'colon-before-property-name.expected.sass'); - }); -}); diff --git a/node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.expected.sass b/node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.expected.sass deleted file mode 100644 index 9b55f4a..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ -a - color: panda - top: 0 diff --git a/node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.sass b/node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.sass deleted file mode 100644 index 5e4e236..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-sass/colon-after-property-name.sass +++ /dev/null @@ -1,3 +0,0 @@ -a - color: panda - top:0 diff --git a/node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.expected.sass b/node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.expected.sass deleted file mode 100644 index a8a5e3e..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ -a - :color panda - :top 0 diff --git a/node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.sass b/node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.sass deleted file mode 100644 index a8a5e3e..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-sass/colon-before-property-name.sass +++ /dev/null @@ -1,3 +0,0 @@ -a - :color panda - :top 0 diff --git a/node_modules/csscomb/test/options/space-after-colon-scss.js b/node_modules/csscomb/test/options/space-after-colon-scss.js deleted file mode 100644 index 5a9f83b..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-scss.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('options/space-after-colon (scss):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Space after colon should not affect pseudo elements', function() { - this.comb.configure({ 'space-after-colon': 1 }); - this.shouldBeEqual('pseudo-elements.scss', 'pseudo-elements.expected.scss'); - }); -}); diff --git a/node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.expected.scss b/node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.expected.scss deleted file mode 100644 index 46b16d2..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.expected.scss +++ /dev/null @@ -1,11 +0,0 @@ -li{ - float: left; - - a:hover{ - text-decoration: underline; - } -} - -li:before { - color: tomato; -} diff --git a/node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.scss b/node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.scss deleted file mode 100644 index dbb4ace..0000000 --- a/node_modules/csscomb/test/options/space-after-colon-scss/pseudo-elements.scss +++ /dev/null @@ -1,11 +0,0 @@ -li{ - float:left; - - a:hover{ - text-decoration:underline; - } -} - -li:before { - color:tomato; -} diff --git a/node_modules/csscomb/test/options/space-after-colon.js b/node_modules/csscomb/test/options/space-after-colon.js deleted file mode 100644 index a0abb4f..0000000 --- a/node_modules/csscomb/test/options/space-after-colon.js +++ /dev/null @@ -1,68 +0,0 @@ -describe('options/space-after-colon:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-after-colon': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-after-colon': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-after-colon': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space after colon', function() { - this.comb.configure({ 'space-after-colon': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only)=> should set proper space after colon', function() { - this.comb.configure({ 'space-after-colon': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spacesand newlines)=> should set proper space after colon', function() { - this.comb.configure({ 'space-after-colon': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespaces', function() { - this.shouldDetect( - ['space-after-colon'], - 'a { color:red }', - { 'space-after-colon': '' } - ); - }); - - it('Should detect space from two variants', function() { - this.shouldDetect( - ['space-after-colon'], - 'a { color: red; color :red }', - { 'space-after-colon': ' ' } - ); - }); - - it('Should detect no whitespaces along three variants', function() { - this.shouldDetect( - ['space-after-colon'], - 'a { color: red; background :red } b { width:10px }', - { 'space-after-colon': '' } - ); - }); - - it('Should detect space', function() { - this.shouldDetect( - ['space-after-colon'], - 'a { color : red; background :red } b { width: 10px }', - { 'space-after-colon': ' ' } - ); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-after-colon/test-2.expected.css b/node_modules/csscomb/test/options/space-after-colon/test-2.expected.css deleted file mode 100644 index c1355f3..0000000 --- a/node_modules/csscomb/test/options/space-after-colon/test-2.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a { color: red } -a{color: red} -a {color : red} -a {color : /* foo */ red } -a {color /* bar */ : red } diff --git a/node_modules/csscomb/test/options/space-after-colon/test-3.expected.css b/node_modules/csscomb/test/options/space-after-colon/test-3.expected.css deleted file mode 100644 index 63d57dc..0000000 --- a/node_modules/csscomb/test/options/space-after-colon/test-3.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -a { color: - red } -a{color: - red} -a {color : - red} -a {color : - /* foo */ red } -a {color /* bar */ : - red } diff --git a/node_modules/csscomb/test/options/space-after-colon/test.css b/node_modules/csscomb/test/options/space-after-colon/test.css deleted file mode 100644 index 637656f..0000000 --- a/node_modules/csscomb/test/options/space-after-colon/test.css +++ /dev/null @@ -1,5 +0,0 @@ -a { color: red } -a{color:red} -a {color : red} -a {color : /* foo */ red } -a {color /* bar */ : red } diff --git a/node_modules/csscomb/test/options/space-after-colon/test.expected.css b/node_modules/csscomb/test/options/space-after-colon/test.expected.css deleted file mode 100644 index 2d13781..0000000 --- a/node_modules/csscomb/test/options/space-after-colon/test.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a { color:red } -a{color:red} -a {color :red} -a {color :/* foo */ red } -a {color /* bar */ :red } diff --git a/node_modules/csscomb/test/options/space-after-combinator.js b/node_modules/csscomb/test/options/space-after-combinator.js deleted file mode 100644 index 8088bca..0000000 --- a/node_modules/csscomb/test/options/space-after-combinator.js +++ /dev/null @@ -1,84 +0,0 @@ -describe('options/space-after-combinator:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-after-combinator': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-after-combinator': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-after-combinator': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space after combinator', function() { - this.comb.configure({ 'space-after-combinator': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space after combinator', function() { - this.comb.configure({ 'space-after-combinator': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space after combinator', function() { - this.comb.configure({ 'space-after-combinator': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespaces after combinator', function() { - this.shouldDetect( - ['space-after-combinator'], - 'a+b { color:red }', - { 'space-after-combinator': '' } - ); - }); - - it('Should detect a space after combinator', function() { - this.shouldDetect( - ['space-after-combinator'], - 'a + \n b { color:red }', - { 'space-after-combinator': ' \n ' } - ); - }); - - it('Should detect a space after combinator in long selector', function() { - this.shouldDetect( - ['space-after-combinator'], - 'a + b ~ c>d { color:red }', - { 'space-after-combinator': ' ' } - ); - }); - - it('Should detect a space after combinator in long selector, test 2', function() { - this.shouldDetect( - ['space-after-combinator'], - 'a>b + c + d { color:red }', - { 'space-after-combinator': ' ' } - ); - }); - - it('Should detect no whitespaces after combinator in long selector', function() { - this.shouldDetect( - ['space-after-combinator'], - 'a+b ~ c+d { color:red }', - { 'space-after-combinator': '' } - ); - }); - - it('Shouldn’t detect whitespaces after combinator in selector without combinators', function() { - this.shouldDetect( - ['space-after-combinator'], - 'a { color:red }', - {} - ); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-after-combinator/test-2.expected.css b/node_modules/csscomb/test/options/space-after-combinator/test-2.expected.css deleted file mode 100644 index 32df439..0000000 --- a/node_modules/csscomb/test/options/space-after-combinator/test-2.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -a> b { color: red } -a> b { color: red } -a > b { color: red } -a+ b { color: red } -a+ b { color: red } -a + b { color: red } -a~ b { color: red } -a~ b { color: red } -a ~ b { color: red } -a ~ b+ c> d { color: red } diff --git a/node_modules/csscomb/test/options/space-after-combinator/test-3.expected.css b/node_modules/csscomb/test/options/space-after-combinator/test-3.expected.css deleted file mode 100644 index 9d34666..0000000 --- a/node_modules/csscomb/test/options/space-after-combinator/test-3.expected.css +++ /dev/null @@ -1,22 +0,0 @@ -a> - b { color: red } -a> - b { color: red } -a > - b { color: red } -a+ - b { color: red } -a+ - b { color: red } -a + - b { color: red } -a~ - b { color: red } -a~ - b { color: red } -a ~ - b { color: red } -a ~ - b+ - c> - d { color: red } diff --git a/node_modules/csscomb/test/options/space-after-combinator/test.css b/node_modules/csscomb/test/options/space-after-combinator/test.css deleted file mode 100644 index 4ad8d86..0000000 --- a/node_modules/csscomb/test/options/space-after-combinator/test.css +++ /dev/null @@ -1,10 +0,0 @@ -a>b { color: red } -a> b { color: red } -a >b { color: red } -a+b { color: red } -a+ b { color: red } -a +b { color: red } -a~b { color: red } -a~ b { color: red } -a ~b { color: red } -a ~b+ c>d { color: red } diff --git a/node_modules/csscomb/test/options/space-after-combinator/test.expected.css b/node_modules/csscomb/test/options/space-after-combinator/test.expected.css deleted file mode 100644 index 186958d..0000000 --- a/node_modules/csscomb/test/options/space-after-combinator/test.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -a>b { color: red } -a>b { color: red } -a >b { color: red } -a+b { color: red } -a+b { color: red } -a +b { color: red } -a~b { color: red } -a~b { color: red } -a ~b { color: red } -a ~b+c>d { color: red } diff --git a/node_modules/csscomb/test/options/space-after-opening-brace.js b/node_modules/csscomb/test/options/space-after-opening-brace.js deleted file mode 100644 index 06176f3..0000000 --- a/node_modules/csscomb/test/options/space-after-opening-brace.js +++ /dev/null @@ -1,84 +0,0 @@ -describe('options/space-after-opening-brace:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-after-opening-brace': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-after-opening-brace': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-after-opening-brace': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space after {', function() { - this.comb.configure({ 'space-after-opening-brace': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space after {', function() { - this.comb.configure({ 'space-after-opening-brace': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space after {', function() { - this.comb.configure({ 'space-after-opening-brace': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespace', function() { - this.shouldDetect( - ['space-after-opening-brace'], - 'a{top:0}', - { 'space-after-opening-brace': '' } - ); - }); - - it('Should detect whitespace', function() { - this.shouldDetect( - ['space-after-opening-brace'], - 'a{\n\ttop:0}', - { 'space-after-opening-brace': '\n\t' } - ); - }); - - it('Should detect no whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-after-opening-brace'], - 'a{top:0} b{\n left:0}', - { 'space-after-opening-brace': '' } - ); - }); - - it('Should detect whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-after-opening-brace'], - 'a{ top:0 } b{left:0}', - { 'space-after-opening-brace': ' ' } - ); - }); - - it('Should detect no whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-after-opening-brace'], - 'a{top:0} b { left: 0 } c{\n\tright:0}', - { 'space-after-opening-brace': '' } - ); - }); - - it('Should detect whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-after-opening-brace'], - 'a{\ntop:0} b{\nleft:0} c{\n right:0}', - { 'space-after-opening-brace': '\n' } - ); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-after-opening-brace/test-2.expected.css b/node_modules/csscomb/test/options/space-after-opening-brace/test-2.expected.css deleted file mode 100644 index a34ef36..0000000 --- a/node_modules/csscomb/test/options/space-after-opening-brace/test-2.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a{ top: 0} -a { top: 0 } - -@media print{ a{ top: 0}} -@media print { a { top: 0 } } diff --git a/node_modules/csscomb/test/options/space-after-opening-brace/test-3.expected.css b/node_modules/csscomb/test/options/space-after-opening-brace/test-3.expected.css deleted file mode 100644 index 4c044b4..0000000 --- a/node_modules/csscomb/test/options/space-after-opening-brace/test-3.expected.css +++ /dev/null @@ -1,11 +0,0 @@ -a{ - top: 0} -a { - top: 0 } - -@media print{ - a{ - top: 0}} -@media print { - a { - top: 0 } } diff --git a/node_modules/csscomb/test/options/space-after-opening-brace/test.css b/node_modules/csscomb/test/options/space-after-opening-brace/test.css deleted file mode 100644 index 7c71281..0000000 --- a/node_modules/csscomb/test/options/space-after-opening-brace/test.css +++ /dev/null @@ -1,5 +0,0 @@ -a{top: 0} -a { top: 0 } - -@media print{a{top: 0}} -@media print { a { top: 0 } } diff --git a/node_modules/csscomb/test/options/space-after-opening-brace/test.expected.css b/node_modules/csscomb/test/options/space-after-opening-brace/test.expected.css deleted file mode 100644 index fa761a5..0000000 --- a/node_modules/csscomb/test/options/space-after-opening-brace/test.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a{top: 0} -a {top: 0 } - -@media print{a{top: 0}} -@media print {a {top: 0 } } diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter-sass.js b/node_modules/csscomb/test/options/space-after-selector-delimiter-sass.js deleted file mode 100644 index 0c98282..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter-sass.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('options/space-after-selector-delimiter (sass):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Issue 238', function() { - this.comb.configure({ 'space-after-selector-delimiter': '\n' }); - this.shouldBeEqual('issue-238.sass', 'issue-238.expected.sass'); - }); -}); diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.expected.sass b/node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.expected.sass deleted file mode 100644 index 1857160..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.expected.sass +++ /dev/null @@ -1,5 +0,0 @@ -html, -body, -p - background: #fff - color: #000 diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.sass b/node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.sass deleted file mode 100644 index 5fc2e13..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter-sass/issue-238.sass +++ /dev/null @@ -1,4 +0,0 @@ -html, -body, p - background: #fff - color: #000 diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter.js b/node_modules/csscomb/test/options/space-after-selector-delimiter.js deleted file mode 100644 index 8d82ae1..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter.js +++ /dev/null @@ -1,83 +0,0 @@ -describe('options/space-after-selector-delimiter:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-after-selector-delimiter': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-after-selector-delimiter': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-after-selector-delimiter': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space after selector delimiter', function() { - this.comb.configure({ 'space-after-selector-delimiter': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space after selector delimiter', function() { - this.comb.configure({ 'space-after-selector-delimiter': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space after selector delimiter', function() { - this.comb.configure({ 'space-after-selector-delimiter': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespace', function() { - this.shouldDetect( - ['space-after-selector-delimiter'], - 'a,b{top:0}', - { 'space-after-selector-delimiter': '' } - ); - }); - - it('Should detect whitespace', function() { - this.shouldDetect( - ['space-after-selector-delimiter'], - 'a, \n b {top:0}', - { 'space-after-selector-delimiter': ' \n ' } - ); - }); - - it('Should detect no whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-after-selector-delimiter'], - 'a,b{top:0} a, b{left:0}', - { 'space-after-selector-delimiter': '' } - ); - }); - - it('Should detect whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-after-selector-delimiter'], - 'a, b {top:0} b,a{left:0}', - { 'space-after-selector-delimiter': ' ' } - ); - }); - - it('Should detect no whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-after-selector-delimiter'], - 'a, b{top:0} b,c{left:0} c,d{right:0}', - { 'space-after-selector-delimiter': '' } - ); - }); - - it('Should detect whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-after-selector-delimiter'], - 'a,b{top:0} b, c{left:0} c, sd{right:0}', - { 'space-after-selector-delimiter': ' ' } - ); - }); -}); diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter/test-2.expected.css b/node_modules/csscomb/test/options/space-after-selector-delimiter/test-2.expected.css deleted file mode 100644 index 92d1ece..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter/test-2.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a, b { color: red } -a, b { color: red } -a , b { color: red } -a, b { color: red } -a+b, c>d, e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter/test-3.expected.css b/node_modules/csscomb/test/options/space-after-selector-delimiter/test-3.expected.css deleted file mode 100644 index 6a19848..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter/test-3.expected.css +++ /dev/null @@ -1,11 +0,0 @@ -a, - b { color: red } -a, - b { color: red } -a , - b { color: red } -a, - b { color: red } -a+b, - c>d, - e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter/test.css b/node_modules/csscomb/test/options/space-after-selector-delimiter/test.css deleted file mode 100644 index cd8e7d7..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter/test.css +++ /dev/null @@ -1,6 +0,0 @@ -a,b { color: red } -a, b { color: red } -a ,b { color: red } -a, -b { color: red } -a+b,c>d,e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-after-selector-delimiter/test.expected.css b/node_modules/csscomb/test/options/space-after-selector-delimiter/test.expected.css deleted file mode 100644 index b0d4fd2..0000000 --- a/node_modules/csscomb/test/options/space-after-selector-delimiter/test.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a,b { color: red } -a,b { color: red } -a ,b { color: red } -a,b { color: red } -a+b,c>d,e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-before-closing-brace.js b/node_modules/csscomb/test/options/space-before-closing-brace.js deleted file mode 100644 index a9d9a6c..0000000 --- a/node_modules/csscomb/test/options/space-before-closing-brace.js +++ /dev/null @@ -1,76 +0,0 @@ -describe('options/space-before-closing-brace:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-before-closing-brace': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-before-closing-brace': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-before-closing-brace': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space before }', function() { - this.comb.configure({ 'space-before-closing-brace': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space before }', function() { - this.comb.configure({ 'space-before-closing-brace': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space before }', function() { - this.comb.configure({ 'space-before-closing-brace': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespace', function() { - this.shouldDetect( - ['space-before-closing-brace'], - 'a{top:0}', - { 'space-before-closing-brace': '' } - ); - }); - - it('Should detect no whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-before-closing-brace'], - 'a{top:0} b { color: tomato; }', - { 'space-before-closing-brace': '' } - ); - }); - - it('Should detect whitespace', function() { - this.shouldDetect( - ['space-before-closing-brace'], - 'a { top:0 }', - { 'space-before-closing-brace': ' ' } - ); - }); - - it('Should detect whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-before-closing-brace'], - 'a { top:0 } b{color:tomato;}', - { 'space-before-closing-brace': ' ' } - ); - }); - - it('Should detect whitespace (mix with block indent)', function() { - this.shouldDetect( - ['space-before-closing-brace', 'block-indent'], - 'a {\n top:0\n }\nb{\n color:tomato;\n }', - { 'block-indent': ' ', 'space-before-closing-brace': '\n ' } - ); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-before-closing-brace/test-2.expected.css b/node_modules/csscomb/test/options/space-before-closing-brace/test-2.expected.css deleted file mode 100644 index 86ba267..0000000 --- a/node_modules/csscomb/test/options/space-before-closing-brace/test-2.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a{top: 0 } -a {top: 0 } - -@media print{a{top: 0 } } -@media print { a { top: 0 } } diff --git a/node_modules/csscomb/test/options/space-before-closing-brace/test-3.expected.css b/node_modules/csscomb/test/options/space-before-closing-brace/test-3.expected.css deleted file mode 100644 index 9868eaa..0000000 --- a/node_modules/csscomb/test/options/space-before-closing-brace/test-3.expected.css +++ /dev/null @@ -1,11 +0,0 @@ -a{top: 0 - } -a {top: 0 - } - -@media print{a{top: 0 - } - } -@media print { a { top: 0 - } - } diff --git a/node_modules/csscomb/test/options/space-before-closing-brace/test.css b/node_modules/csscomb/test/options/space-before-closing-brace/test.css deleted file mode 100644 index 2c0a59c..0000000 --- a/node_modules/csscomb/test/options/space-before-closing-brace/test.css +++ /dev/null @@ -1,5 +0,0 @@ -a{top: 0} -a {top: 0 } - -@media print{a{top: 0}} -@media print { a { top: 0 } } diff --git a/node_modules/csscomb/test/options/space-before-closing-brace/test.expected.css b/node_modules/csscomb/test/options/space-before-closing-brace/test.expected.css deleted file mode 100644 index 9a2f633..0000000 --- a/node_modules/csscomb/test/options/space-before-closing-brace/test.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a{top: 0} -a {top: 0} - -@media print{a{top: 0}} -@media print { a { top: 0}} diff --git a/node_modules/csscomb/test/options/space-before-colon-sass.js b/node_modules/csscomb/test/options/space-before-colon-sass.js deleted file mode 100644 index ede13e3..0000000 --- a/node_modules/csscomb/test/options/space-before-colon-sass.js +++ /dev/null @@ -1,16 +0,0 @@ -describe('options/space-before-colon-sass:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Should correct space', function() { - this.comb.configure({ 'space-before-colon': 1 }); - this.shouldBeEqual('test.sass', 'test.expected.sass'); - }); - - it('Should not correct space', function() { - this.comb.configure({ 'space-before-colon': 1 }); - this.shouldBeEqual('test2.sass'); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-before-colon-sass/test.expected.sass b/node_modules/csscomb/test/options/space-before-colon-sass/test.expected.sass deleted file mode 100644 index a61746f..0000000 --- a/node_modules/csscomb/test/options/space-before-colon-sass/test.expected.sass +++ /dev/null @@ -1,3 +0,0 @@ -a - color : tomato - top : 0 diff --git a/node_modules/csscomb/test/options/space-before-colon-sass/test.sass b/node_modules/csscomb/test/options/space-before-colon-sass/test.sass deleted file mode 100644 index f38512b..0000000 --- a/node_modules/csscomb/test/options/space-before-colon-sass/test.sass +++ /dev/null @@ -1,3 +0,0 @@ -a - color: tomato - top: 0 diff --git a/node_modules/csscomb/test/options/space-before-colon-sass/test2.sass b/node_modules/csscomb/test/options/space-before-colon-sass/test2.sass deleted file mode 100644 index 3a5df0b..0000000 --- a/node_modules/csscomb/test/options/space-before-colon-sass/test2.sass +++ /dev/null @@ -1,3 +0,0 @@ -a - :color tomato - :top 0 diff --git a/node_modules/csscomb/test/options/space-before-colon.js b/node_modules/csscomb/test/options/space-before-colon.js deleted file mode 100644 index 1b9d7f8..0000000 --- a/node_modules/csscomb/test/options/space-before-colon.js +++ /dev/null @@ -1,68 +0,0 @@ -describe('options/space-before-colon:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-before-colon': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-before-colon': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-before-colon': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space before colon', function() { - this.comb.configure({ 'space-before-colon': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space before colon', function() { - this.comb.configure({ 'space-before-colon': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space before colon', function() { - this.comb.configure({ 'space-before-colon': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespaces', function() { - this.shouldDetect( - ['space-before-colon'], - 'a { color:red }', - { 'space-before-colon': '' } - ); - }); - - it('Should detect no space from two variants', function() { - this.shouldDetect( - ['space-before-colon'], - 'a { color: red; color :red }', - { 'space-before-colon': '' } - ); - }); - - it('Should detect no whitespaces along three variants', function() { - this.shouldDetect( - ['space-before-colon'], - 'a { color: red; background :red } b { width:10px }', - { 'space-before-colon': '' } - ); - }); - - it('Should detect space', function() { - this.shouldDetect( - ['space-before-colon'], - 'a { color : red; background :red } b { width:10px }', - { 'space-before-colon': ' ' } - ); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-before-colon/test-2.expected.css b/node_modules/csscomb/test/options/space-before-colon/test-2.expected.css deleted file mode 100644 index 8491cff..0000000 --- a/node_modules/csscomb/test/options/space-before-colon/test-2.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a { color : red } -a{color :red} -a {color : red} -a {color : /* foo */ red } -a {color /* bar */ : red } diff --git a/node_modules/csscomb/test/options/space-before-colon/test-3.expected.css b/node_modules/csscomb/test/options/space-before-colon/test-3.expected.css deleted file mode 100644 index 2d951a7..0000000 --- a/node_modules/csscomb/test/options/space-before-colon/test-3.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -a { color - : red } -a{color - :red} -a {color - : red} -a {color - : /* foo */ red } -a {color /* bar */ - : red } diff --git a/node_modules/csscomb/test/options/space-before-colon/test.css b/node_modules/csscomb/test/options/space-before-colon/test.css deleted file mode 100644 index 637656f..0000000 --- a/node_modules/csscomb/test/options/space-before-colon/test.css +++ /dev/null @@ -1,5 +0,0 @@ -a { color: red } -a{color:red} -a {color : red} -a {color : /* foo */ red } -a {color /* bar */ : red } diff --git a/node_modules/csscomb/test/options/space-before-colon/test.expected.css b/node_modules/csscomb/test/options/space-before-colon/test.expected.css deleted file mode 100644 index 9ffc1c4..0000000 --- a/node_modules/csscomb/test/options/space-before-colon/test.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a { color: red } -a{color:red} -a {color: red} -a {color: /* foo */ red } -a {color /* bar */: red } diff --git a/node_modules/csscomb/test/options/space-before-combinator.js b/node_modules/csscomb/test/options/space-before-combinator.js deleted file mode 100644 index a9eccf0..0000000 --- a/node_modules/csscomb/test/options/space-before-combinator.js +++ /dev/null @@ -1,84 +0,0 @@ -describe('options/space-before-combinator:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-before-combinator': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-before-combinator': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-before-combinator': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space before combinator', function() { - this.comb.configure({ 'space-before-combinator': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space before combinator', function() { - this.comb.configure({ 'space-before-combinator': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space before combinator', function() { - this.comb.configure({ 'space-before-combinator': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespaces before combinator', function() { - this.shouldDetect( - ['space-before-combinator'], - 'a+b { color:red }', - { 'space-before-combinator': '' } - ); - }); - - it('Should detect a space before combinator', function() { - this.shouldDetect( - ['space-before-combinator'], - 'a + b { color:red }', - { 'space-before-combinator': ' ' } - ); - }); - - it('Should detect a space before combinator in long selector', function() { - this.shouldDetect( - ['space-before-combinator'], - 'a + b ~ c>d { color:red }', - { 'space-before-combinator': ' ' } - ); - }); - - it('Should detect a space before combinator in long selector, test 2', function() { - this.shouldDetect( - ['space-before-combinator'], - 'a>b + c + d { color:red }', - { 'space-before-combinator': ' ' } - ); - }); - - it('Should detect no whitespaces before combinator in long selector', function() { - this.shouldDetect( - ['space-before-combinator'], - 'a+b ~ c+d { color:red }', - { 'space-before-combinator': '' } - ); - }); - - it('Shouldn’t detect whitespaces before combinator in selector without combinators', function() { - this.shouldDetect( - ['space-before-combinator'], - 'a { color:red }', - {} - ); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-before-combinator/test-2.expected.css b/node_modules/csscomb/test/options/space-before-combinator/test-2.expected.css deleted file mode 100644 index d1320b1..0000000 --- a/node_modules/csscomb/test/options/space-before-combinator/test-2.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -a >b { color: red } -a > b { color: red } -a >b { color: red } -a +b { color: red } -a + b { color: red } -a +b { color: red } -a ~b { color: red } -a ~ b { color: red } -a ~b { color: red } -a ~b + c >d { color: red } diff --git a/node_modules/csscomb/test/options/space-before-combinator/test-3.expected.css b/node_modules/csscomb/test/options/space-before-combinator/test-3.expected.css deleted file mode 100644 index 2a7f317..0000000 --- a/node_modules/csscomb/test/options/space-before-combinator/test-3.expected.css +++ /dev/null @@ -1,22 +0,0 @@ -a - >b { color: red } -a - > b { color: red } -a - >b { color: red } -a - +b { color: red } -a - + b { color: red } -a - +b { color: red } -a - ~b { color: red } -a - ~ b { color: red } -a - ~b { color: red } -a - ~b - + c - >d { color: red } diff --git a/node_modules/csscomb/test/options/space-before-combinator/test.css b/node_modules/csscomb/test/options/space-before-combinator/test.css deleted file mode 100644 index 4ad8d86..0000000 --- a/node_modules/csscomb/test/options/space-before-combinator/test.css +++ /dev/null @@ -1,10 +0,0 @@ -a>b { color: red } -a> b { color: red } -a >b { color: red } -a+b { color: red } -a+ b { color: red } -a +b { color: red } -a~b { color: red } -a~ b { color: red } -a ~b { color: red } -a ~b+ c>d { color: red } diff --git a/node_modules/csscomb/test/options/space-before-combinator/test.expected.css b/node_modules/csscomb/test/options/space-before-combinator/test.expected.css deleted file mode 100644 index 920bd51..0000000 --- a/node_modules/csscomb/test/options/space-before-combinator/test.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -a>b { color: red } -a> b { color: red } -a>b { color: red } -a+b { color: red } -a+ b { color: red } -a+b { color: red } -a~b { color: red } -a~ b { color: red } -a~b { color: red } -a~b+ c>d { color: red } diff --git a/node_modules/csscomb/test/options/space-before-opening-brace-scss.js b/node_modules/csscomb/test/options/space-before-opening-brace-scss.js deleted file mode 100644 index 3e40c5f..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace-scss.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('options/space-before-opening-brace (scss):', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Issue 231', function() { - this.comb.configure({ 'space-before-opening-brace': 1 }); - this.shouldBeEqual('issue-231.scss', 'issue-231.expected.scss'); - }); -}); diff --git a/node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.expected.scss b/node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.expected.scss deleted file mode 100644 index 917eb73..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.expected.scss +++ /dev/null @@ -1,8 +0,0 @@ -li { - float: left; - @include respond-to(mobile) { - float: none; - width: $width; - $width: 100%; - } -} diff --git a/node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.scss b/node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.scss deleted file mode 100644 index f0abf87..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace-scss/issue-231.scss +++ /dev/null @@ -1,8 +0,0 @@ -li{ - float: left; - @include respond-to(mobile){ - float: none; - width: $width; - $width: 100%; - } -} diff --git a/node_modules/csscomb/test/options/space-before-opening-brace.js b/node_modules/csscomb/test/options/space-before-opening-brace.js deleted file mode 100644 index f5eb60d..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace.js +++ /dev/null @@ -1,89 +0,0 @@ -describe('options/space-before-opening-brace:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-before-opening-brace': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-before-opening-brace': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-before-opening-brace': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space before {', function() { - this.comb.configure({ 'space-before-opening-brace': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space before {', function() { - this.comb.configure({ 'space-before-opening-brace': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space before {', function() { - this.comb.configure({ 'space-before-opening-brace': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Issue 232', function() { - this.comb.configure({ 'space-before-opening-brace': 1 }); - this.shouldBeEqual('issue-232.css', 'issue-232.expected.css'); - }); - - it('Should detect no whitespace', function() { - this.shouldDetect( - ['space-before-opening-brace'], - 'a{top:0}', - { 'space-before-opening-brace': '' } - ); - }); - - it('Should detect whitespace', function() { - this.shouldDetect( - ['space-before-opening-brace'], - 'a \n {top:0}', - { 'space-before-opening-brace': ' \n ' } - ); - }); - - it('Should detect no whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-before-opening-brace'], - 'a{top:0} b {left:0}', - { 'space-before-opening-brace': '' } - ); - }); - - it('Should detect whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-before-opening-brace'], - 'a {top:0} b{left:0}', - { 'space-before-opening-brace': ' ' } - ); - }); - - it('Should detect no whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-before-opening-brace'], - 'a {top:0} b{left:0} c{right:0}', - { 'space-before-opening-brace': '' } - ); - }); - - it('Should detect whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-before-opening-brace'], - 'a{top:0} b {left:0} c {right:0}', - { 'space-before-opening-brace': ' ' } - ); - }); -}); - diff --git a/node_modules/csscomb/test/options/space-before-opening-brace/issue-232.css b/node_modules/csscomb/test/options/space-before-opening-brace/issue-232.css deleted file mode 100644 index bc99e74..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace/issue-232.css +++ /dev/null @@ -1,13 +0,0 @@ -@font-face -{ - font-family: Panda; - src: url(panda.ttf); -} - -@media screen and (max-width: 400px) -{ - @-ms-viewport - { - width: 320px; - } -} diff --git a/node_modules/csscomb/test/options/space-before-opening-brace/issue-232.expected.css b/node_modules/csscomb/test/options/space-before-opening-brace/issue-232.expected.css deleted file mode 100644 index 04d76f3..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace/issue-232.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -@font-face { - font-family: Panda; - src: url(panda.ttf); -} - -@media screen and (max-width: 400px) { - @-ms-viewport { - width: 320px; - } -} diff --git a/node_modules/csscomb/test/options/space-before-opening-brace/test-2.expected.css b/node_modules/csscomb/test/options/space-before-opening-brace/test-2.expected.css deleted file mode 100644 index 68a688a..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace/test-2.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a {top: 0} -a {top: 0} - -@media print {a {top: 0}} -@media print { a { top: 0 } } diff --git a/node_modules/csscomb/test/options/space-before-opening-brace/test-3.expected.css b/node_modules/csscomb/test/options/space-before-opening-brace/test-3.expected.css deleted file mode 100644 index 8efc4e9..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace/test-3.expected.css +++ /dev/null @@ -1,11 +0,0 @@ -a - {top: 0} -a - {top: 0} - -@media print - {a - {top: 0}} -@media print - { a - { top: 0 } } diff --git a/node_modules/csscomb/test/options/space-before-opening-brace/test.css b/node_modules/csscomb/test/options/space-before-opening-brace/test.css deleted file mode 100644 index 0f8fadc..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace/test.css +++ /dev/null @@ -1,5 +0,0 @@ -a{top: 0} -a {top: 0} - -@media print{a{top: 0}} -@media print { a { top: 0 } } diff --git a/node_modules/csscomb/test/options/space-before-opening-brace/test.expected.css b/node_modules/csscomb/test/options/space-before-opening-brace/test.expected.css deleted file mode 100644 index 32014dd..0000000 --- a/node_modules/csscomb/test/options/space-before-opening-brace/test.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -a{top: 0} -a{top: 0} - -@media print{a{top: 0}} -@media print{ a{ top: 0 } } diff --git a/node_modules/csscomb/test/options/space-before-selector-delimiter.js b/node_modules/csscomb/test/options/space-before-selector-delimiter.js deleted file mode 100644 index 3770c75..0000000 --- a/node_modules/csscomb/test/options/space-before-selector-delimiter.js +++ /dev/null @@ -1,83 +0,0 @@ -describe('options/space-before-selector-delimiter:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-before-selector-delimiter': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-before-selector-delimiter': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-before-selector-delimiter': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space before selector delimiter', function() { - this.comb.configure({ 'space-before-selector-delimiter': 0 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space before selector delimiter', function() { - this.comb.configure({ 'space-before-selector-delimiter': ' ' }); - this.shouldBeEqual('test.css', 'test-2.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space before selector delimiter', function() { - this.comb.configure({ 'space-before-selector-delimiter': '\n ' }); - this.shouldBeEqual('test.css', 'test-3.expected.css'); - }); - - it('Should detect no whitespace', function() { - this.shouldDetect( - ['space-before-selector-delimiter'], - 'a,b{top:0}', - { 'space-before-selector-delimiter': '' } - ); - }); - - it('Should detect whitespace', function() { - this.shouldDetect( - ['space-before-selector-delimiter'], - 'a \n ,b {top:0}', - { 'space-before-selector-delimiter': ' \n ' } - ); - }); - - it('Should detect no whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-before-selector-delimiter'], - 'a,b{top:0} a ,b{left:0}', - { 'space-before-selector-delimiter': '' } - ); - }); - - it('Should detect whitespace (2 blocks)', function() { - this.shouldDetect( - ['space-before-selector-delimiter'], - 'a ,b {top:0} b,a{left:0}', - { 'space-before-selector-delimiter': ' ' } - ); - }); - - it('Should detect no whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-before-selector-delimiter'], - 'a ,b{top:0} b,c{left:0} c,d{right:0}', - { 'space-before-selector-delimiter': '' } - ); - }); - - it('Should detect whitespace (3 blocks)', function() { - this.shouldDetect( - ['space-before-selector-delimiter'], - 'a,b{top:0} b ,c{left:0} c ,d{right:0}', - { 'space-before-selector-delimiter': ' ' } - ); - }); -}); diff --git a/node_modules/csscomb/test/options/space-before-selector-delimiter/test-2.expected.css b/node_modules/csscomb/test/options/space-before-selector-delimiter/test-2.expected.css deleted file mode 100644 index 90b232e..0000000 --- a/node_modules/csscomb/test/options/space-before-selector-delimiter/test-2.expected.css +++ /dev/null @@ -1,6 +0,0 @@ -a ,b { color: red } -a , b { color: red } -a ,b { color: red } -a , -b { color: red } -a+b ,c>d ,e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-before-selector-delimiter/test-3.expected.css b/node_modules/csscomb/test/options/space-before-selector-delimiter/test-3.expected.css deleted file mode 100644 index 1b454c8..0000000 --- a/node_modules/csscomb/test/options/space-before-selector-delimiter/test-3.expected.css +++ /dev/null @@ -1,12 +0,0 @@ -a - ,b { color: red } -a - , b { color: red } -a - ,b { color: red } -a - , -b { color: red } -a+b - ,c>d - ,e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-before-selector-delimiter/test.css b/node_modules/csscomb/test/options/space-before-selector-delimiter/test.css deleted file mode 100644 index cd8e7d7..0000000 --- a/node_modules/csscomb/test/options/space-before-selector-delimiter/test.css +++ /dev/null @@ -1,6 +0,0 @@ -a,b { color: red } -a, b { color: red } -a ,b { color: red } -a, -b { color: red } -a+b,c>d,e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-before-selector-delimiter/test.expected.css b/node_modules/csscomb/test/options/space-before-selector-delimiter/test.expected.css deleted file mode 100644 index 3c566c5..0000000 --- a/node_modules/csscomb/test/options/space-before-selector-delimiter/test.expected.css +++ /dev/null @@ -1,6 +0,0 @@ -a,b { color: red } -a, b { color: red } -a,b { color: red } -a, -b { color: red } -a+b,c>d,e{ color: red } \ No newline at end of file diff --git a/node_modules/csscomb/test/options/space-between-declarations.js b/node_modules/csscomb/test/options/space-between-declarations.js deleted file mode 100644 index 9f02e54..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations.js +++ /dev/null @@ -1,45 +0,0 @@ -describe('options/space-between-declarations:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Array value => should not change anything', function() { - this.comb.configure({ 'space-between-declarations': ['', ' '] }); - this.shouldBeEqual('test.css'); - }); - - it('Invalid string value => should not change anything', function() { - this.comb.configure({ 'space-between-declarations': ' nani ' }); - this.shouldBeEqual('test.css'); - }); - - it('Float number value => should not change anything', function() { - this.comb.configure({ 'space-between-declarations': 3.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Integer value => should set proper space after declaration', function() { - this.comb.configure({ 'space-between-declarations': 0 }); - this.shouldBeEqual('integer-value.css', 'integer-value.expected.css'); - }); - - it('Valid string value (spaces only) => should set proper space after declaration', function() { - this.comb.configure({ 'space-between-declarations': ' ' }); - this.shouldBeEqual('space-value.css', 'space-value.expected.css'); - }); - - it('Valid string value (spaces and newlines) => should set proper space after declaration', function() { - this.comb.configure({ 'space-between-declarations': '\n ' }); - this.shouldBeEqual('space-newline-value.css', 'space-newline-value.expected.css'); - }); - - it('Should leave comments as is', function() { - this.comb.configure({ 'space-between-declarations': 1 }); - this.shouldBeEqual('comments.css', 'comments.expected.css'); - }); - - it('Issue 239', function() { - this.comb.configure({ 'space-between-declarations': '\n ' }); - this.shouldBeEqual('issue-239.css', 'issue-239.expected.css'); - }); -}); diff --git a/node_modules/csscomb/test/options/space-between-declarations/comments.css b/node_modules/csscomb/test/options/space-between-declarations/comments.css deleted file mode 100644 index 0d8b931..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/comments.css +++ /dev/null @@ -1,8 +0,0 @@ -a { - color: tomato; - /* comment */ - top: 0; /* comment */ - left: 10px; - right: 0; - /* comment */ - } diff --git a/node_modules/csscomb/test/options/space-between-declarations/comments.expected.css b/node_modules/csscomb/test/options/space-between-declarations/comments.expected.css deleted file mode 100644 index 5903c20..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/comments.expected.css +++ /dev/null @@ -1,6 +0,0 @@ -a { - color: tomato; - /* comment */ - top: 0; /* comment */ left: 10px; right: 0; - /* comment */ - } diff --git a/node_modules/csscomb/test/options/space-between-declarations/integer-value.css b/node_modules/csscomb/test/options/space-between-declarations/integer-value.css deleted file mode 100644 index de2c649..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/integer-value.css +++ /dev/null @@ -1,6 +0,0 @@ -a { - color: tomato; - - top: 0; - left: 10px - } diff --git a/node_modules/csscomb/test/options/space-between-declarations/integer-value.expected.css b/node_modules/csscomb/test/options/space-between-declarations/integer-value.expected.css deleted file mode 100644 index 5d12017..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/integer-value.expected.css +++ /dev/null @@ -1,3 +0,0 @@ -a { - color: tomato;top: 0;left: 10px - } diff --git a/node_modules/csscomb/test/options/space-between-declarations/issue-239.css b/node_modules/csscomb/test/options/space-between-declarations/issue-239.css deleted file mode 100644 index ccf6ba7..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/issue-239.css +++ /dev/null @@ -1,2 +0,0 @@ -html{ - color:#444;font-family:proxima-nova;font-size:62.5%;font-weight:300;line-height:1.5;} diff --git a/node_modules/csscomb/test/options/space-between-declarations/issue-239.expected.css b/node_modules/csscomb/test/options/space-between-declarations/issue-239.expected.css deleted file mode 100644 index ab145f7..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/issue-239.expected.css +++ /dev/null @@ -1,6 +0,0 @@ -html{ - color:#444; - font-family:proxima-nova; - font-size:62.5%; - font-weight:300; - line-height:1.5;} diff --git a/node_modules/csscomb/test/options/space-between-declarations/space-newline-value.css b/node_modules/csscomb/test/options/space-between-declarations/space-newline-value.css deleted file mode 100644 index ff86611..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/space-newline-value.css +++ /dev/null @@ -1,4 +0,0 @@ -a { - color: tomato;top: 0; left: 10px; - right: 0; width: 100% \9; -} diff --git a/node_modules/csscomb/test/options/space-between-declarations/space-newline-value.expected.css b/node_modules/csscomb/test/options/space-between-declarations/space-newline-value.expected.css deleted file mode 100644 index 17c237a..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/space-newline-value.expected.css +++ /dev/null @@ -1,7 +0,0 @@ -a { - color: tomato; - top: 0; - left: 10px; - right: 0; - width: 100% \9; -} diff --git a/node_modules/csscomb/test/options/space-between-declarations/space-value.css b/node_modules/csscomb/test/options/space-between-declarations/space-value.css deleted file mode 100644 index de2c649..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/space-value.css +++ /dev/null @@ -1,6 +0,0 @@ -a { - color: tomato; - - top: 0; - left: 10px - } diff --git a/node_modules/csscomb/test/options/space-between-declarations/space-value.expected.css b/node_modules/csscomb/test/options/space-between-declarations/space-value.expected.css deleted file mode 100644 index 6795d9c..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/space-value.expected.css +++ /dev/null @@ -1,3 +0,0 @@ -a { - color: tomato; top: 0; left: 10px - } diff --git a/node_modules/csscomb/test/options/space-between-declarations/test.css b/node_modules/csscomb/test/options/space-between-declarations/test.css deleted file mode 100644 index 7a75e51..0000000 --- a/node_modules/csscomb/test/options/space-between-declarations/test.css +++ /dev/null @@ -1,2 +0,0 @@ -a { - animal: panda;color: tomato; top: 0; } diff --git a/node_modules/csscomb/test/options/strip-spaces.js b/node_modules/csscomb/test/options/strip-spaces.js deleted file mode 100644 index b8f19b3..0000000 --- a/node_modules/csscomb/test/options/strip-spaces.js +++ /dev/null @@ -1,113 +0,0 @@ -var assert = require('assert'); - -describe('options/strip-spaces', function() { - it('Invalid value should not trim trailing spaces', function() { - this.comb.configure({ 'strip-spaces': 'foobar' }); - assert.equal( - this.comb.processString('a { color: red } \n'), - 'a { color: red } \n' - ); - }); - it('Boolean true value should trim all trailing spaces', function() { - this.comb.configure({ 'strip-spaces': true }); - assert.equal( - this.comb.processString( - 'a { color: red } \n' + - 'a{color:red}\t /* foobar */\t \n' + - 'a {color:red} \n \n' - ), - 'a { color: red }\n' + - 'a{color:red}\t /* foobar */\n' + - 'a {color:red}\n' - ); - }); - it('Boolean true value should trim trailing spaces at eof', function() { - this.comb.configure({ 'strip-spaces': true }); - assert.equal( - this.comb.processString( - 'a {color:red} ' - ), - 'a {color:red}' - ); - }); - - it('Should detect strip-spaces option set to `true`', function() { - this.shouldDetect( - ['strip-spaces'], - 'a { color: red }', - { - 'strip-spaces': true - } - ); - }); - - it('Should detect strip-spaces option set to `false`', function() { - this.shouldDetect( - ['strip-spaces'], - 'a { color: red } ', - { - 'strip-spaces': false - } - ); - }); - - it('Should detect strip-spaces option set to `true` with newline', function() { - this.shouldDetect( - ['strip-spaces'], - 'a { color: red }\nb { color: blue }', - { - 'strip-spaces': true - } - ); - }); - - it('Should detect strip-spaces option set to `false` with newline', function() { - this.shouldDetect( - ['strip-spaces'], - 'a { color: red } \nb { color: blue }', - { - 'strip-spaces': false - } - ); - }); - - it('Should detect strip-spaces option set to `true` inside a value', function() { - this.shouldDetect( - ['strip-spaces'], - 'a {\n color:\n red }', - { - 'strip-spaces': true - } - ); - }); - - it('Should detect strip-spaces option set to `false` inside a value', function() { - this.shouldDetect( - ['strip-spaces'], - 'a {\n color: \n red }', - { - 'strip-spaces': false - } - ); - }); - - it('Should detect strip-spaces option set to `true` if the only trailing space is the last newline', function() { - this.shouldDetect( - ['strip-spaces'], - 'a { color: red }\n', - { - 'strip-spaces': true - } - ); - }); - - it('Should detect strip-spaces option set to `false` if there is more than one newline at the end', function() { - this.shouldDetect( - ['strip-spaces'], - 'a { color: red }\n\n', - { - 'strip-spaces': false - } - ); - }); -}); diff --git a/node_modules/csscomb/test/options/tab-size.js b/node_modules/csscomb/test/options/tab-size.js deleted file mode 100644 index 59bb9f0..0000000 --- a/node_modules/csscomb/test/options/tab-size.js +++ /dev/null @@ -1,20 +0,0 @@ -describe('options/tab-size:', function() { - beforeEach(function() { - this.filename = __filename; - }); - - it('Test 1: String value => should not change anything', function() { - this.comb.configure({ 'tab-size': ' ' }); - this.shouldBeEqual('test.css'); - }); - - it('Test 2: Float value => should not change anything', function() { - this.comb.configure({ 'tab-size': 4.5 }); - this.shouldBeEqual('test.css'); - }); - - it('Test 3: Integer value => should replace tabs with proper number of spaces', function() { - this.comb.configure({ 'tab-size': 4 }); - this.shouldBeEqual('test.css', 'test.expected.css'); - }); -}); diff --git a/node_modules/csscomb/test/options/tab-size/test.css b/node_modules/csscomb/test/options/tab-size/test.css deleted file mode 100644 index a5ff8ef..0000000 --- a/node_modules/csscomb/test/options/tab-size/test.css +++ /dev/null @@ -1,4 +0,0 @@ -a { - color: tomato; - top: 0; - } diff --git a/node_modules/csscomb/test/options/tab-size/test.expected.css b/node_modules/csscomb/test/options/tab-size/test.expected.css deleted file mode 100644 index 248453a..0000000 --- a/node_modules/csscomb/test/options/tab-size/test.expected.css +++ /dev/null @@ -1,4 +0,0 @@ -a { - color: tomato; - top: 0; - } diff --git a/node_modules/csscomb/test/options/unitless-zero.js b/node_modules/csscomb/test/options/unitless-zero.js deleted file mode 100644 index f47be91..0000000 --- a/node_modules/csscomb/test/options/unitless-zero.js +++ /dev/null @@ -1,103 +0,0 @@ -var assert = require('assert'); - -describe('options/unitless-zero', function() { - it('Should remove units in zero-valued dimensions', function() { - this.comb.configure({ 'unitless-zero': true }); - assert.equal( - this.comb.processString( - 'div { margin: 0em; padding: 0px }' - ), - 'div { margin: 0; padding: 0 }' - ); - assert.equal( - this.comb.processString( - 'div { margin: 0% }' - ), - 'div { margin: 0 }' - ); - }); - - it('Should remove units in zero-valued media-query params', function() { - this.comb.configure({ 'unitless-zero': true }); - assert.equal( - this.comb.processString('@media all and (min-width: 0px) { div { margin: 0em; padding: 0px } }'), - '@media all and (min-width: 0) { div { margin: 0; padding: 0 } }' - ); - }); - - it('Should not remove units (degs) in rotate property', function() { - this.comb.configure({ 'unitless-zero': true }); - assert.equal( - this.comb.processString( - 'div { -webkit-transform: rotate(0deg); }' - ), - 'div { -webkit-transform: rotate(0deg); }' - ); - }); - - it('Should detect unitless zero option', function() { - this.shouldDetect( - ['unitless-zero'], - 'a { width: 0 }', - { - 'unitless-zero': true - } - ); - }); - - it('Should detect zero with unit', function() { - this.shouldDetect( - ['unitless-zero'], - 'a { width: 0px }', - { - 'unitless-zero': false - } - ); - }); - - it('Should detect unitless zero option with multiple values', function() { - this.shouldDetect( - ['unitless-zero'], - 'a { padding: 0px 0 0 }', - { - 'unitless-zero': true - } - ); - }); - - it('Should detect zero with unit and multiple values', function() { - this.shouldDetect( - ['unitless-zero'], - 'a { padding: 0px 0 0em }', - { - 'unitless-zero': false - } - ); - }); - - it('Shouldn’t detect unitless zero option if there is no unit', function() { - this.shouldDetect( - ['unitless-zero'], - 'a { color: red }', - {} - ); - }); - - it('Shouldn’t detect unitless zero option if there is `deg` unit', function() { - this.shouldDetect( - ['unitless-zero'], - 'a { transform: rotate(0deg) }', - {} - ); - }); - - it('Should detect unitless zero option with percents', function() { - this.shouldDetect( - ['unitless-zero'], - 'a { padding: 0% 0 0 }', - { - 'unitless-zero': true - } - ); - }); -}); diff --git a/node_modules/csscomb/test/options/vendor-prefix-align-sass.js b/node_modules/csscomb/test/options/vendor-prefix-align-sass.js deleted file mode 100644 index 4e3a746..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align-sass.js +++ /dev/null @@ -1,14 +0,0 @@ -describe('options/vendor-prefix-align', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({ 'vendor-prefix-align': true }); - }); - - it('Should align prexied values', function() { - this.shouldBeEqual('value.sass', 'value.expected.sass'); - }); - - it('Should not align prefixed property names', function() { - this.shouldBeEqual('property.sass'); - }); -}); diff --git a/node_modules/csscomb/test/options/vendor-prefix-align-sass/property.sass b/node_modules/csscomb/test/options/vendor-prefix-align-sass/property.sass deleted file mode 100644 index b488c7a..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align-sass/property.sass +++ /dev/null @@ -1,4 +0,0 @@ -a - -webkit-color: panda - color: panda - -moz-color: panda diff --git a/node_modules/csscomb/test/options/vendor-prefix-align-sass/value.expected.sass b/node_modules/csscomb/test/options/vendor-prefix-align-sass/value.expected.sass deleted file mode 100644 index 4df59da..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align-sass/value.expected.sass +++ /dev/null @@ -1,4 +0,0 @@ -a - color: panda - color: -webkit-panda - color: -moz-panda diff --git a/node_modules/csscomb/test/options/vendor-prefix-align-sass/value.sass b/node_modules/csscomb/test/options/vendor-prefix-align-sass/value.sass deleted file mode 100644 index e3cff56..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align-sass/value.sass +++ /dev/null @@ -1,4 +0,0 @@ -a - color: panda - color: -webkit-panda - color: -moz-panda diff --git a/node_modules/csscomb/test/options/vendor-prefix-align.js b/node_modules/csscomb/test/options/vendor-prefix-align.js deleted file mode 100644 index 353b3e1..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align.js +++ /dev/null @@ -1,156 +0,0 @@ -describe('options/vendor-prefix-align', function() { - beforeEach(function() { - this.filename = __filename; - this.comb.configure({ 'vendor-prefix-align': true }); - }); - - it('Should correctly work when there is comment before property name', function() { - this.shouldBeEqual('with-comment-property.css', 'with-comment-property.expected.css'); - }); - - it('Should correctly work when there is comment before property name. Test 2', function() { - this.shouldBeEqual('with-comment-property-2.css', 'with-comment-property-2.expected.css'); - }); - - it('Should correctly work when there is comment before property name. Test 3', function() { - this.shouldBeEqual('multiline-comments.css', 'multiline-comments.expected.css'); - }); - - it('Should correctly align prefixes in properties', function() { - this.shouldBeEqual('property-align.css', 'property-align.expected.css'); - }); - - it('Should correctly align prefixes in values', function() { - this.shouldBeEqual('value-align.css', 'value-align.expected.css'); - }); - - it('Should not touch already align prefixes', function() { - this.shouldBeEqual('already-aligned.css', 'already-aligned.expected.css'); - }); - - it('Should correctly align prefixes in properties and values at the same time', function() { - this.shouldBeEqual('both.css', 'both.expected.css'); - }); - - it('Should correctly work when value and property names are the same', function() { - this.shouldBeEqual('same-name.css', 'same-name.expected.css'); - }); - - it('Should correctly work when there is no whitespace after colon', function() { - this.shouldBeEqual('without-space.css', 'without-space.expected.css'); - }); - - it('Should correctly work when there is comment after colon', function() { - this.shouldBeEqual('with-comment.css', 'with-comment.expected.css'); - }); - - it('Should not do anything with oneliners', function() { - this.shouldBeEqual('one-line.css', 'one-line.expected.css'); - }); - - it('Should not do anything with oneliners. Test 2', function() { - this.shouldBeEqual('one-line-2.css', 'one-line-2.expected.css'); - }); - - it('Should always correctly align prefixes', function() { - this.shouldBeEqual('complex.css', 'complex.expected.css'); - }); - - it('Issue 193: should handle declarations without preceding spaces', function() { - this.shouldBeEqual('issue-193.css', 'issue-193.expected.css'); - }); - - it('Issue 241: should not break tabs', function() { - this.comb.configure({ - 'block-indent': '\t', - 'vendor-prefix-align': true - }); - this.shouldBeEqual('issue-241.css', 'issue-241.expected.css'); - }); - - it('Shouldn not detect anything if there are no prefixed groups', function() { - this.shouldDetect( - ['vendor-prefix-align'], - 'a{ color: red }a{ -webkit-transform: translateZ(0) }', - {} - ); - }); - - it('Shouldn detect vendor-prefix-align as false in properties', function() { - this.shouldDetect( - ['vendor-prefix-align'], - this.readFile('property-align.css'), - { - 'vendor-prefix-align': false - } - ); - }); - - it('Shouldn detect vendor-prefix-align as true in properties', function() { - this.shouldDetect( - ['vendor-prefix-align'], - this.readFile('property-align.expected.css'), - { - 'vendor-prefix-align': true - } - ); - }); - - it('Shouldn detect vendor-prefix-align as false in values', function() { - this.shouldDetect( - ['vendor-prefix-align'], - this.readFile('value-align.css'), - { - 'vendor-prefix-align': false - } - ); - }); - - it('Shouldn detect vendor-prefix-align as true in values', function() { - this.shouldDetect( - ['vendor-prefix-align'], - this.readFile('value-align.expected.css'), - { - 'vendor-prefix-align': true - } - ); - }); - - it('Shouldn detect vendor-prefix-align as true, test 1', function() { - this.shouldDetect( - ['vendor-prefix-align'], - this.readFile('already-aligned.css'), - { - 'vendor-prefix-align': true - } - ); - }); - - it('Shouldn detect vendor-prefix-align as true, test 2', function() { - this.shouldDetect( - ['vendor-prefix-align'], - this.readFile('complex.expected.css'), - { - 'vendor-prefix-align': true - } - ); - }); - - it('Shouldn detect vendor-prefix-align as false', function() { - this.shouldDetect( - ['vendor-prefix-align'], - this.readFile('complex.css'), - { - 'vendor-prefix-align': false - } - ); - }); - - it('Should not detect anything in simple case', function() { - this.shouldDetect( - ['vendor-prefix-align'], - 'a{border:0;}', - {} - ); - }); -}); diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.css b/node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.css deleted file mode 100644 index 35b7eee..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.css +++ /dev/null @@ -1,11 +0,0 @@ -.radio-button_theme_normal .radio-button__radio:before -{ - background: rgba(0,0,0,.4); - background: -webkit-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: -moz-linear-gradient(top, rgba(0,0,0,.2) 0, rgba(0,0,0,.4) 100%); - background: -o-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: linear-gradient(to bottom, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - - -moz-box-shadow: 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 1px 0 rgba(0,0,0,.07); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.expected.css deleted file mode 100644 index 35b7eee..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/already-aligned.expected.css +++ /dev/null @@ -1,11 +0,0 @@ -.radio-button_theme_normal .radio-button__radio:before -{ - background: rgba(0,0,0,.4); - background: -webkit-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: -moz-linear-gradient(top, rgba(0,0,0,.2) 0, rgba(0,0,0,.4) 100%); - background: -o-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: linear-gradient(to bottom, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - - -moz-box-shadow: 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 1px 0 rgba(0,0,0,.07); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/both.css b/node_modules/csscomb/test/options/vendor-prefix-align/both.css deleted file mode 100644 index 3791d29..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/both.css +++ /dev/null @@ -1,5 +0,0 @@ -.serp-block__head_animation_yes -{ - -webkit-transition: -webkit-transform 150ms linear; - transition: transform 150ms linear; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/both.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/both.expected.css deleted file mode 100644 index f58aa02..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/both.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -.serp-block__head_animation_yes -{ - -webkit-transition: -webkit-transform 150ms linear; - transition: transform 150ms linear; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/complex.css b/node_modules/csscomb/test/options/vendor-prefix-align/complex.css deleted file mode 100644 index 3f896df..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/complex.css +++ /dev/null @@ -1,30 +0,0 @@ -@media all and (min-width:0) -{ - .radio-button_theme_normal .radio-button__radio:before - { - background: rgba(0,0,0,.4); - background: -webkit-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: -moz-linear-gradient(top, rgba(0,0,0,.2) 0, rgba(0,0,0,.4) 100%); - background: -o-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: linear-gradient(to bottom, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - -moz-box-shadow: 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 1px 0 rgba(0,0,0,.07); - } - - /* :after — фон */ - .radio-button_theme_normal .radio-button__radio:after - { - background: #fff; - background: -webkit-linear-gradient(top, #fff 0,#eee 100%); - background: -moz-linear-gradient(top, #fff 0, #eee 100%); - background: -o-linear-gradient(top, #fff 0,#eee 100%); - background: linear-gradient(to bottom, #fff 0,#eee 100%); - } - - /* _focused_yes */ - .radio-button_theme_normal .radio-button__radio_focused_yes:before - { - -moz-box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0 1px 0 rgba(0,0,0,.07); - } -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/complex.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/complex.expected.css deleted file mode 100644 index 688ecd6..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/complex.expected.css +++ /dev/null @@ -1,30 +0,0 @@ -@media all and (min-width:0) -{ - .radio-button_theme_normal .radio-button__radio:before - { - background: rgba(0,0,0,.4); - background: -webkit-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: -moz-linear-gradient(top, rgba(0,0,0,.2) 0, rgba(0,0,0,.4) 100%); - background: -o-linear-gradient(top, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - background: linear-gradient(to bottom, rgba(0,0,0,.2) 0,rgba(0,0,0,.4) 100%); - -moz-box-shadow: 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 1px 0 rgba(0,0,0,.07); - } - - /* :after — фон */ - .radio-button_theme_normal .radio-button__radio:after - { - background: #fff; - background: -webkit-linear-gradient(top, #fff 0,#eee 100%); - background: -moz-linear-gradient(top, #fff 0, #eee 100%); - background: -o-linear-gradient(top, #fff 0,#eee 100%); - background: linear-gradient(to bottom, #fff 0,#eee 100%); - } - - /* _focused_yes */ - .radio-button_theme_normal .radio-button__radio_focused_yes:before - { - -moz-box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0 1px 0 rgba(0,0,0,.07); - box-shadow: 0 0 6px 2px rgba(255,204,0,.7), 0 1px 0 rgba(0,0,0,.07); - } -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/issue-193.css b/node_modules/csscomb/test/options/vendor-prefix-align/issue-193.css deleted file mode 100644 index e0047dd..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/issue-193.css +++ /dev/null @@ -1,2 +0,0 @@ -li {color: #7799c8; - font-size: 10px;} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/issue-193.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/issue-193.expected.css deleted file mode 100644 index e0047dd..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/issue-193.expected.css +++ /dev/null @@ -1,2 +0,0 @@ -li {color: #7799c8; - font-size: 10px;} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/issue-241.css b/node_modules/csscomb/test/options/vendor-prefix-align/issue-241.css deleted file mode 100644 index e562a61..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/issue-241.css +++ /dev/null @@ -1,6 +0,0 @@ -* -{ - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/issue-241.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/issue-241.expected.css deleted file mode 100644 index bbc0e34..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/issue-241.expected.css +++ /dev/null @@ -1,6 +0,0 @@ -* -{ - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - } diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.css b/node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.css deleted file mode 100644 index 33c66c5..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.css +++ /dev/null @@ -1,9 +0,0 @@ -a -{ - -webkit-color: panda; - /* - * /\_/\ - * ( o.o ) - * > ^ < - */ -moz-color: panda; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.expected.css deleted file mode 100644 index 6bc01b3..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/multiline-comments.expected.css +++ /dev/null @@ -1,9 +0,0 @@ -a -{ - -webkit-color: panda; - /* - * /\_/\ - * ( o.o ) - * > ^ < - */ -moz-color: panda; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.css b/node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.css deleted file mode 100644 index 6050079..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.css +++ /dev/null @@ -1 +0,0 @@ -a{top:0} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.expected.css deleted file mode 100644 index 6050079..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/one-line-2.expected.css +++ /dev/null @@ -1 +0,0 @@ -a{top:0} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/one-line.css b/node_modules/csscomb/test/options/vendor-prefix-align/one-line.css deleted file mode 100644 index 3426596..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/one-line.css +++ /dev/null @@ -1 +0,0 @@ -a{ -webkit-color:tomato; -moz-color:tomato; top:0 } diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/one-line.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/one-line.expected.css deleted file mode 100644 index 3426596..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/one-line.expected.css +++ /dev/null @@ -1 +0,0 @@ -a{ -webkit-color:tomato; -moz-color:tomato; top:0 } diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/property-align.css b/node_modules/csscomb/test/options/vendor-prefix-align/property-align.css deleted file mode 100644 index b19d6b7..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/property-align.css +++ /dev/null @@ -1,8 +0,0 @@ -a -{ - color: #fff; - - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/property-align.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/property-align.expected.css deleted file mode 100644 index 2580857..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/property-align.expected.css +++ /dev/null @@ -1,8 +0,0 @@ -a -{ - color: #fff; - - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/same-name.css b/node_modules/csscomb/test/options/vendor-prefix-align/same-name.css deleted file mode 100644 index dbdc5c4..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/same-name.css +++ /dev/null @@ -1,7 +0,0 @@ -.test -{ - -webkit-transition: -webkit-transform .6s; - transition: transform .6s; - -webkit-transform: scale(.6, .6); - transform: scale(.6, .6); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/same-name.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/same-name.expected.css deleted file mode 100644 index 9059807..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/same-name.expected.css +++ /dev/null @@ -1,7 +0,0 @@ -.test -{ - -webkit-transition: -webkit-transform .6s; - transition: transform .6s; - -webkit-transform: scale(.6, .6); - transform: scale(.6, .6); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/value-align.css b/node_modules/csscomb/test/options/vendor-prefix-align/value-align.css deleted file mode 100644 index f15a362..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/value-align.css +++ /dev/null @@ -1,10 +0,0 @@ -b -{ - color: #fff; - - background: -webkit-linear-gradient(linear, left top, right top, color-stop(0,rgba(255,255,255,0)), color-stop(20%, #fff)); - background: -moz-linear-gradient(left, rgba(255,255,255,0) 0, #fff 20%); - background: -o-linear-gradient(left, rgba(255,255,255,0) 0, #fff 20%); - background: -ms-linear-gradient(left, rgba(255,255,255,0) 0, #fff 20%); - background: linear-gradient(to right, rgba(255,255,255,0) 0, #fff 20%); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/value-align.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/value-align.expected.css deleted file mode 100644 index 60aba2e..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/value-align.expected.css +++ /dev/null @@ -1,10 +0,0 @@ -b -{ - color: #fff; - - background: -webkit-linear-gradient(linear, left top, right top, color-stop(0,rgba(255,255,255,0)), color-stop(20%, #fff)); - background: -moz-linear-gradient(left, rgba(255,255,255,0) 0, #fff 20%); - background: -o-linear-gradient(left, rgba(255,255,255,0) 0, #fff 20%); - background: -ms-linear-gradient(left, rgba(255,255,255,0) 0, #fff 20%); - background: linear-gradient(to right, rgba(255,255,255,0) 0, #fff 20%); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.css b/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.css deleted file mode 100644 index 113d334..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.css +++ /dev/null @@ -1,3 +0,0 @@ -a -{ - top: 0;/* ololo */margin: 0;} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.expected.css deleted file mode 100644 index 113d334..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property-2.expected.css +++ /dev/null @@ -1,3 +0,0 @@ -a -{ - top: 0;/* ololo */margin: 0;} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.css b/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.css deleted file mode 100644 index 9e3bea3..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.css +++ /dev/null @@ -1,5 +0,0 @@ -body -{ - -webkit-transition: transform 150ms linear; - /* comment */ transition: transform 150ms linear; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.expected.css deleted file mode 100644 index b65b210..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment-property.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -body -{ - -webkit-transition: transform 150ms linear; - /* comment */ transition: transform 150ms linear; -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment.css b/node_modules/csscomb/test/options/vendor-prefix-align/with-comment.css deleted file mode 100644 index f792a8c..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment.css +++ /dev/null @@ -1,5 +0,0 @@ -body -{ - background: -webkit-linear-gradient(nani); - background: /* comment */ -moz-linear-gradient(nani); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/with-comment.expected.css deleted file mode 100644 index 9d5d161..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/with-comment.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -body -{ - background: -webkit-linear-gradient(nani); - background: /* comment */ -moz-linear-gradient(nani); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/without-space.css b/node_modules/csscomb/test/options/vendor-prefix-align/without-space.css deleted file mode 100644 index 09bd955..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/without-space.css +++ /dev/null @@ -1,5 +0,0 @@ -body -{ - background:-webkit-linear-gradient(nani); - background:-moz-linear-gradient(nani); -} diff --git a/node_modules/csscomb/test/options/vendor-prefix-align/without-space.expected.css b/node_modules/csscomb/test/options/vendor-prefix-align/without-space.expected.css deleted file mode 100644 index 1be5389..0000000 --- a/node_modules/csscomb/test/options/vendor-prefix-align/without-space.expected.css +++ /dev/null @@ -1,5 +0,0 @@ -body -{ - background:-webkit-linear-gradient(nani); - background: -moz-linear-gradient(nani); -} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/.npmignore b/node_modules/glob/.npmignore similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/.npmignore rename to node_modules/glob/.npmignore diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/.travis.yml b/node_modules/glob/.travis.yml similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/.travis.yml rename to node_modules/glob/.travis.yml diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/LICENSE b/node_modules/glob/LICENSE similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/LICENSE rename to node_modules/glob/LICENSE diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/README.md b/node_modules/glob/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/README.md rename to node_modules/glob/README.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/examples/g.js b/node_modules/glob/examples/g.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/examples/g.js rename to node_modules/glob/examples/g.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/examples/usr-local.js b/node_modules/glob/examples/usr-local.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/examples/usr-local.js rename to node_modules/glob/examples/usr-local.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/glob.js b/node_modules/glob/glob.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/glob.js rename to node_modules/glob/glob.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/package.json b/node_modules/glob/package.json similarity index 56% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/package.json rename to node_modules/glob/package.json index dc84d92..4458c97 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/package.json +++ b/node_modules/glob/package.json @@ -1,55 +1,81 @@ { + "_args": [ + [ + "glob@3.2.8", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/vow-fs" + ] + ], + "_from": "glob@3.2.8", + "_id": "glob@3.2.8", + "_inCache": true, + "_installable": true, + "_location": "/glob", + "_npmUser": { + "email": "i@izs.me", + "name": "isaacs" + }, + "_npmVersion": "1.3.23", + "_phantomChildren": {}, + "_requested": { + "name": "glob", + "raw": "glob@3.2.8", + "rawSpec": "3.2.8", + "scope": null, + "spec": "3.2.8", + "type": "version" + }, + "_requiredBy": [ + "/vow-fs" + ], + "_resolved": "https://registry.npmjs.org/glob/-/glob-3.2.8.tgz", + "_shasum": "5506f4311721bcc618c7d8dba144188750307073", + "_shrinkwrap": null, + "_spec": "glob@3.2.8", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/vow-fs", "author": { - "name": "Isaac Z. Schlueter", "email": "i@izs.me", + "name": "Isaac Z. Schlueter", "url": "http://blog.izs.me/" }, - "name": "glob", - "description": "a little globber", - "version": "3.2.8", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-glob.git" - }, - "main": "glob.js", - "engines": { - "node": "*" + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" }, "dependencies": { - "minimatch": "~0.2.11", - "inherits": "2" + "inherits": "2", + "minimatch": "~0.2.11" }, + "description": "a little globber", "devDependencies": { - "tap": "~0.4.0", "mkdirp": "0", - "rimraf": "1" - }, - "scripts": { - "test": "tap test/*.js" + "rimraf": "1", + "tap": "~0.4.0" }, - "license": "BSD", - "bugs": { - "url": "https://github.com/isaacs/node-glob/issues" - }, - "homepage": "https://github.com/isaacs/node-glob", - "_id": "glob@3.2.8", + "directories": {}, "dist": { "shasum": "5506f4311721bcc618c7d8dba144188750307073", "tarball": "http://registry.npmjs.org/glob/-/glob-3.2.8.tgz" }, - "_from": "glob@3.2.8", - "_npmVersion": "1.3.23", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "engines": { + "node": "*" }, + "homepage": "https://github.com/isaacs/node-glob", + "license": "BSD", + "main": "glob.js", "maintainers": [ { "name": "isaacs", "email": "i@izs.me" } ], - "directories": {}, - "_shasum": "5506f4311721bcc618c7d8dba144188750307073", - "_resolved": "https://registry.npmjs.org/glob/-/glob-3.2.8.tgz" + "name": "glob", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "3.2.8" } diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/00-setup.js b/node_modules/glob/test/00-setup.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/00-setup.js rename to node_modules/glob/test/00-setup.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/bash-comparison.js b/node_modules/glob/test/bash-comparison.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/bash-comparison.js rename to node_modules/glob/test/bash-comparison.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/bash-results.json b/node_modules/glob/test/bash-results.json similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/bash-results.json rename to node_modules/glob/test/bash-results.json diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/cwd-test.js b/node_modules/glob/test/cwd-test.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/cwd-test.js rename to node_modules/glob/test/cwd-test.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/globstar-match.js b/node_modules/glob/test/globstar-match.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/globstar-match.js rename to node_modules/glob/test/globstar-match.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/mark.js b/node_modules/glob/test/mark.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/mark.js rename to node_modules/glob/test/mark.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/new-glob-optional-options.js b/node_modules/glob/test/new-glob-optional-options.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/new-glob-optional-options.js rename to node_modules/glob/test/new-glob-optional-options.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/nocase-nomagic.js b/node_modules/glob/test/nocase-nomagic.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/nocase-nomagic.js rename to node_modules/glob/test/nocase-nomagic.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/pause-resume.js b/node_modules/glob/test/pause-resume.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/pause-resume.js rename to node_modules/glob/test/pause-resume.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/root-nomount.js b/node_modules/glob/test/root-nomount.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/root-nomount.js rename to node_modules/glob/test/root-nomount.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/root.js b/node_modules/glob/test/root.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/root.js rename to node_modules/glob/test/root.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/stat.js b/node_modules/glob/test/stat.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/stat.js rename to node_modules/glob/test/stat.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/zz-cleanup.js b/node_modules/glob/test/zz-cleanup.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/test/zz-cleanup.js rename to node_modules/glob/test/zz-cleanup.js diff --git a/node_modules/csscomb/node_modules/gonzales-pe/.npmignore b/node_modules/gonzales-pe/.npmignore similarity index 100% rename from node_modules/csscomb/node_modules/gonzales-pe/.npmignore rename to node_modules/gonzales-pe/.npmignore diff --git a/node_modules/csscomb/.travis.yml b/node_modules/gonzales-pe/.travis.yml similarity index 90% rename from node_modules/csscomb/.travis.yml rename to node_modules/gonzales-pe/.travis.yml index 4a5a560..07abc8b 100644 --- a/node_modules/csscomb/.travis.yml +++ b/node_modules/gonzales-pe/.travis.yml @@ -1,8 +1,9 @@ language: node_js node_js: - - "0.10" - "0.11" + - "0.10" + - "0.8" matrix: allow_failures: diff --git a/node_modules/csscomb/node_modules/gonzales-pe/CHANGELOG.md b/node_modules/gonzales-pe/CHANGELOG.md similarity index 72% rename from node_modules/csscomb/node_modules/gonzales-pe/CHANGELOG.md rename to node_modules/gonzales-pe/CHANGELOG.md index 7945431..c916e4d 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/CHANGELOG.md +++ b/node_modules/gonzales-pe/CHANGELOG.md @@ -1,6 +1,38 @@ Gonzales changelog ================== +xx.xx.201x, Version 3.0.0 +------------------------- + +AST: + - Rename `interpolatedVariable` to `interpolation` + - Rename `functionBody` to `arguments` + - New node type `conditionalStatement` + - Remove unused node types + +Parsing rules: + - Interpolations are ok as arguments, inside nth selector and within identifiers + - Functions are ok as arguments + - Spaces are optional after declDelim + - Check for unary operator in arguments + - Parse operators inside arguments (#16) + - Remove spaces from the end of includes + - Every argument can be escaped string + - Braces around arguments are ok + - Equality and inequality signs are ok as operators + +API: + - srcToAST({src: 'string', syntax: 'css', needInfo: true, rule: 'stylesheet'}) + - astToSrc() + - astToString() + +Tests: + - Add more tests + - Place test files inside rule directory + - Use 'min' reporter instead of 'spec' + - Add Travis config + - Divide log and test scripts + 29.12.2013, Version 2.0.2 ------------------------- diff --git a/node_modules/csscomb/node_modules/gonzales-pe/MIT-LICENSE.txt b/node_modules/gonzales-pe/MIT-LICENSE.txt similarity index 100% rename from node_modules/csscomb/node_modules/gonzales-pe/MIT-LICENSE.txt rename to node_modules/gonzales-pe/MIT-LICENSE.txt diff --git a/node_modules/gonzales-pe/README.md b/node_modules/gonzales-pe/README.md new file mode 100644 index 0000000..0c2e959 --- /dev/null +++ b/node_modules/gonzales-pe/README.md @@ -0,0 +1,227 @@ +## API + +### gonzales.parse(css, options) + +Parse CSS. + +Parameters: + +* `{String} css` +* `{{syntax: String, rule: String}} options` + +Returns: + +* `{Object} ast`. + +Example: +```js + var css = 'a {color: tomato}'; + var ast = gonzales.parse(css); +``` + +Example: +```js + var less = 'a {$color: tomato}'; + var ast = gonzales.parse(less, {syntax: 'less'}); +``` + +Example: +```js + var less = '$color: tomato'; + var ast = gonzales.parse(less, {syntax: 'less', rule: 'declaration'}); +``` + +### gonzales.createNode(options) + +Creates a new node. + +Parameters: + +* `{{type: String, content: String|Array}} options` + +Returns: + +* `{Object} ast` + +Example: +```js + var css = 'a {color: tomato}'; + var ast = gonzales.parse(css); + var node = gonzales.createNode({ type: 'animal', content: 'panda' }); + ast.content.push(node); +``` + +### ast.length + +### ast.toString() + +### ast.toCSS(syntax) + +Converts AST to code. + +Parameters: + +* `{String} syntax` + +Returns: + +* `{String} css` + +Example: +```js + var css = ast.toCSS('css'); + var less = ast.toCSS('less'); +``` +### ast.contains(type) + +Checks whether there is a child node of given type. + +Parameters: + +* `{String} type` + +Returns: + +* `{Boolean}` + +Example: +```js + if (ast.contains('panda')) + doSomething(); +``` + +### ast.first(type) + +Returns the first child node of given type. + +Parameters: + +* `{String=} type` + +Returns: + +* `{Node} node` + +Example: +```js + var node = ast.first(); + node.content = 'panda'; +``` + +Example: +```js + var node = ast.first('commentML'); + node.content = 'panda'; +``` + +### ast.forEach(type, function) + +Calls the function for every child node of given type. + +Parameters: + +* `{String=} type` +* `{Function} function` + +Example: +```js + ast.forEach('commentML', function(node) { + node.content = 'panda'; + }); +``` + +### ast.get(index) + +### ast.insert(index, node) + +### ast.is(type) + +Checks whether the node is of given type. + +Parameters: + +* `{String} type` + +Returns: + +* `{Boolean}` + +Example: +```js + if (ast.is('s')) + ast.content = ''; +``` + +### ast.last(type) + +Returns the last child node of given type. + +Parameters: + +* `{String=} type` + +Returns: + +* `{Node} node` + +Example: +```js + var node = ast.last() + node.content = 'panda'; +``` + +Example: +```js + var node = ast.last('commentML'); + node.content = 'panda'; +``` + +### ast.map(function) + +Calls the function for every node in a tree. Modifies the tree! + +Parameters: + +* `{Function} function` + +Example: +```js + ast.map(function(node) { + if (node.type === 'commentML') node.content = 'panda'; + }); +``` + + +## Test + +To run tests: + + npm test + +This command will build library files from sources and run tests on all files +in syntax directories. + +Every test has 3 files: source stylesheet, expected AST and expected string +compiled back from AST to css. + +If some tests fail, you can find information in test logs: + +- `log/test.log` contains all information from stdout; +- `log/expected.txt` contains only expected text; +- `log/result.txt` contains only result text. + +The last two are made for your convenience: you can use any diff app to see +the defference between them. + +If you want to test one specific string or get a general idea of how Gonzales +works, you can use `test/ast.js` file. +Simply change the first two strings (`css` and `syntax` vars) and run: + + node test/single-test.js + +## Report + +If you find a bug or want to add a feature, welcome to [Issues](https://github.com/tonyganch/gonzales-pe/issues). + +If you are shy but have a question, feel free to [drop me a +line](mailto:tonyganch+gonzales@gmail.com). diff --git a/node_modules/gonzales-pe/TODO.nani b/node_modules/gonzales-pe/TODO.nani new file mode 100644 index 0000000..a5e1b6a --- /dev/null +++ b/node_modules/gonzales-pe/TODO.nani @@ -0,0 +1,26 @@ +Tests: + + Проверить, что все тесты, которые есть в папках, фактически запускаются + - Починить pending тесты + +Fix: + - Fix column/line position + - Replace `content: null` with actual content + - Replace `unary` with `operator` + - Вынести пробелы из начала atrulerq + - Проверить functionExpression: type string or array + - Убрать: Внутри ident в sass могут быть interpolations, поэтому ident.content является массивом из строк и interpolations + - Типы вроде `important` в качестве контента должны содержать не пробелы, а весь идент + - Убрать unknown type + - Сделать вспомогательные методы вроде blockDecl приватными + - В Sass убрать curly braces у atruler + +Docs: + - Changelog + - Readme + - AST + - API + +Плюшки: + - Попробовать Closure Compiler и сравнить скорость + - Update bin + - Вынести тестовые синтаксисы в отд. репозиторий-модуль diff --git a/node_modules/gonzales-pe/bin/generate-tests.js b/node_modules/gonzales-pe/bin/generate-tests.js new file mode 100755 index 0000000..f127dc6 --- /dev/null +++ b/node_modules/gonzales-pe/bin/generate-tests.js @@ -0,0 +1,45 @@ +#!/usr/bin/env node + +/** + * Generate `.json` test files. + * Usage: `./bin/generate-tests.js []`. + * Example: `./bin/generate-tests.js scss less`. + */ + +var gonzales = require('..'), + fs = require('fs'), + path = require('path'), + syntaxList = process.argv.slice(2); + +syntaxList.forEach(function (s) { + var syntaxDir = 'test/' + s; + var extension = '.' + s; + + fs.readdirSync(syntaxDir).forEach(function(testDir) { + fs.readdirSync(path.join(syntaxDir, testDir)).forEach(function(file) { + if (path.extname(file) !== extension) return; + + try { + generateTest(path.join(syntaxDir, testDir, file)); + } catch (e) { + console.log('*', path.join(syntaxDir, testDir, file)); + } + }); + }); +}); + +function generateTest(filePath) { + var testDir = path.dirname(filePath); + var rule = path.basename(testDir); + var syntax = path.basename(path.dirname(testDir)); + var fileName = path.basename(filePath, '.' + syntax); + + var inputPath = path.join(testDir, fileName + '.' + syntax); + var outputPath = path.join(testDir, fileName + '.json'); + + var string = fs.readFileSync(inputPath, 'utf-8').trim(); + var ast = gonzales.parse(string, {syntax: syntax, rule: rule}); + + fs.writeFileSync(outputPath, ast.toString()); +} + diff --git a/node_modules/gonzales-pe/bin/gonzales.js b/node_modules/gonzales-pe/bin/gonzales.js new file mode 100755 index 0000000..52cc670 --- /dev/null +++ b/node_modules/gonzales-pe/bin/gonzales.js @@ -0,0 +1,26 @@ +#!/usr/bin/env node + +/** + * ./bin/gonzales.js filename + * ./bin/gonzales.js filename -s + */ +var gonzales = require('..'), + fs = require('fs'), + path = require('path'), + filename = process.argv[2], + silent = process.argv[3] === '-s'; + +if (!filename) { + console.log('Please supply a filename. Usage "gonzales file"'); + process.exit(); +} + +var syntax = path.extname(filename).substring(1); +var css = fs.readFileSync(filename, 'utf-8'); + +try { + var ast = gonzales.parse(css, {syntax: syntax}); + if (!silent) console.log(ast.toString()); +} catch (e) { + if (!silent) throw e; +} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/doc/AST-Description.md b/node_modules/gonzales-pe/doc/AST-Description.md similarity index 100% rename from node_modules/csscomb/node_modules/gonzales-pe/doc/AST-Description.md rename to node_modules/gonzales-pe/doc/AST-Description.md diff --git a/node_modules/csscomb/node_modules/gonzales-pe/doc/Gonzales-Usage.md b/node_modules/gonzales-pe/doc/Gonzales-Usage.md similarity index 100% rename from node_modules/csscomb/node_modules/gonzales-pe/doc/Gonzales-Usage.md rename to node_modules/gonzales-pe/doc/Gonzales-Usage.md diff --git a/node_modules/gonzales-pe/lib/css/mark.js b/node_modules/gonzales-pe/lib/css/mark.js new file mode 100644 index 0000000..1a4f417 --- /dev/null +++ b/node_modules/gonzales-pe/lib/css/mark.js @@ -0,0 +1,129 @@ +var TokenType = require('../token-types'); + +/** + * Mark whitespaces and comments + * @param {Array} tokens + */ +function markSpacesAndComments(tokens) { + var tokensLength = tokens.length; + var lastSpaceIndex = -1; + var lastSpaceOrCommentIndex = -1; + var spaces = [-1, -1]; + var token; // current token + var type; // current token's type + + // For every token in the token list, mark spaces and line breaks + // as spaces (set both `ws` and `sc` flags). Mark multiline comments + // with `sc` flag. + // If there are several spaces or tabs or line breaks or multiline + // comments in a row, group them: take the last one's index number + // and save it to the first token in the group as a reference + // (e.g., `ws_last = 7` for a group of whitespaces or `sc_last = 9` + // for a group of whitespaces and comments): + for (var i = 0; i < tokensLength; i++) { + type = tokens[i].type; + + if (type === TokenType.Space || + type === TokenType.Tab || + type === TokenType.Newline) { + markSpace(tokens, i, spaces); + } else if (type === TokenType.CommentML) { + markComment(tokens, i, spaces); + } else { + markEndOfSpacesAndComments(tokens, i, spaces); + } + } + + markEndOfSpacesAndComments(tokens, i, spaces); +} + +function markSpace(tokens, i, spaces) { + var token = tokens[i]; + token.ws = true; + token.sc = true; + + if (spaces[0] === -1) spaces[0] = i; + if (spaces[1] === -1) spaces[1] = i; +} + +function markComment(tokens, i, spaces) { + var ws = spaces[0]; + tokens[i].sc = true; + + if (ws !== -1) { + tokens[ws].ws_last = i - 1; + spaces[0] = -1; + } +} + +function markEndOfSpacesAndComments(tokens, i, spaces) { + var ws = spaces[0]; + var sc = spaces[1]; + if (ws !== -1) { + tokens[ws].ws_last = i - 1; + spaces[0] = -1; + } + if (sc !== -1) { + tokens[sc].sc_last = i - 1; + spaces[1] = -1; + } +} + +/** + * Pair brackets + * @param {Array} tokens + */ +function markBrackets(tokens) { + var tokensLength = tokens.length; + var ps = [], // parenthesis + sbs = [], // square brackets + cbs = [], // curly brackets + t; // current token + + // For every token in the token list, if we meet an opening (left) + // bracket, push its index number to a corresponding array. + // If we then meet a closing (right) bracket, look at the corresponding + // array. If there are any elements (records about previously met + // left brackets), take a token of the last left bracket (take + // the last index number from the array and find a token with + // this index number) and save right bracket's index as a reference: + for (var i = 0; i < tokens.length; i++) { + t = tokens[i]; + var type = t.type; + + if (type === TokenType.LeftParenthesis) { + ps.push(i); + } else if (type === TokenType.RightParenthesis) { + if (ps.length) { + t.left = ps.pop(); + tokens[t.left].right = i; + } + } else if (type === TokenType.LeftSquareBracket) { + sbs.push(i); + } else if (type === TokenType.RightSquareBracket) { + if (sbs.length) { + t.left = sbs.pop(); + tokens[t.left].right = i; + } + } else if (type === TokenType.LeftCurlyBracket) { + cbs.push(i); + } else if (type === TokenType.RightCurlyBracket) { + if (cbs.length) { + t.left = cbs.pop(); + tokens[t.left].right = i; + } + } + } +} + +/** + * @param {Array} tokens + */ +function markTokens(tokens) { + // Mark paired brackets: + markBrackets(tokens); + // Mark whitespaces and comments: + markSpacesAndComments(tokens); +} + +module.exports = markTokens; diff --git a/node_modules/gonzales-pe/lib/css/parse.js b/node_modules/gonzales-pe/lib/css/parse.js new file mode 100644 index 0000000..3fa15ea --- /dev/null +++ b/node_modules/gonzales-pe/lib/css/parse.js @@ -0,0 +1,2688 @@ +var Node = require('../node'); +var NodeType = require('../node-types'); +var TokenType = require('../token-types'); + +/** + * @type {Array} + */ +var tokens; + +/** + * @type {Number} + */ +var tokensLength; + +/** + * @type {Number} + */ +var pos; + +var rules = { + 'arguments': function() { return checkArguments(pos) && getArguments(); }, + 'atkeyword': function() { return checkAtkeyword(pos) && getAtkeyword(); }, + 'atruleb': function() { return checkAtruleb(pos) && getAtruleb(); }, + 'atruler': function() { return checkAtruler(pos) && getAtruler(); }, + 'atrulerq': function() { return checkAtrulerq(pos) && getAtrulerq(); }, + 'atrulers': function() { return checkAtrulers(pos) && getAtrulers(); }, + 'atrules': function() { return checkAtrules(pos) && getAtrules(); }, + 'attrib': function() { return checkAttrib(pos) && getAttrib(); }, + 'attrselector': function() { return checkAttrselector(pos) && getAttrselector(); }, + 'block': function() { return checkBlock(pos) && getBlock(); }, + 'braces': function() { return checkBraces(pos) && getBraces(); }, + 'class': function() { return checkClass(pos) && getClass(); }, + 'combinator': function() { return checkCombinator(pos) && getCombinator(); }, + 'commentML': function() { return checkCommentML(pos) && getCommentML(); }, + 'declaration': function() { return checkDeclaration(pos) && getDeclaration(); }, + 'declDelim': function() { return checkDeclDelim(pos) && getDeclDelim(); }, + 'delim': function() { return checkDelim(pos) && getDelim(); }, + 'dimension': function() { return checkDimension(pos) && getDimension(); }, + 'filter': function() { return checkFilter(pos) && getFilter(); }, + 'filterv': function() { return checkFilterv(pos) && getFilterv(); }, + 'functionExpression': function() { return checkFunctionExpression(pos) && getFunctionExpression(); }, + 'function': function() { return checkFunction(pos) && getFunction(); }, + 'ident': function() { return checkIdent(pos) && getIdent(); }, + 'important': function() { return checkImportant(pos) && getImportant(); }, + 'namespace': function() { return checkNamespace(pos) && getNamespace(); }, + 'nth': function() { return checkNth(pos) && getNth(); }, + 'nthselector': function() { return checkNthselector(pos) && getNthselector(); }, + 'number': function() { return checkNumber(pos) && getNumber(); }, + 'operator': function() { return checkOperator(pos) && getOperator(); }, + 'percentage': function() { return checkPercentage(pos) && getPercentage(); }, + 'progid': function() { return checkProgid(pos) && getProgid(); }, + 'property': function() { return checkProperty(pos) && getProperty(); }, + 'propertyDelim': function() { return checkPropertyDelim(pos) && getPropertyDelim(); }, + 'pseudoc': function() { return checkPseudoc(pos) && getPseudoc(); }, + 'pseudoe': function() { return checkPseudoe(pos) && getPseudoe(); }, + 'ruleset': function() { return checkRuleset(pos) && getRuleset(); }, + 's': function() { return checkS(pos) && getS(); }, + 'selector': function() { return checkSelector(pos) && getSelector(); }, + 'shash': function() { return checkShash(pos) && getShash(); }, + 'simpleselector': function() { return checkSimpleSelector(pos) && getSimpleSelector(); }, + 'string': function() { return checkString(pos) && getString(); }, + 'stylesheet': function() { return checkStylesheet(pos) && getStylesheet(); }, + 'unary': function() { return checkUnary(pos) && getUnary(); }, + 'uri': function() { return checkUri(pos) && getUri(); }, + 'value': function() { return checkValue(pos) && getValue(); }, + 'vhash': function() { return checkVhash(pos) && getVhash(); } +}; + +/** + * Stop parsing and display error + * @param {Number=} i Token's index number + */ +function throwError(i) { + var ln = tokens[i].ln; + + throw {line: ln, syntax: 'css'}; +} + +/** + * @param {Object} exclude + * @param {Number} i Token's index number + * @return {Number} + */ +function checkExcluding(exclude, i) { + var start = i; + + while(i < tokensLength) { + if (exclude[tokens[i++].type]) break; + } + + return i - start - 2; +} + +/** + * @param {Number} start + * @param {Number} finish + * @return {String} + */ +function joinValues(start, finish) { + var s = ''; + + for (var i = start; i < finish + 1; i++) { + s += tokens[i].value; + } + + return s; +} + +/** + * @param {Number} start + * @param {Number} num + * @return {String} + */ +function joinValues2(start, num) { + if (start + num - 1 >= tokensLength) return; + + var s = ''; + + for (var i = 0; i < num; i++) { + s += tokens[start + i].value; + } + + return s; +} + + +///////////////////////////////////// +///////////////////////////////////// +///////////////////////////////////// + + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAny(i) { + var l; + + if (l = checkBraces(i)) tokens[i].any_child = 1; + else if (l = checkString(i)) tokens[i].any_child = 2; + else if (l = checkPercentage(i)) tokens[i].any_child = 3; + else if (l = checkDimension(i)) tokens[i].any_child = 4; + else if (l = checkNumber(i)) tokens[i].any_child = 5; + else if (l = checkUri(i)) tokens[i].any_child = 6; + else if (l = checkFunctionExpression(i)) tokens[i].any_child = 7; + else if (l = checkFunction(i)) tokens[i].any_child = 8; + else if (l = checkIdent(i)) tokens[i].any_child = 9; + else if (l = checkClass(i)) tokens[i].any_child = 10; + else if (l = checkUnary(i)) tokens[i].any_child = 11; + + return l; +} + +/** + * @return {Node} + */ +function getAny() { + var childType = tokens[pos].any_child; + + if (childType === 1) return getBraces(); + else if (childType === 2) return getString(); + else if (childType === 3) return getPercentage(); + else if (childType === 4) return getDimension(); + else if (childType === 5) return getNumber(); + else if (childType === 6) return getUri(); + else if (childType === 7) return getFunctionExpression(); + else if (childType === 8) return getFunction(); + else if (childType === 9) return getIdent(); + else if (childType === 10) return getClass(); + else if (childType === 11) return getUnary(); +} + +/** + * Check if token is part of an @-word (e.g. `@import`, `@include`) + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAtkeyword(i) { + var l; + + // Check that token is `@`: + if (i >= tokensLength || + tokens[i++].type !== TokenType.CommercialAt) return 0; + + return (l = checkIdent(i)) ? l + 1 : 0; +} + +/** + * Get node with @-word + * @return {Node} + */ +function getAtkeyword() { + var type = NodeType.AtkeywordType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + pos++; + + content.push(getIdent()); + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of an attribute selector (e.g. `[attr]`, + * `[attr='panda']`) + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAttrib(i) { + if (i >= tokensLength || + tokens[i].type !== TokenType.LeftSquareBracket || + !tokens[i].right) return 0; + + return tokens[i].right - i + 1; +} + +/** + * Get node with an attribute selector + * @return {Node} + */ +function getAttrib() { + if (checkAttrib1(pos)) return getAttrib1(); + if (checkAttrib2(pos)) return getAttrib2(); +} + +/** + * Check if token is part of an attribute selector of the form `[attr='value']` + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAttrib1(i) { + var start = i, + l; + + if (i++ >= tokensLength) return 0; + + if (l = checkSC(i)) i += l; + + if (l = checkIdent(i)) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + + if (l = checkAttrselector(i)) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + + if (l = checkIdent(i) || checkString(i)) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + + return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; +} + +/** + * Get node with an attribute selector of the form `[attr='value']` + * @return {Node} + */ +function getAttrib1() { + var type = NodeType.AttribType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + pos++; + + content = content + .concat(getSC()) + .concat([getIdent()]) + .concat(getSC()) + .concat([getAttrselector()]) + .concat(getSC()) + .concat([checkString(pos)? getString() : getIdent()]) + .concat(getSC()); + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of an attribute selector of the form `[attr]` + * Attribute can not be empty, e.g. `[]`. + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAttrib2(i) { + var start = i, + l; + + if (i++ >= tokensLength) return 0; + + if (l = checkSC(i)) i += l; + + if (l = checkIdent(i)) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + + return tokens[i].type === TokenType.RightSquareBracket ? i - start : 0; +} + +/** + * Get node with an attribute selector of the form `[attr]` + * @return {Node} + */ +function getAttrib2() { + var type = NodeType.AttribType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + pos++; + + content = content + .concat(getSC()) + .concat([getIdent()]) + .concat(getSC()); + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of an attribute selector operator (`=`, `~=`, + * `^=`, `$=`, `*=` or `|=`) + * @param {Number} i Token's index number + * @return {Number} Length of operator (`0` if token is not part of an + * operator, `1` or `2` if it is). + */ +function checkAttrselector(i) { + if (i >= tokensLength) return 0; + + if (tokens[i].type === TokenType.EqualsSign) return 1; + + // TODO: Add example or remove + if (tokens[i].type === TokenType.VerticalLine && + (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign)) + return 1; + + if (!tokens[i + 1] || tokens[i + 1].type !== TokenType.EqualsSign) return 0; + + switch(tokens[i].type) { + case TokenType.Tilde: + case TokenType.CircumflexAccent: + case TokenType.DollarSign: + case TokenType.Asterisk: + case TokenType.VerticalLine: + return 2; + } + + return 0; +} + +/** + * Get node with an attribute selector operator (`=`, `~=`, `^=`, `$=`, + * `*=` or `|=`) + * @return {Node} + */ +function getAttrselector() { + var type = NodeType.AttrselectorType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = tokens[pos].value; + + pos++; + + if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) + content += tokens[pos++].value; + + return new Node(type, content, line, column); +} + +/** + * Check if token is a part of an @-rule + * @param {Number} i Token's index number + * @return {Number} Length of @-rule + */ +function checkAtrule(i) { + var l; + + if (i >= tokensLength) return 0; + + // If token already has a record of being part of an @-rule, + // return the @-rule's length: + if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l; + + // If token is part of an @-rule, save the rule's type to token: + if (l = checkAtruler(i)) tokens[i].atrule_type = 1; // @-rule with ruleset + else if (l = checkAtruleb(i)) tokens[i].atrule_type = 2; // block @-rule + else if (l = checkAtrules(i)) tokens[i].atrule_type = 3; // single-line @-rule + else return 0; + + // If token is part of an @-rule, save the rule's length to token: + tokens[i].atrule_l = l; + + return l; +} + +/** + * Get node with @-rule + * @return {Node} + */ +function getAtrule() { + switch (tokens[pos].atrule_type) { + case 1: return getAtruler(); // @-rule with ruleset + case 2: return getAtruleb(); // block @-rule + case 3: return getAtrules(); // single-line @-rule + } +} + +/** + * Check if token is part of a block @-rule + * @param {Number} i Token's index number + * @return {Number} Length of the @-rule + */ +function checkAtruleb(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkAtkeyword(i)) i += l; + else return 0; + + if (l = checkTsets(i)) i += l; + + if (l = checkBlock(i)) i += l; + else return 0; + + return i - start; +} + +/** + * Get node with a block @-rule + * @return {Node} + */ +function getAtruleb() { + var type = NodeType.AtrulebType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [getAtkeyword()] + .concat(getTsets()) + .concat([getBlock()]); + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of an @-rule with ruleset + * @param {Number} i Token's index number + * @return {Number} Length of the @-rule + */ +function checkAtruler(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkAtkeyword(i)) i += l; + else return 0; + + if (l = checkAtrulerq(i)) i += l; + + if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++; + else return 0; + + if (l = checkAtrulers(i)) i += l; + + if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++; + else return 0; + + return i - start; +} + +/** + * Get node with an @-rule with ruleset + * @return {Node} + */ +function getAtruler() { + var type = NodeType.AtrulerType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [getAtkeyword(), getAtrulerq()]; + + pos++; + + content.push(getAtrulers()); + + pos++; + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAtrulerq(i) { + return checkTsets(i); +} + +/** + * @return {Node} + */ +function getAtrulerq() { + var type = NodeType.AtrulerqType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = getTsets(); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAtrulers(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkSC(i)) i += l; + + while (i < tokensLength) { + if (l = checkSC(i)) tokens[i].atrulers_child = 1; + else if (l = checkAtrule(i)) tokens[i].atrulers_child = 2; + else if (l = checkRuleset(i)) tokens[i].atrulers_child = 3; + else break; + i += l; + } + + tokens[i].atrulers_end = 1; + + if (l = checkSC(i)) i += l; + + return i - start; +} + +/** + * @return {Node} + */ +function getAtrulers() { + var type = NodeType.AtrulersType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = getSC(); + + while (!tokens[pos].atrulers_end) { + var childType = tokens[pos].atrulers_child; + if (childType === 1) content = content.concat(getSC()); + else if (childType === 2) content.push(getAtrule()); + else if (childType === 3) content.push(getRuleset()); + } + + content = content.concat(getSC()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkAtrules(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkAtkeyword(i)) i += l; + else return 0; + + if (l = checkTsets(i)) i += l; + + return i - start; +} + +/** + * @return {Node} + */ +function getAtrules() { + var type = NodeType.AtrulesType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [getAtkeyword()].concat(getTsets()); + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a block (e.g. `{...}`). + * @param {Number} i Token's index number + * @return {Number} Length of the block + */ +function checkBlock(i) { + return i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket ? + tokens[i].right - i + 1 : 0; +} + +/** + * Get node with a block + * @return {Node} + */ +function getBlock() { + var type = NodeType.BlockType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [], + end = tokens[pos++].right, + content = []; + + while (pos < end) { + if (checkBlockdecl(pos)) content = content.concat(getBlockdecl()); + else throwError(pos); + } + + pos = end + 1; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a declaration (property-value pair) + * @param {Number} i Token's index number + * @return {Number} Length of the declaration + */ +function checkBlockdecl(i) { + var l; + + if (i >= tokensLength) return 0; + + if (l = checkBlockdecl1(i)) tokens[i].bd_type = 1; + else if (l = checkBlockdecl2(i)) tokens[i].bd_type = 2; + else if (l = checkBlockdecl3(i)) tokens[i].bd_type = 3; + else if (l = checkBlockdecl4(i)) tokens[i].bd_type = 4; + else return 0; + + return l; +} + +/** + * @return {Array} + */ +function getBlockdecl() { + switch (tokens[pos].bd_type) { + case 1: return getBlockdecl1(); + case 2: return getBlockdecl2(); + case 3: return getBlockdecl3(); + case 4: return getBlockdecl4(); + } +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkBlockdecl1(i) { + var start = i, + l; + + if (l = checkSC(i)) i += l; + + if (l = checkFilter(i)) tokens[i].bd_kind = 1; + else if (l = checkDeclaration(i)) tokens[i].bd_kind = 2; + else if (l = checkAtrule(i)) tokens[i].bd_kind = 3; + else return 0; + + i += l; + + if (l = checkSC(i)) i += l; + + if (i < tokensLength && (l = checkDeclDelim(i))) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + else return 0; + + return i - start; +} + +/** + * @return {Array} + */ +function getBlockdecl1() { + var sc = getSC(), + x; + + switch (tokens[pos].bd_kind) { + case 1: + x = getFilter(); + break; + case 2: + x = getDeclaration(); + break; + case 3: + x = getAtrule(); + break; + } + + return sc + .concat([x]) + .concat(getSC()) + .concat([getDeclDelim()]) + .concat(getSC()); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkBlockdecl2(i) { + var start = i, + l; + + if (l = checkSC(i)) i += l; + + if (l = checkFilter(i)) tokens[i].bd_kind = 1; + else if (l = checkDeclaration(i)) tokens[i].bd_kind = 2; + else if (l = checkAtrule(i)) tokens[i].bd_kind = 3; + else return 0; + + i += l; + + if (l = checkSC(i)) i += l; + + return i - start; +} + +/** + * @return {Array} + */ +function getBlockdecl2() { + var sc = getSC(), + x; + + switch (tokens[pos].bd_kind) { + case 1: + x = getFilter(); + break; + case 2: + x = getDeclaration(); + break; + case 3: + x = getAtrule(); + break; + } + + return sc + .concat([x]) + .concat(getSC()); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkBlockdecl3(i) { + var start = i, + l; + + if (l = checkSC(i)) i += l; + + if (l = checkDeclDelim(i)) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + + return i - start; +} + +/** + * @return {Array} + */ +function getBlockdecl3() { + return getSC() + .concat([getDeclDelim()]) + .concat(getSC()); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkBlockdecl4(i) { + return checkSC(i); +} + +/** + * @return {Array} + */ +function getBlockdecl4() { + return getSC(); +} + +/** + * Check if token is part of text inside parentheses or square brackets + * (e.g. `(1)`) + * @param {Number} i Token's index number + * @return {Number} + */ +function checkBraces(i) { + if (i >= tokensLength || + (tokens[i].type !== TokenType.LeftParenthesis && + tokens[i].type !== TokenType.LeftSquareBracket)) return 0; + + return tokens[i].right - i + 1; +} + +/** + * Get node with text inside parentheses or square brackets (e.g. `(1)`) + * @return {Node} + */ +function getBraces() { + var type = NodeType.BracesType, + token = tokens[pos], + line = token.ln, + column = token.col, + left = pos, + right = tokens[pos++].right; + content = [tokens[left].value, tokens[right].value] + .concat(getTsets()); + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a class selector (e.g. `.abc`) + * @param {Number} i Token's index number + * @return {Number} Length of the class selector + */ +function checkClass(i) { + var l; + + if (i >= tokensLength) return 0; + + if (tokens[i].class_l) return tokens[i].class_l; + + if (tokens[i++].type === TokenType.FullStop && (l = checkIdent(i))) { + tokens[i].class_l = l + 1; + return l + 1; + } + + return 0; +} + +/** + * Get node with a class selector + * @return {Node} + */ +function getClass() { + var type = NodeType.ClassType, + token = tokens[pos++], + line = token.ln, + column = token.col, + content = [getIdent()]; + + return new Node(type, content, line, column); +} + +/** + * Check if token is a combinator (`+`, `>` or `~`) + * @param {Number} i Token's index number + * @return {Number} Length of the combinator + */ +function checkCombinator(i) { + if (i >= tokensLength) return 0; + + switch (tokens[i].type) { + case TokenType.PlusSign: + case TokenType.GreaterThanSign: + case TokenType.Tilde: + return 1; + } + + return 0; +} + +/** + * Get node with a combinator (`+`, `>` or `~`) + * @return {Node} + */ +function getCombinator() { + var type = NodeType.CombinatorType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = tokens[pos++].value; + + return new Node(type, content, line, column); +} + +/** + * Check if token is a multiline comment. + * @param {Number} i Token's index number + * @return {Number} `1` if token is a multiline comment, otherwise `0` + */ +function checkCommentML(i) { + return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0; +} + +/** + * Get node with a multiline comment + * @return {Node} + */ +function getCommentML() { + var type = NodeType.CommentMLType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = tokens[pos].value.substring(2), + l = content.length; + + if (content.charAt(l - 2) === '*' && content.charAt(l - 1) === '/') + content = content.substring(0, l - 2); + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a declaration (property-value pair) + * @param {Number} i Token's index number + * @return {Number} Length of the declaration + */ +function checkDeclaration(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkProperty(i)) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + + if (l = checkPropertyDelim(i)) i++; + else return 0; + + if (l = checkSC(i)) i += l; + + if (l = checkValue(i)) i += l; + else return 0; + + return i - start; +} + +/** + * Get node with a declaration + * @return {Node} + */ +function getDeclaration() { + var type = NodeType.DeclarationType, + token = tokens[pos], + line = token.ln, + column = token.col; + + var content = [getProperty()] + .concat(getSC()) + .concat([getPropertyDelim()]) + .concat(getSC()) + .concat([getValue()]); + + return new Node(type, content, line, column); +} + +/** + * Check if token is a semicolon + * @param {Number} i Token's index number + * @return {Number} `1` if token is a semicolon, otherwise `0` + */ +function checkDeclDelim(i) { + return i < tokensLength && tokens[i].type === TokenType.Semicolon ? 1 : 0; +} + +/** + * Get node with a semicolon + * @return {Node} + */ +function getDeclDelim() { + var type = NodeType.DeclDelimType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = ';'; + + pos++; + + return new Node(type, content, line, column); +} + +function checkDeepSelector(i) { + if (tokens[i + 2] && + tokens[i].value + tokens[i + 1].value + tokens[i + 2].value === '/deep/') { + return 3; + } +} + +function getDeepSelector() { + var _pos = pos++; + var ident = getIdent(); + ident.content = '/deep/'; + ident.start.column -= 1; + pos = _pos + 3; + return ident; +} + +/** + * Check if token is a comma + * @param {Number} i Token's index number + * @return {Number} `1` if token is a comma, otherwise `0` + */ +function checkDelim(i) { + return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0; +} + +/** + * Get node with a comma + * @return {Node} + */ +function getDelim() { + var type = NodeType.DelimType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = ','; + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a number with dimension unit (e.g. `10px`) + * @param {Number} i Token's index number + * @return {Number} + */ +function checkDimension(i) { + var ln = checkNumber(i), + li; + + if (i >= tokensLength || + !ln || + i + ln >= tokensLength) return 0; + + return (li = checkNmName2(i + ln)) ? ln + li : 0; +} + +/** + * Get node of a number with dimension unit + * @return {Node} + */ +function getDimension() { + var type = NodeType.DimensionType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [getNumber()]; + + token = tokens[pos]; + var ident = new Node(NodeType.IdentType, getNmName2(), token.ln, token.col); + + content.push(ident); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkFilter(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkFilterp(i)) i += l; + else return 0; + + if (tokens[i].type === TokenType.Colon) i++; + else return 0; + + if (l = checkFilterv(i)) i += l; + else return 0; + + return i - start; +} + +/** + * @return {Node} + */ +function getFilter() { + var type = NodeType.FilterType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [getFilterp()]; + + pos++; + + content.push(getFilterv()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkFilterp(i) { + var start = i, + l, + x; + + if (i >= tokensLength) return 0; + + if (tokens[i].value === 'filter') l = 1; + else { + x = joinValues2(i, 2); + + if (x === '-filter' || x === '_filter' || x === '*filter') l = 2; + else { + x = joinValues2(i, 4); + + if (x === '-ms-filter') l = 4; + else return 0; + } + } + + tokens[start].filterp_l = l; + + i += l; + + if (checkSC(i)) i += l; + + return i - start; +} + +/** + * @return {Node} + */ +function getFilterp() { + var type = NodeType.PropertyType, + token = tokens[pos], + line = token.ln, + column = token.col, + content; + + token = tokens[pos]; + var ident = new Node(NodeType.IdentType, joinValues2(pos, token.filterp_l), token.ln, token.col); + + pos += token.filterp_l; + + content = [ident].concat(getSC()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkFilterv(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkSC(i)) i += l; + + if (l = checkProgid(i)) i += l; + else return 0; + + while (l = checkProgid(i)) { + i += l; + } + + tokens[start].last_progid = i; + + if (i < tokensLength && (l = checkSC(i))) i += l; + + if (i < tokensLength && (l = checkImportant(i))) i += l; + + return i - start; +} + +/** + * @return {Node} + */ +function getFilterv() { + var type = NodeType.FiltervType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [], + last_progid = token.last_progid; + + content = content.concat(getSC()); + + while (pos < last_progid) { + content.push(getProgid()); + } + + if (checkSC(pos)) content = content.concat(getSC()); + + if (pos < tokensLength && checkImportant(pos)) content.push(getImportant()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkFunctionExpression(i) { + var start = i; + + if (i >= tokensLength || tokens[i++].value !== 'expression' || + i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0; + + return tokens[i].right - start + 1; +} + +/** + * @return {Node} + */ +function getFunctionExpression() { + var type = NodeType.FunctionExpressionType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + pos++; + + content.push(joinValues(pos + 1, tokens[pos].right - 1)); + + pos = tokens[pos].right + 1; + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkFunction(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkIdent(i)) i +=l; + else return 0; + + return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? + tokens[i].right - start + 1 : 0; +} + +/** + * @return {Node} + */ +function getFunction() { + var type = NodeType.FunctionType, + token = tokens[pos], + line = token.ln, + column = token.col, + ident = getIdent(), + content = [ident]; + + content.push(ident.content === 'not' ? getNotArguments() : getArguments()); + + return new Node(type, content, line, column); +} + +/** + * @return {Node} + */ +function getArguments() { + var type = NodeType.ArgumentsType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [], + body; + + pos++; + + while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) { + if (checkDeclaration(pos)) content.push(getDeclaration()); + else if (checkArgument(pos)) { + body = getArgument(); + if (typeof body.content === 'string') content.push(body); + else content = content.concat(body); + } else if (checkClass(pos)) content.push(getClass()); + else throwError(pos); + } + + pos++; + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkArgument(i) { + var l; + + if (l = checkVhash(i)) tokens[i].argument_child = 1; + else if (l = checkAny(i)) tokens[i].argument_child = 2; + else if (l = checkSC(i)) tokens[i].argument_child = 3; + else if (l = checkOperator(i)) tokens[i].argument_child = 4; + + return l; +} + +/** + * @return {Node} + */ +function getArgument() { + var childType = tokens[pos].argument_child; + if (childType === 1) return getVhash(); + else if (childType === 2) return getAny(); + else if (childType === 3) return getSC(); + else if (childType === 4) return getOperator(); +} + +/** + * @return {Node} + */ +function getNotArguments() { + var type = NodeType.ArgumentsType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + pos++; + + while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) { + // TODO: Remove these checks + if (checkSimpleSelector(pos)) content.push(getSimpleSelector()); + else throwError(pos); + } + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of an identifier + * @param {Number} i Token's index number + * @return {Number} Length of the identifier + */ +function checkIdent(i) { + var start = i, + wasIdent, + l; + + if (i >= tokensLength) return 0; + + // Check if token is part of an identifier starting with `_`: + if (tokens[i].type === TokenType.LowLine) return checkIdentLowLine(i); + + // If token is a character, `-`, `$` or `*`, skip it & continue: + if (tokens[i].type === TokenType.HyphenMinus || + tokens[i].type === TokenType.Identifier || + tokens[i].type === TokenType.DollarSign || + tokens[i].type === TokenType.Asterisk) i++; + else return 0; + + // Remember if previous token's type was identifier: + wasIdent = tokens[i - 1].type === TokenType.Identifier; + + for (; i < tokensLength; i++) { + if (i >= tokensLength) break; + + if (tokens[i].type !== TokenType.HyphenMinus && + tokens[i].type !== TokenType.LowLine) { + if (tokens[i].type !== TokenType.Identifier && + (tokens[i].type !== TokenType.DecimalNumber || !wasIdent)) break; + else wasIdent = true; + } + } + + if (!wasIdent && tokens[start].type !== TokenType.Asterisk) return 0; + + tokens[start].ident_last = i - 1; + + return i - start; +} + +/** + * Check if token is part of an identifier starting with `_` + * @param {Number} i Token's index number + * @return {Number} Length of the identifier + */ +function checkIdentLowLine(i) { + var start = i; + + if (i++ >= tokensLength) return 0; + + for (; i < tokensLength; i++) { + if (tokens[i].type !== TokenType.HyphenMinus && + tokens[i].type !== TokenType.DecimalNumber && + tokens[i].type !== TokenType.LowLine && + tokens[i].type !== TokenType.Identifier) break; + } + + // Save index number of the last token of the identifier: + tokens[start].ident_last = i - 1; + + return i - start; +} + +/** + * Get node with an identifier + * @return {Node} + */ +function getIdent() { + var type = NodeType.IdentType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = joinValues(pos, tokens[pos].ident_last); + + pos = tokens[pos].ident_last + 1; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of `!important` word + * @param {Number} i Token's index number + * @return {Number} + */ +function checkImportant(i) { + var start = i, + l; + + if (i >= tokensLength || + tokens[i++].type !== TokenType.ExclamationMark) return 0; + + if (l = checkSC(i)) i += l; + + return tokens[i].value === 'important' ? i - start + 1 : 0; +} + +/** + * Get node with `!important` word + * @return {Node} + */ +function getImportant() { + var type = NodeType.ImportantType, + token = tokens[pos++], + line = token.ln, + column = token.col, + content = getSC(); + + if (!content || !content.length) content = ''; + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is a namespace sign (`|`) + * @param {Number} i Token's index number + * @return {Number} `1` if token is `|`, `0` if not + */ +function checkNamespace(i) { + return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0; +} + +/** + * Get node with a namespace sign + * @return {Node} + */ +function getNamespace() { + var type = NodeType.NamespaceType, + token = tokens[pos++], + line = token.ln, + column = token.col, + content = '|'; + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkNmName(i) { + var start = i; + + if (i >= tokensLength) return 0; + + // start char / word + if (tokens[i].type === TokenType.HyphenMinus || + tokens[i].type === TokenType.LowLine || + tokens[i].type === TokenType.Identifier || + tokens[i].type === TokenType.DecimalNumber) i++; + else return 0; + + for (; i < tokensLength; i++) { + if (tokens[i].type !== TokenType.HyphenMinus && + tokens[i].type !== TokenType.LowLine && + tokens[i].type !== TokenType.Identifier && + tokens[i].type !== TokenType.DecimalNumber) break; + } + + tokens[start].nm_name_last = i - 1; + + return i - start; +} + +/** + * @return {String} + */ +function getNmName() { + var s = joinValues(pos, tokens[pos].nm_name_last); + + pos = tokens[pos].nm_name_last + 1; + + return s; +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkNmName2(i) { + if (tokens[i].type === TokenType.Identifier) return 1; + else if (tokens[i].type !== TokenType.DecimalNumber) return 0; + + i++; + + return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1; +} + +/** + * @return {String} + */ +function getNmName2() { + var s = tokens[pos].value; + + if (tokens[pos++].type === TokenType.DecimalNumber && + pos < tokensLength && + tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value; + + return s; +} + +/** + * Check if token is part of an nth-selector's identifier (e.g. `2n+1`) + * @param {Number} i Token's index number + * @return {Number} + */ +function checkNth(i) { + if (i >= tokensLength) return 0; + + return checkNth1(i) || checkNth2(i); +} + +/** + * Check if token is part of an nth-selector's identifier in the form of + * sequence of decimals and n-s (e.g. `3`, `n`, `2n+1`) + * @param {Number} i Token's index number + * @return {Number} + */ +function checkNth1(i) { + var start = i; + + for (; i < tokensLength; i++) { + if (tokens[i].type !== TokenType.DecimalNumber && + tokens[i].value !== 'n') break; + } + + if (i !== start) tokens[start].nth_last = i - 1; + + return i - start; +} + +/** + * Get node for nth-selector's identifier (e.g. `2n+1`) + * @return {Node} + */ +function getNth() { + var type = NodeType.NthType, + token = tokens[pos], + line = token.ln, + column = token.col, + content; + + if (token.nth_last) { + content = joinValues(pos, token.nth_last); + pos = token.nth_last + 1; + } else { + content = token.value; + pos++; + } + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of `even` or `odd` nth-selector's identifier + * @param {Number} i Token's index number + * @return {Number} + */ +function checkNth2(i) { + return tokens[i].value === 'even' || tokens[i].value === 'odd' ? 1 : 0; +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkNthf(i) { + var start = i, + l = 0; + + if (tokens[i++].type !== TokenType.Colon) return 0; + + // There was `:`: + l++; + + if (tokens[i++].value !== 'nth' || tokens[i++].value !== '-') return 0; + + // There was either `nth-` or `last-`: + l += 2; + + if ('child' === tokens[i].value) { + l += 1; + } else if ('last-child' === tokens[i].value + + tokens[i + 1].value + + tokens[i + 2].value) { + l += 3; + } else if ('of-type' === tokens[i].value + + tokens[i + 1].value + + tokens[i + 2].value) { + l += 3; + } else if ('last-of-type' === tokens[i].value + + tokens[i + 1].value + + tokens[i + 2].value + + tokens[i + 3].value + + tokens[i + 4].value) { + l += 5; + } else return 0; + + tokens[start + 1].nthf_last = start + l - 1; + + return l; +} + +/** + * @return {String} + */ +function getNthf() { + pos++; + + var s = joinValues(pos, tokens[pos].nthf_last); + + pos = tokens[pos].nthf_last + 1; + + return s; +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkNthselector(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkNthf(i)) i += l; + else return 0; + + if (tokens[i].type !== TokenType.LeftParenthesis || !tokens[i].right) return 0; + + l++; + + var rp = tokens[i++].right; + + while (i < rp) { + if (l = checkSC(i)) tokens[i].nthselector_child = 1; + else if (l = checkUnary(i)) tokens[i].nthselector_child = 2; + else if (l = checkNth(i)) tokens[i].nthselector_child = 3; + else return 0; + i += l; + } + + return rp - start + 1; +} + +/** + * @return {Node} + */ +function getNthselector() { + var type = NodeType.NthselectorType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + + var nthf = new Node(NodeType.IdentType, getNthf(), line, column); + content.push(nthf); + + pos++; + + while (tokens[pos].type !== TokenType.RightParenthesis) { + var childType = tokens[pos].nthselector_child; + if (childType === 1) content = content.concat(getSC()); + else if (childType === 2) content.push(getUnary()); + else if (childType === 3) content.push(getNth()); + } + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a number + * @param {Number} i Token's index number + * @return {Number} Length of number + */ +function checkNumber(i) { + if (i >= tokensLength) return 0; + + if (tokens[i].number_l) return tokens[i].number_l; + + // `10`: + if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && + (!tokens[i + 1] || + (tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop))) + return (tokens[i].number_l = 1, tokens[i].number_l); + + // `10.`: + if (i < tokensLength && + tokens[i].type === TokenType.DecimalNumber && + tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && + (!tokens[i + 2] || (tokens[i + 2].type !== TokenType.DecimalNumber))) + return (tokens[i].number_l = 2, tokens[i].number_l); + + // `.10`: + if (i < tokensLength && + tokens[i].type === TokenType.FullStop && + tokens[i + 1].type === TokenType.DecimalNumber) + return (tokens[i].number_l = 2, tokens[i].number_l); + + // `10.10`: + if (i < tokensLength && + tokens[i].type === TokenType.DecimalNumber && + tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && + tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) + return (tokens[i].number_l = 3, tokens[i].number_l); + + return 0; +} + +/** + * Get node with number + * @return {Node} + */ +function getNumber() { + var type = NodeType.NumberType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = '', + l = tokens[pos].number_l; + + for (var j = 0; j < l; j++) { + content += tokens[pos + j].value; + } + + pos += l; + + return new Node(type, content, line, column); +} + +/** + * Check if token is an operator (`/`, `,`, `:` or `=`). + * @param {Number} i Token's index number + * @return {Number} `1` if token is an operator, otherwise `0` + */ +function checkOperator(i) { + if (i >= tokensLength) return 0; + + switch(tokens[i].type) { + case TokenType.Solidus: + case TokenType.Comma: + case TokenType.Colon: + case TokenType.EqualsSign: + return 1; + } + + return 0; +} + +/** + * Get node with an operator + * @return {Node} + */ +function getOperator() { + var type = NodeType.OperatorType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = token.value; + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a number with percent sign (e.g. `10%`) + * @param {Number} i Token's index number + * @return {Number} + */ +function checkPercentage(i) { + var x; + + if (i >= tokensLength) return 0; + + x = checkNumber(i); + + if (!x || i + x >= tokensLength) return 0; + + return tokens[i + x].type === TokenType.PercentSign ? x + 1 : 0; +} + +/** + * Get node of number with percent sign + * @return {Node} + */ +function getPercentage() { + var type = NodeType.PercentageType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [getNumber()]; + + pos++; + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkProgid(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkSC(i)) i += l; + + if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6; + else return 0; + + if (l = checkIdent(i)) i += l; + else return 0; + + if (l = checkSC(i)) i += l; + + if (tokens[i].type === TokenType.LeftParenthesis) { + tokens[start].progid_end = tokens[i].right; + i = tokens[i].right + 1; + } else return 0; + + if (l = checkSC(i)) i += l; + + return i - start; +} + +/** + * @return {Node} + */ +function getProgid() { + var type = NodeType.ProgidType, + token = tokens[pos], + line = token.ln, + column = token.col, + progid_end = token.progid_end, + content = [] + .concat(getSC()) + .concat([_getProgid(progid_end)]) + .concat(getSC()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} progid_end + * @return {Node} + */ +function _getProgid(progid_end) { + var type = NodeType.RawType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = joinValues(pos, progid_end); + + pos = progid_end + 1; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a property + * @param {Number} i Token's index number + * @return {Number} Length of the property + */ +function checkProperty(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkIdent(i)) i += l; + else return 0; + + return i - start; +} + +/** + * Get node with a property + * @return {Node} + */ +function getProperty() { + var type = NodeType.PropertyType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [getIdent()]; + + return new Node(type, content, line, column); +} + +/** + * Check if token is a colon + * @param {Number} i Token's index number + * @return {Number} `1` if token is a colon, otherwise `0` + */ +function checkPropertyDelim(i) { + return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0; +} + +/** + * Get node with a colon + * @return {Node} + */ +function getPropertyDelim() { + var type = NodeType.PropertyDelimType, + token = tokens[pos++], + line = token.ln, + column = token.col, + content = ':'; + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkPseudo(i) { + return checkPseudoe(i) || + checkPseudoc(i); +} + +/** + * @return {Node} + */ +function getPseudo() { + if (checkPseudoe(pos)) return getPseudoe(); + if (checkPseudoc(pos)) return getPseudoc(); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkPseudoe(i) { + var l; + + if (i >= tokensLength || tokens[i++].type !== TokenType.Colon || + i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; + + return (l = checkIdent(i)) ? l + 2 : 0; +} + +/** + * @return {Node} + */ +function getPseudoe() { + var type = NodeType.PseudoeType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + pos += 2; + + content.push(getIdent()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkPseudoc(i) { + var l; + + if (i >= tokensLength || tokens[i++].type !== TokenType.Colon) return 0; + + if (l = checkFunction(i)) tokens[i].pseudoc_child = 1; + else if (l = checkIdent(i)) tokens[i].pseudoc_child = 2; + else return 0; + + return l + 1; +} + +/** + * @return {Node} + */ +function getPseudoc() { + var type = NodeType.PseudocType, + token = tokens[pos++], + line = token.ln, + column = token.col, + content = []; + + var childType = tokens[pos].pseudoc_child; + if (childType === 1) content.push(getFunction()); + else content.push(getIdent()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkRuleset(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (tokens[start].ruleset_l) return tokens[start].ruleset_l; + + while (i < tokensLength) { + if (l = checkBlock(i)) { + tokens[i].ruleset_child = 1; + i += l; + break; + } else if (l = checkSelector(i)) { + tokens[i].ruleset_child = 2; + i += l; + } else return 0; + } + + tokens[start].ruleset_l = i - start; + + return i - start; +} + +/** + * @return {Node} + */ +function getRuleset() { + var type = NodeType.RulesetType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + while (pos < tokensLength) { + var childType = tokens[pos].ruleset_child; + if (childType === 1) { content.push(getBlock()); break; } + else if (childType === 2) content.push(getSelector()); + else break; + } + + return new Node(type, content, line, column); +} + +/** + * Check if token is marked as a space (if it's a space or a tab + * or a line break). + * @param i + * @return {Number} Number of spaces in a row starting with the given token. + */ +function checkS(i) { + return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0; +} + +/** + * Get node with spaces + * @return {Node} + */ +function getS() { + var type = NodeType.SType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = joinValues(pos, tokens[pos].ws_last); + + pos = tokens[pos].ws_last + 1; + + return new Node(type, content, line, column); +} + +/** + * Check if token is a space or a comment. + * @param {Number} i Token's index number + * @return {Number} Number of similar (space or comment) tokens + * in a row starting with the given token. + */ +function checkSC(i) { + var l, + lsc = 0; + + while (i < tokensLength) { + if (l = checkS(i)) tokens[i].sc_child = 1; + else if (l = checkCommentML(i)) tokens[i].sc_child = 2; + else break; + i += l; + lsc += l; + } + + return lsc || 0; +} + +/** + * Get node with spaces and comments + * @return {Array} + */ +function getSC() { + var sc = []; + + if (pos >= tokensLength) return sc; + + while (pos < tokensLength) { + var childType = tokens[pos].sc_child; + if (childType === 1) sc.push(getS()); + else if (childType === 2) sc.push(getCommentML()); + else break; + } + + return sc; +} + +/** + * Check if token is part of a selector + * @param {Number} i Token's index number + * @return {Number} Length of the selector + */ +function checkSelector(i) { + var start = i, + l; + + while (i < tokensLength) { + if (l = checkDelim(i)) tokens[i].selector_child = 1; + else if (l = checkSimpleSelector(i)) tokens[i].selector_child = 2; + else break; + i += l; + } + + if (i !== start) tokens[start].selector_end = i - 1; + + return i - start; +} + +/** + * @return {Node} + */ +function getSelector() { + var type = NodeType.SelectorType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [], + selector_end = token.selector_end; + + while (pos <= selector_end) { + var childType = tokens[pos].selector_child; + if (childType === 1) content.push(getDelim()); + else if (childType === 2) content.push(getSimpleSelector()); + } + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of a hexadecimal number (e.g. `#fff`) inside + * a simple selector + * @param {Number} i Token's index number + * @return {Number} + */ +function checkShash(i) { + var l; + + if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; + + return (l = checkNmName(i + 1)) ? l + 1 : 0; +} + +/** + * Get node with a hexadecimal number (e.g. `#fff`) inside a simple + * selector + * @return {Node} + */ +function getShash() { + var type = NodeType.ShashType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = []; + + pos++; + + content.push(getNmName()); + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkSimpleSelector(i) { + var start = i, + l; + + while (i < tokensLength) { + if (l = checkSimpleSelector1(i)) i += l; + else break; + } + + tokens[start].simpleselector_end = i; + return i - start; +} + +/** + * @return {Node} + */ +function getSimpleSelector() { + var type = NodeType.SimpleselectorType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [], + end = token.simpleselector_end, + t; + + while (pos < end) { + t = getSimpleSelector1(); + + if (typeof t.content === 'string') content.push(t); + else content = content.concat(t); + } + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkSimpleSelector1(i) { + var l; + + if (l = checkNthselector(i)) tokens[i].simpleselector1_child = 1; + else if (l = checkCombinator(i)) tokens[i].simpleselector1_child = 2; + else if (l = checkAttrib(i)) tokens[i].simpleselector1_child = 3; + else if (l = checkPseudo(i)) tokens[i].simpleselector1_child = 4; + else if (l = checkShash(i)) tokens[i].simpleselector1_child = 5; + else if (l = checkAny(i)) tokens[i].simpleselector1_child = 6; + else if (l = checkSC(i)) tokens[i].simpleselector1_child = 7; + else if (l = checkNamespace(i)) tokens[i].simpleselector1_child = 8; + else if (l = checkDeepSelector(i)) tokens[i].simpleselector1_child = 9; + + return l; +} + +/** + * @return {Node} + */ +function getSimpleSelector1() { + var childType = tokens[pos].simpleselector1_child; + if (childType === 1) return getNthselector(); + else if (childType === 2) return getCombinator(); + else if (childType === 3) return getAttrib(); + else if (childType === 4) return getPseudo(); + else if (childType === 5) return getShash(); + else if (childType === 6) return getAny(); + else if (childType === 7) return getSC(); + else if (childType === 8) return getNamespace(); + else if (childType === 9) return getDeepSelector(); +} + +/** + * Check if token is part of a string (text wrapped in quotes) + * @param {Number} i Token's index number + * @return {Number} `1` if token is part of a string, `0` if not + */ +function checkString(i) { + return i < tokensLength && (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) ? 1 : 0; +} + +/** + * Get string's node + * @return {Array} `['string', x]` where `x` is a string (including + * quotes). + */ +function getString() { + var type = NodeType.StringType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = token.value; + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Validate stylesheet: it should consist of any number (0 or more) of + * rulesets (sets of rules with selectors), @-rules, whitespaces or + * comments. + * @param {Number} i Token's index number + * @return {Number} + */ +function checkStylesheet(i) { + var start = i, + l; + + // Check every token: + while (i < tokensLength) { + if (l = checkSC(i)) tokens[i].stylesheet_child = 1; + else if (l = checkRuleset(i)) tokens[i].stylesheet_child = 2; + else if (l = checkAtrule(i)) tokens[i].stylesheet_child = 3; + else if (l = checkDeclDelim(i)) tokens[i].stylesheet_child = 4; + else throwError(i); + + i += l; + } + + return i - start; +} + +/** + * @return {Array} `['stylesheet', x]` where `x` is all stylesheet's + * nodes. + */ +function getStylesheet() { + var type = NodeType.StylesheetType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = [], + childType; + + while (pos < tokensLength) { + childType = tokens[pos].stylesheet_child; + if (childType === 1) content = content.concat(getSC()); + else if (childType === 2) content.push(getRuleset()); + else if (childType === 3) content.push(getAtrule()); + else if (childType === 4) content.push(getDeclDelim()); + } + + return new Node(type, content, line, column); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkTset(i) { + var l; + + if (l = checkVhash(i)) tokens[i].tset_child = 1; + else if (l = checkAny(i)) tokens[i].tset_child = 2; + else if (l = checkSC(i)) tokens[i].tset_child = 3; + else if (l = checkOperator(i)) tokens[i].tset_child = 4; + + return l; +} + +/** + * @return {Array} + */ +function getTset() { + var childType = tokens[pos].tset_child; + if (childType === 1) return getVhash(); + else if (childType === 2) return getAny(); + else if (childType === 3) return getSC(); + else if (childType === 4) return getOperator(); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkTsets(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + while (l = checkTset(i)) { + i += l; + } + + return i - start; +} + +/** + * @return {Array} + */ +function getTsets() { + var x = [], + t; + + while (checkTset(pos)) { + t = getTset(); + if (typeof t.content === 'string') x.push(t); + else x = x.concat(t); + } + + return x; +} + +/** + * Check if token is an unary (arithmetical) sign (`+` or `-`) + * @param {Number} i Token's index number + * @return {Number} `1` if token is an unary sign, `0` if not + */ +function checkUnary(i) { + return i < tokensLength && (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) ? 1 : 0; +} + +/** + * Get node with an unary (arithmetical) sign (`+` or `-`) + * @return {Array} `['unary', x]` where `x` is an unary sign + * converted to string. + */ +function getUnary() { + var type = NodeType.UnaryType, + token = tokens[pos], + line = token.ln, + column = token.col, + content = token.value; + + pos++; + + return new Node(type, content, line, column); +} + +/** + * Check if token is part of URI (e.g. `url('/css/styles.css')`) + * @param {Number} i Token's index number + * @return {Number} Length of URI + */ +function checkUri(i) { + var start = i; + + if (i >= tokensLength || tokens[i].value !== 'url') return 0; + i += 1; + if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) + return 0; + + return tokens[i].right - start + 1; +} + +/** + * Get node with URI + * @return {Array} `['uri', x]` where `x` is URI's nodes (without `url` + * and braces, e.g. `['string', ''/css/styles.css'']`). + */ +function getUri() { + var startPos = pos, + uriExcluding = {}, + uri, + l, + raw; + + var rawContent, t; + + pos += 2; + + uriExcluding[TokenType.Space] = 1; + uriExcluding[TokenType.Tab] = 1; + uriExcluding[TokenType.Newline] = 1; + uriExcluding[TokenType.LeftParenthesis] = 1; + uriExcluding[TokenType.RightParenthesis] = 1; + + if (checkUri1(pos)) { + uri = [] + .concat(getSC()) + .concat([getString()]) + .concat(getSC()); + + pos++; + } else { + uri = checkSC(pos) ? getSC() : []; + l = checkExcluding(uriExcluding, pos), + rawContent = joinValues(pos, pos + l); + t = tokens[pos]; + raw = new Node(NodeType.RawType, rawContent, t.ln, t.col); + + uri.push(raw); + + pos += l + 1; + + if (checkSC(pos)) uri = uri.concat(getSC()); + + pos++; + } + + t = tokens[startPos]; + return new Node(NodeType.UriType, uri, t.ln, t.col); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function checkUri1(i) { + var start = i, + l; + + if (i >= tokensLength) return 0; + + if (l = checkSC(i)) i += l; + + if (tokens[i].type !== TokenType.StringDQ && tokens[i].type !== TokenType.StringSQ) return 0; + + i++; + + if (l = checkSC(i)) i += l; + + return i - start; +} + +/** + * Check if token is part of a value + * @param {Number} i Token's index number + * @return {Number} Length of the value + */ +function checkValue(i) { + var start = i, + l, s, _i; + + while (i < tokensLength) { + s = checkSC(i); + _i = i + s; + + if (l = _checkValue(_i)) i += l + s; + else break; + } + + tokens[start].value_end = i; + return i - start; +} + +/** + * @return {Array} + */ +function getValue() { + var startPos = pos, + end = tokens[pos].value_end, + x = [], + s, _pos; + + while (pos < end) { + if (tokens[pos].value_child) x.push(_getValue()); + else x = x.concat(getSC()); + } + + var t = tokens[startPos]; + return new Node(NodeType.ValueType, x, t.ln, t.col); +} + +/** + * @param {Number} i Token's index number + * @return {Number} + */ +function _checkValue(i) { + var l; + + if (l = checkVhash(i)) tokens[i].value_child = 1; + else if (l = checkAny(i)) tokens[i].value_child = 2; + else if (l = checkOperator(i)) tokens[i].value_child = 3; + else if (l = checkImportant(i)) tokens[i].value_child = 4; + + return l; +} + +/** + * @return {Array} + */ +function _getValue() { + var childType = tokens[pos].value_child; + if (childType === 1) return getVhash(); + else if (childType === 2) return getAny(); + else if (childType === 3) return getOperator(); + else if (childType === 4) return getImportant(); +} + +/** + * Check if token is part of a hexadecimal number (e.g. `#fff`) inside + * some value + * @param {Number} i Token's index number + * @return {Number} + */ +function checkVhash(i) { + var l; + + if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0; + + return (l = checkNmName2(i + 1)) ? l + 1 : 0; +} + +/** + * Get node with a hexadecimal number (e.g. `#fff`) inside some value + * @return {Array} `['vhash', x]` where `x` is a hexadecimal number + * converted to string (without `#`, e.g. `'fff'`). + */ +function getVhash() { + var type = NodeType.VhashType, + token = tokens[pos], + line = token.ln, + column = token.col, + content; + + pos++; + + content = getNmName2(); + return new Node(type, content, line, column); +} + +module.exports = function(_tokens, rule) { + tokens = _tokens; + tokensLength = tokens.length; + pos = 0; + + return rules[rule](); +}; diff --git a/node_modules/gonzales-pe/lib/css/stringify.js b/node_modules/gonzales-pe/lib/css/stringify.js new file mode 100644 index 0000000..7a1d58b --- /dev/null +++ b/node_modules/gonzales-pe/lib/css/stringify.js @@ -0,0 +1,80 @@ +module.exports = function stringify(tree) { + // TODO: Better error message + if (!tree) throw new Error('We need tree to translate'); + + function _t(tree) { + var type = tree.type; + if (_unique[type]) return _unique[type](tree); + if (typeof tree.content === 'string') return tree.content; + if (Array.isArray(tree.content)) return _composite(tree.content); + return ''; + } + + function _composite(t, i) { + if (!t) return ''; + + var s = ''; + i = i || 0; + for (; i < t.length; i++) s += _t(t[i]); + return s; + } + + var _unique = { + 'arguments': function(t) { + return '(' + _composite(t.content) + ')'; + }, + 'atkeyword': function(t) { + return '@' + _composite(t.content); + }, + 'atruler': function(t) { + return _t(t.content[0]) + _t(t.content[1]) + '{' + _t(t.content[2]) + '}'; + }, + 'attribute': function(t) { + return '[' + _composite(t.content) + ']'; + }, + 'block': function(t) { + return '{' + _composite(t.content) + '}'; + }, + 'braces': function(t) { + return t.content[0] + _composite(t.content.slice(2)) + t.content[1]; + }, + 'class': function(t) { + return '.' + _composite(t.content); + }, + 'color': function(t) { + return '#' + t.content; + }, + 'filter': function(t) { + return _t(t.content[0]) + ':' + _t(t.content[1]); + }, + 'functionExpression': function(t) { + return 'expression(' + t.content + ')'; + }, + 'id': function (t) { + return '#' + t.content; + }, + 'important': function(t) { + return '!' + _composite(t.content) + 'important'; + }, + 'multilineComment': function(t) { + return '/*' + t.content + '*/'; + }, + 'nthSelector': function(t) { + return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; + }, + 'percentage': function(t) { + return _composite(t.content) + '%'; + }, + 'pseudoClass': function(t) { + return ':' + _composite(t.content); + }, + 'pseudoElement': function(t) { + return '::' + _composite(t.content); + }, + 'uri': function(t) { + return 'url(' + _composite(t.content) + ')'; + } + }; + + return _t(tree); +} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/tokenizer.js b/node_modules/gonzales-pe/lib/css/tokenizer.js similarity index 75% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/css/tokenizer.js rename to node_modules/gonzales-pe/lib/css/tokenizer.js index a79ffda..48dc019 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/css/tokenizer.js +++ b/node_modules/gonzales-pe/lib/css/tokenizer.js @@ -4,11 +4,11 @@ module.exports = function(css) { var tokens = [], urlMode = false, blockMode = 0, - c, // current character - cn, // next character pos = 0, tn = 0, - ln = 1; + ln = 1, + col = 1; + var cssLength = 0; var Punctuation = { ' ': TokenType.Space, @@ -52,8 +52,14 @@ module.exports = function(css) { * @param {string} type * @param {string} value */ - function pushToken(type, value) { - tokens.push({ tn: tn++, ln: ln, type: type, value: value }); + function pushToken(type, value, column) { + tokens.push({ + tn: tn++, + ln: ln, + col: column, + type: type, + value: value + }); } /** @@ -73,13 +79,13 @@ module.exports = function(css) { var start = pos; // Read the string until we meet a non-space character: - for (; pos < css.length; pos++) { + for (; pos < cssLength; pos++) { if (css.charAt(pos) !== ' ') break; } // Add a substring containing only spaces to tokens: - pushToken(TokenType.Space, css.substring(start, pos)); - pos--; + pushToken(TokenType.Space, css.substring(start, pos--), col); + col += (pos - start); } /** @@ -91,14 +97,15 @@ module.exports = function(css) { var start = pos; // Read the string until we meet a matching quote: - for (pos = pos + 1; pos < css.length; pos++) { + for (pos++; pos < cssLength; pos++) { // Skip escaped quotes: if (css.charAt(pos) === '\\') pos++; else if (css.charAt(pos) === q) break; } // Add the string (including quotes) to tokens: - pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1)); + pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1), col); + col += (pos - start); } /** @@ -109,13 +116,13 @@ module.exports = function(css) { var start = pos; // Read the string until we meet a character that's not a digit: - for (; pos < css.length; pos++) { + for (; pos < cssLength; pos++) { if (!isDecimalDigit(css.charAt(pos))) break; } // Add the number to tokens: - pushToken(TokenType.DecimalNumber, css.substring(start, pos)); - pos--; + pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col); + col += (pos - start); } /** @@ -129,20 +136,20 @@ module.exports = function(css) { while (css.charAt(pos) === '/') pos++; // Read the string until we meet a punctuation mark: - for (; pos < css.length; pos++) { + for (; pos < cssLength; pos++) { // Skip all '\': if (css.charAt(pos) === '\\') pos++; - else if (css.charAt(pos) in Punctuation) break; + else if (Punctuation[css.charAt(pos)]) break; } - var ident = css.substring(start, pos); + var ident = css.substring(start, pos--); // Enter url mode if parsed substring is `url`: urlMode = urlMode || ident === 'url'; // Add identifier to tokens: - pushToken(TokenType.Identifier, ident); - pos--; + pushToken(TokenType.Identifier, ident, col); + col += (pos - start); } /** @@ -155,7 +162,7 @@ module.exports = function(css) { // Read the string until we meet `*/`. // Since we already know first 2 characters (`/*`), start reading // from `pos + 2`: - for (pos = pos + 2; pos < css.length; pos++) { + for (pos = pos + 2; pos < cssLength; pos++) { if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') { pos++; break; @@ -163,7 +170,16 @@ module.exports = function(css) { } // Add full comment (including `/*` and `*/`) to the list of tokens: - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); + var comment = css.substring(start, pos + 1); + pushToken(TokenType.CommentML, comment, col); + + var newlines = comment.split('\n'); + if (newlines.length > 1) { + ln += newlines.length - 1; + col = newlines[newlines.length - 1].length; + } else { + col += (pos - start); + } } function parseSLComment(css) { @@ -172,15 +188,15 @@ module.exports = function(css) { // Read the string until we meet line break. // Since we already know first 2 characters (`//`), start reading // from `pos + 2`: - for (pos = pos + 2; pos < css.length; pos++) { + for (pos+=2; pos < cssLength; pos++) { if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { break; } } // Add comment (including `//` and line break) to the list of tokens: - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; + pushToken(TokenType.CommentSL, css.substring(start, pos--), col); + col += pos - start; } /** @@ -190,8 +206,13 @@ module.exports = function(css) { * @private */ function getTokens(css) { + var c; // current character + var cn; // next character + + cssLength = css.length; + // Parse string, character by character: - for (pos = 0; pos < css.length; pos++) { + for (pos = 0; pos < cssLength; col++, pos++) { c = css.charAt(pos); cn = css.charAt(pos + 1); @@ -218,17 +239,20 @@ module.exports = function(css) { // If current character is a space: else if (c === ' ') { - parseSpaces(css) + parseSpaces(css); } // If current character is a punctuation mark: - else if (c in Punctuation) { + else if (Punctuation[c]) { // Add it to the list of tokens: - pushToken(Punctuation[c], c); - if (c === '\n' || c === '\r') ln++; // Go to next line - if (c === ')') urlMode = false; // exit url mode - if (c === '{') blockMode++; // enter a block - if (c === '}') blockMode--; // exit a block + pushToken(Punctuation[c], c, col); + if (c === '\n' || c === '\r') { + ln++; + col = 0; + } // Go to next line + else if (c === ')') urlMode = false; // exit url mode + else if (c === '{') blockMode++; // enter a block + else if (c === '}') blockMode--; // exit a block } // If current character is a decimal digit: diff --git a/node_modules/gonzales-pe/lib/gonzales.js b/node_modules/gonzales-pe/lib/gonzales.js new file mode 100644 index 0000000..308f30c --- /dev/null +++ b/node_modules/gonzales-pe/lib/gonzales.js @@ -0,0 +1,9 @@ +var Node = require('./node'); +var parse = require('./parse'); + +module.exports = { + createNode: function(options) { + return new Node(options.type, options.content); + }, + parse: parse +} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/mark.js b/node_modules/gonzales-pe/lib/less/mark.js similarity index 100% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/less/mark.js rename to node_modules/gonzales-pe/lib/less/mark.js diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/rules.js b/node_modules/gonzales-pe/lib/less/parse.js similarity index 78% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/less/rules.js rename to node_modules/gonzales-pe/lib/less/parse.js index bd26b53..8d52082 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/rules.js +++ b/node_modules/gonzales-pe/lib/less/parse.js @@ -1,8 +1,9 @@ +var Node = require('../node'); +var NodeType = require('../node-types'); var TokenType = require('../token-types'); -var NodeType = require('./node-types'); module.exports = (function() { - var tokens, tokensLength, pos; + var tokens, tokensLength, pos, needInfo; var rules = { 'arguments': function() { return checkArguments(pos) && getArguments(); }, @@ -67,7 +68,7 @@ module.exports = (function() { * @param {Number=} i Token's index number */ function throwError(i) { - var ln = i ? tokens[i].ln : tokens[pos].ln; + var ln = tokens[i].ln; throw {line: ln, syntax: 'less'}; } @@ -130,38 +131,44 @@ module.exports = (function() { * @returns {Number} */ function checkAny(i) { - return checkBraces(i) || - checkString(i) || - checkVariablesList(i) || - checkVariable(i) || - checkPercentage(i) || - checkDimension(i) || - checkNumber(i) || - checkUri(i) || - checkFunctionExpression(i) || - checkFunction(i) || - checkIdent(i) || - checkClass(i) || - checkUnary(i); + var l; + + if (l = checkBraces(i)) tokens[i].any_child = 1; + else if (l = checkString(i)) tokens[i].any_child = 2; + else if (l = checkVariablesList(i)) tokens[i].any_child = 3; + else if (l = checkVariable(i)) tokens[i].any_child = 4; + else if (l = checkPercentage(i)) tokens[i].any_child = 5; + else if (l = checkDimension(i)) tokens[i].any_child = 6; + else if (l = checkNumber(i)) tokens[i].any_child = 7; + else if (l = checkUri(i)) tokens[i].any_child = 8; + else if (l = checkFunctionExpression(i)) tokens[i].any_child = 9; + else if (l = checkFunction(i)) tokens[i].any_child = 10; + else if (l = checkIdent(i)) tokens[i].any_child = 11; + else if (l = checkClass(i)) tokens[i].any_child = 12; + else if (l = checkUnary(i)) tokens[i].any_child = 13; + + return l; } /** * @returns {Array} */ function getAny() { - if (checkBraces(pos)) return getBraces(); - else if (checkString(pos)) return getString(); - else if (checkVariablesList(pos)) return getVariablesList(); - else if (checkVariable(pos)) return getVariable(); - else if (checkPercentage(pos)) return getPercentage(); - else if (checkDimension(pos)) return getDimension(); - else if (checkNumber(pos)) return getNumber(); - else if (checkUri(pos)) return getUri(); - else if (checkFunctionExpression(pos)) return getFunctionExpression(); - else if (checkFunction(pos)) return getFunction(); - else if (checkIdent(pos)) return getIdent(); - else if (checkClass(pos)) return getClass(); - else if (checkUnary(pos)) return getUnary(); + var childType = tokens[pos].any_child; + + if (childType === 1) return getBraces(); + if (childType === 2) return getString(); + if (childType === 3) return getVariablesList(); + if (childType === 4) return getVariable(); + if (childType === 5) return getPercentage(); + if (childType === 6) return getDimension(); + if (childType === 7) return getNumber(); + if (childType === 8) return getUri(); + if (childType === 9) return getFunctionExpression(); + if (childType === 10) return getFunction(); + if (childType === 11) return getIdent(); + if (childType === 12) return getClass(); + if (childType === 13) return getUnary(); } /** @@ -190,44 +197,52 @@ module.exports = (function() { * @returns {Number} */ function checkArgument(i) { - return checkDeclaration(i) || - checkVariablesList(i) || - checkVariable(i) || - checkSC(i) || - checkUnary(i) || - checkOperator(i) || - checkDelim(i) || - checkDeclDelim(i) || - checkString(i) || - checkPercentage(i) || - checkDimension(i) || - checkNumber(i) || - checkUri(i) || - checkFunction(i) || - checkIdent(i) || - checkVhash(i); + var l; + + if (l = checkEscapedString(i)) tokens[i].argument_child = 1; + else if (l = checkDeclaration(i)) tokens[i].argument_child = 2; + else if (l = checkVariablesList(i)) tokens[i].argument_child = 3; + else if (l = checkVariable(i)) tokens[i].argument_child = 4; + else if (l = checkSC(i)) tokens[i].argument_child = 5; + else if (l = checkUnary(i)) tokens[i].argument_child = 6; + else if (l = checkOperator(i)) tokens[i].argument_child = 7; + else if (l = checkDelim(i)) tokens[i].argument_child = 8; + else if (l = checkDeclDelim(i)) tokens[i].argument_child = 9; + else if (l = checkString(i)) tokens[i].argument_child = 10; + else if (l = checkPercentage(i)) tokens[i].argument_child = 11; + else if (l = checkDimension(i)) tokens[i].argument_child = 12; + else if (l = checkNumber(i)) tokens[i].argument_child = 13; + else if (l = checkUri(i)) tokens[i].argument_child = 14; + else if (l = checkFunction(i)) tokens[i].argument_child = 15; + else if (l = checkIdent(i)) tokens[i].argument_child = 16; + else if (l = checkVhash(i)) tokens[i].argument_child = 17; + + return l; } /** * @returns {Array} Node that is part of arguments list. */ function getArgument() { - if (checkDeclaration(pos)) return getDeclaration(); - if (checkVariablesList(pos)) return getVariablesList(); - if (checkVariable(pos)) return getVariable(); - if (checkSC(pos)) return getSC(); - if (checkUnary(pos)) return getUnary(); - if (checkOperator(pos)) return getOperator(); - if (checkDelim(pos)) return getDelim(); - if (checkDeclDelim(pos)) return getDeclDelim(); - if (checkString(pos)) return getString(); - if (checkPercentage(pos)) return getPercentage(); - if (checkDimension(pos)) return getDimension(); - if (checkNumber(pos)) return getNumber(); - if (checkUri(pos)) return getUri(); - if (checkFunction(pos)) return getFunction(); - if (checkIdent(pos)) return getIdent(); - if (checkVhash(pos)) return getVhash(); + var childType = tokens[pos].argument_child; + + if (childType === 1) return getEscapedString(); + if (childType === 2) return getDeclaration(); + if (childType === 3) return getVariablesList(); + if (childType === 4) return getVariable(); + if (childType === 5) return getSC(); + if (childType === 6) return getUnary(); + if (childType === 7) return getOperator(); + if (childType === 8) return getDelim(); + if (childType === 9) return getDeclDelim(); + if (childType === 10) return getString(); + if (childType === 11) return getPercentage(); + if (childType === 12) return getDimension(); + if (childType === 13) return getNumber(); + if (childType === 14) return getUri(); + if (childType === 15) return getFunction(); + if (childType === 16) return getIdent(); + if (childType === 17) return getVhash(); } /** @@ -253,13 +268,10 @@ module.exports = (function() { */ function getAtkeyword() { var startPos = pos, - x; + token = tokens[pos++], + content = [getIdent()]; - pos++; - - x = [NodeType.AtkeywordType, getIdent()]; - - return x; + return new Node(NodeType.AtkeywordType, content, token.ln, token.col); } /** @@ -325,12 +337,8 @@ module.exports = (function() { * value */ function getAttrib1() { - var startPos = pos, - x; - - pos++; - - x = [NodeType.AttribType] + var startPos = pos++; + var content = [] .concat(getSC()) .concat([getIdent()]) .concat(getSC()) @@ -341,7 +349,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttribType, content, token.ln, token.col); } /** @@ -371,19 +380,16 @@ module.exports = (function() { * @returns {Array} `['attrib', ['ident', x]]` where `x` is attribute's name */ function getAttrib2() { - var startPos = pos, - x; - - pos++; - - x = [NodeType.AttribType] + var startPos = pos++; + var content = [] .concat(getSC()) .concat([getIdent()]) .concat(getSC()); pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttribType, content, token.ln, token.col); } /** @@ -424,14 +430,13 @@ module.exports = (function() { */ function getAttrselector() { var startPos = pos, - s = tokens[pos++].value, - x; - - if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) s += tokens[pos++].value; + content = tokens[pos++].value; - x = [NodeType.AttrselectorType, s]; + if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) + content += tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttrselectorType, content, token.ln, token.col); } /** @@ -499,14 +504,13 @@ module.exports = (function() { * @returns {Array} `['atruleb', ['atkeyword', x], y, ['block', z]]` */ function getAtruleb() { - var startPos = pos, - x; - - x = [NodeType.AtrulebType, getAtkeyword()] + var startPos = pos; + var content = [getAtkeyword()] .concat(getTsets()) .concat([getBlock()]); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulebType, content, token.ln, token.col); } /** @@ -541,18 +545,17 @@ module.exports = (function() { * @returns {Array} ['atruler', ['atkeyword', x], y, z] */ function getAtruler() { - var startPos = pos, - x; - - x = [NodeType.AtrulerType, getAtkeyword(), getAtrulerq()]; + var startPos = pos; + var content = [getAtkeyword(), getAtrulerq()]; pos++; - x.push(getAtrulers()); + content.push(getAtrulers()); pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulerType, content, token.ln, token.col); } /** @@ -568,11 +571,10 @@ module.exports = (function() { */ function getAtrulerq() { var startPos = pos, - x; + content = getTsets(); - x = [NodeType.AtrulerqType].concat(getTsets()); - - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulerqType, content, token.ln, token.col); } /** @@ -587,7 +589,11 @@ module.exports = (function() { if (l = checkSC(i)) i += l; - while (l = checkRuleset(i) || checkAtrule(i) || checkSC(i)) { + while (i < tokensLength) { + if (l = checkSC(i)) tokens[i].atrulers_child = 1; + else if (l = checkAtrule(i)) tokens[i].atrulers_child = 2; + else if (l = checkRuleset(i)) tokens[i].atrulers_child = 3; + else break; i += l; } @@ -603,19 +609,19 @@ module.exports = (function() { */ function getAtrulers() { var startPos = pos, - x; - - x = [NodeType.AtrulersType].concat(getSC()); + content = getSC(); while (!tokens[pos].atrulers_end) { - if (checkSC(pos)) x = x.concat(getSC()); - else if (checkAtrule(pos)) x.push(getAtrule()); - else if (checkRuleset(pos)) x.push(getRuleset()); + var childType = tokens[pos].atrulers_child; + if (childType === 1) content = content.concat(getSC()); + else if (childType === 2) content.push(getAtrule()); + else if (childType === 3) content.push(getRuleset()); } - x = x.concat(getSC()); + content = content.concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulersType, content, token.ln, token.col); } /** @@ -641,11 +647,10 @@ module.exports = (function() { */ function getAtrules() { var startPos = pos, - x; - - x = [NodeType.AtrulesType, getAtkeyword()].concat(getTsets()); + content = [getAtkeyword()].concat(getTsets()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulesType, content, token.ln, token.col); } /** @@ -664,20 +669,18 @@ module.exports = (function() { */ function getBlock() { var startPos = pos, - end = tokens[pos].right, - x = [NodeType.BlockType]; - - pos++; - + end = tokens[pos++].right, + content = []; while (pos < end) { - if (checkBlockdecl(pos)) x = x.concat(getBlockdecl()); - else throwError(); + if (checkBlockdecl(pos)) content = content.concat(getBlockdecl()); + else throwError(pos); } pos = end + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.BlockType, content, token.ln, token.col); } /** @@ -900,19 +903,15 @@ module.exports = (function() { function getBraces() { var startPos = pos, left = pos, - right = tokens[pos].right, - x; + right = tokens[pos++].right; - pos++; - - var tsets = getTsets(); + var content = [tokens[left].value, tokens[right].value] + .concat(getTsets()); pos++; - x = [NodeType.BracesType, tokens[left].value, tokens[right].value] - .concat(tsets); - - return x; + var token = tokens[startPos]; + return new Node(NodeType.BracesType, content, token.ln, token.col); } /** @@ -927,8 +926,11 @@ module.exports = (function() { if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && - (l = checkInterpolatedVariable(i) || checkIdent(i))) { + if (tokens[i++].type === TokenType.FullStop) { + if (l = checkInterpolatedVariable(i)) tokens[i].class_child = 1; + else if (l = checkIdent(i)) tokens[i].class_child = 2; + else return 0; + tokens[i].class_l = l + 1; return l + 1; } @@ -942,14 +944,15 @@ module.exports = (function() { * identifier (without `.`, e.g. `abc`). */ function getClass() { - var startPos = pos, - x = [NodeType.ClassType]; - - pos++; + var startPos = pos++; + var content = []; - x.push(checkInterpolatedVariable(pos) ? getInterpolatedVariable() : getIdent()); + var childType = tokens[pos].class_child; + if (childType === 1) content.push(getInterpolatedVariable()); + else content.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ClassType, content, token.ln, token.col); } /** @@ -977,11 +980,10 @@ module.exports = (function() { */ function getCombinator() { var startPos = pos, - x; - - x = [NodeType.CombinatorType, tokens[pos++].value]; + content = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.CombinatorType, content, token.ln, token.col); } /** @@ -1001,16 +1003,15 @@ module.exports = (function() { function getCommentML() { var startPos = pos, s = tokens[pos].value.substring(2), - l = s.length, - x; + l = s.length; - if (s.charAt(l - 2) === '*' && s.charAt(l - 1) === '/') s = s.substring(0, l - 2); + if (s.charAt(l - 2) === '*' && s.charAt(l - 1) === '/') + s = s.substring(0, l - 2); pos++; - x = [NodeType.CommentMLType, s]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.CommentMLType, s, token.ln, token.col); } /** @@ -1028,11 +1029,10 @@ module.exports = (function() { */ function getCommentSL() { var startPos = pos, - x; - - x = [NodeType.CommentSLType, tokens[pos++].value.substring(2)]; + x = tokens[pos++].value.substring(2); - return x; + var token = tokens[startPos]; + return new Node(NodeType.CommentSLType, x, token.ln, token.col); } /** @@ -1050,18 +1050,22 @@ module.exports = (function() { else return 0; while (i < tokensLength) { - if (l = checkBlock(i)) break; - if (l = checkFunction(i) | - checkBraces(i) || - checkVariable(i) || - checkIdent(i) || - checkSC(i) || - checkNumber(i) || - checkDelim(i) || - checkOperator(i) || - checkCombinator(i) || - checkString(i)) i += l; + if (l = checkBlock(i)) { + tokens[i].condition_child = 0; + break; + } else if (l = checkFunction(i)) tokens[i].condition_child = 1; + else if (l = checkBraces(i)) tokens[i].condition_child = 2; + else if (l = checkVariable(i)) tokens[i].condition_child = 3; + else if (l = checkIdent(i)) tokens[i].condition_child = 4; + else if (l = checkNumber(i)) tokens[i].condition_child = 5; + else if (l = checkDelim(i)) tokens[i].condition_child = 6; + else if (l = checkOperator(i)) tokens[i].condition_child = 7; + else if (l = checkCombinator(i)) tokens[i].condition_child = 8; + else if (l = checkSC(i)) tokens[i].condition_child = 9; + else if (l = checkString(i)) tokens[i].condition_child = 10; else return 0; + + i += l; } return i - start; @@ -1073,25 +1077,28 @@ module.exports = (function() { */ function getCondition() { var startPos = pos, - x = [NodeType.ConditionType]; + x = []; x.push(getIdent()); while (pos < tokensLength) { - if (checkBlock(pos)) break; - else if (checkFunction(pos)) x.push(getFunction()); - else if (checkBraces(pos)) x.push(getBraces()); - else if (checkVariable(pos)) x.push(getVariable()); - else if (checkIdent(pos)) x.push(getIdent()); - else if (checkNumber(pos)) x.push(getNumber()); - else if (checkDelim(pos)) x.push(getDelim()); - else if (checkOperator(pos)) x.push(getOperator()); - else if (checkCombinator(pos)) x.push(getCombinator()); - else if (checkSC(pos)) x = x.concat(getSC()); - else if (checkString(pos)) x.push(getString()); + var childType = tokens[pos].condition_child; + + if (childType === 0) break; + else if (childType === 1) x.push(getFunction()); + else if (childType === 2) x.push(getBraces()); + else if (childType === 3) x.push(getVariable()); + else if (childType === 4) x.push(getIdent()); + else if (childType === 5) x.push(getNumber()); + else if (childType === 6) x.push(getDelim()); + else if (childType === 7) x.push(getOperator()); + else if (childType === 8) x.push(getCombinator()); + else if (childType === 9) x = x.concat(getSC()); + else if (childType === 10) x.push(getString()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ConditionType, x, token.ln, token.col); } /** @@ -1127,16 +1134,15 @@ module.exports = (function() { * ['value', y]]` */ function getDeclaration() { - var startPos = pos, - x = [NodeType.DeclarationType]; - - x.push(getProperty()); - x = x.concat(getSC()); - x.push(getPropertyDelim()); - x = x.concat(getSC()); - x.push(getValue()); + var startPos = pos; + var x = [getProperty()] + .concat(getSC()) + .concat([getPropertyDelim()]) + .concat(getSC()) + .concat([getValue()]); - return x; + var token = tokens[startPos]; + return new Node(NodeType.DeclarationType, x, token.ln, token.col); } /** @@ -1153,12 +1159,26 @@ module.exports = (function() { * @returns {Array} `['declDelim']` */ function getDeclDelim() { - var startPos = pos, - x = [NodeType.DeclDelimType]; + var startPos = pos++; - pos++; + var token = tokens[startPos]; + return new Node(NodeType.DeclDelimType, ';', token.ln, token.col); + } - return x; + function checkDeepSelector(i) { + if (tokens[i + 2] && + tokens[i].value + tokens[i + 1].value + tokens[i + 2].value === '/deep/') { + return 3; + } + } + + function getDeepSelector() { + var _pos = pos++; + var ident = getIdent(); + ident.content = '/deep/'; + ident.start.column -= 1; + pos = _pos + 3; + return ident; } /** @@ -1175,12 +1195,10 @@ module.exports = (function() { * @returns {Array} `['delim']` */ function getDelim() { - var startPos = pos, - x = [NodeType.DelimType]; + var startPos = pos++; - pos++; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.DelimType, ',', token.ln, token.col); } /** @@ -1207,12 +1225,14 @@ module.exports = (function() { */ function getDimension() { var startPos = pos, - x = [NodeType.DimensionType, getNumber()], - ident = [NodeType.IdentType, getNmName2()]; + x = [getNumber()], + token = tokens[pos]; + ident = new Node(NodeType.IdentType, getNmName2(), token.ln, token.col); x.push(ident); - return x; + token = tokens[startPos]; + return new Node(NodeType.DimensionType, x, token.ln, token.col); } /** @@ -1226,7 +1246,8 @@ module.exports = (function() { if (i >= tokensLength) return 0; - if (tokens[i].type === TokenType.Tilde && (l = checkString(i + 1))) return i + l - start; + if (tokens[i].type === TokenType.Tilde && (l = checkString(i + 1))) + return i + l - start; else return 0; } @@ -1236,14 +1257,11 @@ module.exports = (function() { * without `~` but with quotes */ function getEscapedString() { - var startPos = pos, - x = [NodeType.EscapedStringType]; - - pos++; + var startPos = pos++; + var x = tokens[pos++].value; - x.push(tokens[pos++].value); - - return x; + var token = tokens[startPos]; + return new Node(NodeType.EscapedStringType, x, token.ln, token.col); } /** @@ -1273,13 +1291,14 @@ module.exports = (function() { */ function getFilter() { var startPos = pos, - x = [NodeType.FilterType, getFilterp()]; + x = [getFilterp()]; pos++; x.push(getFilterv()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.FilterType, x, token.ln, token.col); } /** @@ -1320,14 +1339,17 @@ module.exports = (function() { */ function getFilterp() { var startPos = pos, - ident = [NodeType.IdentType, joinValues2(pos, tokens[pos].filterp_l)], + token = tokens[startPos], x; + var identValue = joinValues2(pos, token.filterp_l); + ident = new Node(NodeType.IdentType, identValue, token.ln, token.col); + pos += tokens[pos].filterp_l; - x = [NodeType.PropertyType, ident].concat(getSC()); + x = [ident].concat(getSC()); - return x; + return new Node(NodeType.PropertyType, x, token.ln, token.col); } /** @@ -1364,10 +1386,8 @@ module.exports = (function() { */ function getFilterv() { var startPos = pos, - x = [NodeType.FiltervType], - last_progid = tokens[pos].last_progid; - - x = x.concat(getSC()); + last_progid = tokens[pos].last_progid, + x = getSC(); while (pos < last_progid) { x.push(checkProgid(pos) ? getProgid() : getEscapedString()); @@ -1377,7 +1397,8 @@ module.exports = (function() { if (pos < tokensLength && checkImportant(pos)) x.push(getImportant()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.FiltervType, x, token.ln, token.col); } /** @@ -1397,18 +1418,15 @@ module.exports = (function() { * @returns {Array} */ function getFunctionExpression() { - var startPos = pos, - x, e; - - pos++; + var startPos = pos++, + x; - e = joinValues(pos + 1, tokens[pos].right - 1); + x = joinValues(pos + 1, tokens[pos].right - 1); pos = tokens[pos].right + 1; - x = [NodeType.FunctionExpressionType, e]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.FunctionExpressionType, [x], token.ln, token.col); } /** @@ -1433,15 +1451,16 @@ module.exports = (function() { */ function getFunction() { var startPos = pos, + token = tokens[pos], ident = getIdent(), - x = [NodeType.FunctionType, ident], + x = [ident], body; - body = ident[1] === 'not' ? getNotArguments() : getArguments(); + body = ident.content === 'not' ? getNotArguments() : getArguments(); x.push(body); - return x; + return new Node(NodeType.FunctionType, x, token.ln, token.col); } /** @@ -1449,7 +1468,7 @@ module.exports = (function() { */ function getArguments() { var startPos = pos, - x = [NodeType.ArgumentsType], + x = [], body; pos++; @@ -1458,34 +1477,34 @@ module.exports = (function() { if (checkDeclaration(pos)) x.push(getDeclaration()); else if (checkArgument(pos)) { body = getArgument(); - if (typeof body[0] === 'string') x.push(body); + if (typeof body.content === 'string') x.push(body); else x = x.concat(body); } else if (checkClass(pos)) x.push(getClass()); - else throwError(); + else throwError(pos); } pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ArgumentsType, x, token.ln, token.col); } /** * @returns {Array} */ function getNotArguments() { - var startPos = pos, - x = [NodeType.ArgumentsType]; - - pos++; + var startPos = pos++, + x = []; while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) { if (checkSimpleSelector(pos)) x.push(getSimpleSelector()); - else throwError(); + else throwError(pos); } pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ArgumentsType, x, token.ln, token.col); } /** @@ -1562,11 +1581,12 @@ module.exports = (function() { */ function getIdent() { var startPos = pos, - x = [NodeType.IdentType, joinValues(pos, tokens[pos].ident_last)]; + x = joinValues(pos, tokens[pos].ident_last); pos = tokens[pos].ident_last + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.IdentType, x, token.ln, token.col); } /** @@ -1591,16 +1611,14 @@ module.exports = (function() { * @returns {Array} `['important', sc]` where `sc` is optional whitespace */ function getImportant() { - var startPos = pos, - x = [NodeType.ImportantType]; - - pos++; - - x = x.concat(getSC()); + var startPos = pos++, + x = getSC(); + if (!x || !x.length) x = ''; pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ImportantType, x, token.ln, token.col); } /** @@ -1662,7 +1680,7 @@ module.exports = (function() { */ function getInclude1() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(checkClass(pos) ? getClass() : getShash()); @@ -1680,7 +1698,8 @@ module.exports = (function() { if (checkImportant(pos)) x.push(getImportant()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1708,7 +1727,7 @@ module.exports = (function() { */ function getInclude2() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(checkClass(pos) ? getClass() : getShash()); @@ -1720,7 +1739,8 @@ module.exports = (function() { else break; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1744,17 +1764,18 @@ module.exports = (function() { */ function getIncludeSelector() { var startPos = pos, - x = [NodeType.SimpleselectorType], + x = [], t; while (pos < tokensLength && checkSimpleSelector2(pos)) { t = getSimpleSelector2(); - if (typeof t[0] === 'string') x.push(t); + if (t.content === 'string') x.push(t); else x = x.concat(t); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SimpleselectorType, x, token.ln, token.col); } /** @@ -1785,7 +1806,7 @@ module.exports = (function() { */ function getInterpolatedVariable() { var startPos = pos, - x = [NodeType.InterpolatedVariableType]; + x = []; // Skip `@{`: pos += 2; @@ -1795,7 +1816,8 @@ module.exports = (function() { // Skip `}`: pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.InterpolatedVariableType, x, token.ln, token.col); } /** @@ -1830,7 +1852,7 @@ module.exports = (function() { */ function getMixin() { var startPos = pos, - x = [NodeType.MixinType]; + x = []; x.push(checkClass(pos) ? getClass() : getShash()); @@ -1842,7 +1864,8 @@ module.exports = (function() { if (checkBlock(pos)) x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.MixinType, x, token.ln, token.col); } /** @@ -1859,12 +1882,10 @@ module.exports = (function() { * @returns {Array} `['namespace']` */ function getNamespace() { - var startPos = pos, - x = [NodeType.NamespaceType]; - - pos++; + var startPos = pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.NamespaceType, '|', token.ln, token.col); } /** @@ -1968,16 +1989,17 @@ module.exports = (function() { */ function getNth() { var startPos = pos, - x = [NodeType.NthType]; + x; if (tokens[pos].nth_last) { - x.push(joinValues(pos, tokens[pos].nth_last)); + x = joinValues(pos, tokens[pos].nth_last); pos = tokens[pos].nth_last + 1; } else { - x.push(tokens[pos++].value); + x = tokens[pos++].value; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.NthType, x, token.ln, token.col); } /** @@ -2077,8 +2099,9 @@ module.exports = (function() { */ function getNthselector() { var startPos = pos, - nthf = [NodeType.IdentType, getNthf()], - x = [NodeType.NthselectorType]; + token = tokens[pos], + nthf = new Node(NodeType.IdentType, getNthf(), token.ln, token.col), + x = []; x.push(nthf); @@ -2092,7 +2115,7 @@ module.exports = (function() { pos++; - return x; + return new Node(NodeType.NthselectorType, x, token.ln, token.col); } /** @@ -2140,20 +2163,18 @@ module.exports = (function() { * to string. */ function getNumber() { - var s = '', + var x = '', startPos = pos, - l = tokens[pos].number_l, - x = [NodeType.NumberType]; + l = tokens[pos].number_l; for (var j = 0; j < l; j++) { - s += tokens[pos + j].value; + x += tokens[pos + j].value; } pos += l; - x.push(s); - - return x; + var token = tokens[startPos]; + return new Node(NodeType.NumberType, x, token.ln, token.col); } /** @@ -2185,9 +2206,10 @@ module.exports = (function() { */ function getOperator() { var startPos = pos, - x = [NodeType.OperatorType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.OperatorType, x, token.ln, token.col); } /** @@ -2204,12 +2226,10 @@ module.exports = (function() { * @returns {Array} `['parentSelector']` */ function getParentSelector() { - var startPos = pos, - x = [NodeType.ParentSelectorType, '&']; - - pos++; + var startPos = pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ParentSelectorType, '&', token.ln, token.col); } /** @@ -2236,11 +2256,12 @@ module.exports = (function() { */ function getPercentage() { var startPos = pos, - x = [NodeType.PercentageType, getNumber()]; + x = getNumber(); pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.PercentageType, x, token.ln, token.col); } /** @@ -2281,12 +2302,13 @@ module.exports = (function() { progid_end = tokens[pos].progid_end, x; - x = [NodeType.ProgidType] + x = [] .concat(getSC()) .concat([_getProgid(progid_end)]) .concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ProgidType, x, token.ln, token.col); } /** @@ -2295,11 +2317,12 @@ module.exports = (function() { */ function _getProgid(progid_end) { var startPos = pos, - x = [NodeType.RawType, joinValues(pos, progid_end)]; + x = joinValues(pos, progid_end); pos = progid_end + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.RawType, x, token.ln, token.col); } /** @@ -2325,12 +2348,13 @@ module.exports = (function() { */ function getProperty() { var startPos = pos, - x = [NodeType.PropertyType]; + x = []; if (checkVariable(pos)) x.push(getVariable()); else x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PropertyType, x, token.ln, token.col); } /** @@ -2347,12 +2371,10 @@ module.exports = (function() { * @returns {Array} `['propertyDelim']` */ function getPropertyDelim() { - var startPos = pos, - x = [NodeType.PropertyDelimType]; + var startPos = pos++; - pos++; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.PropertyDelimType, ':', token.ln, token.col); } /** @@ -2390,13 +2412,14 @@ module.exports = (function() { */ function getPseudoe() { var startPos = pos, - x = [NodeType.PseudoeType]; + x = []; pos += 2; x.push(checkInterpolatedVariable(pos) ? getInterpolatedVariable() : getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PseudoeType, x, token.ln, token.col); } /** @@ -2416,7 +2439,7 @@ module.exports = (function() { */ function getPseudoc() { var startPos = pos, - x = [NodeType.PseudocType]; + x = []; pos ++; @@ -2424,7 +2447,8 @@ module.exports = (function() { else if (checkFunction(pos)) x.push(getFunction()); else x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PseudocType, x, token.ln, token.col); } /** @@ -2455,7 +2479,7 @@ module.exports = (function() { */ function getRuleset() { var startPos = pos, - x = [NodeType.RulesetType]; + x = []; while (pos < tokensLength) { if (checkBlock(pos)) {x.push(getBlock()); break;} @@ -2463,7 +2487,8 @@ module.exports = (function() { else break; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.RulesetType, x, token.ln, token.col); } /** @@ -2482,11 +2507,12 @@ module.exports = (function() { */ function getS() { var startPos = pos, - x = [NodeType.SType, joinValues(pos, tokens[pos].ws_last)]; + x = joinValues(pos, tokens[pos].ws_last); pos = tokens[pos].ws_last + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.SType, x, token.ln, token.col); } /** @@ -2562,14 +2588,15 @@ module.exports = (function() { */ function getSelector() { var startPos = pos, - x = [NodeType.SelectorType], + x = [], selector_end = tokens[pos].selector_end; while (pos <= selector_end) { x.push(checkDelim(pos) ? getDelim() : getSimpleSelector()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SelectorType, x, token.ln, token.col); } /** @@ -2594,13 +2621,14 @@ module.exports = (function() { */ function getShash() { var startPos = pos, - x = [NodeType.ShashType]; + x = []; pos++; x.push(getNmName()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ShashType, x, token.ln, token.col); } /** @@ -2624,18 +2652,19 @@ module.exports = (function() { */ function getSimpleSelector() { var startPos = pos, - x = [NodeType.SimpleselectorType], + x = [], t; while (pos < tokensLength) { if (!checkSimpleSelector1(pos)) break; t = getSimpleSelector1(); - if (typeof t[0] === 'string') x.push(t); + if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); else x = x.concat(t); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SimpleselectorType, x, token.ln, token.col); } /** @@ -2643,30 +2672,37 @@ module.exports = (function() { * @returns {Number} */ function checkSimpleSelector1(i) { - return checkParentSelector(i) || - checkNthselector(i) || - checkCombinator(i) || - checkAttrib(i) || - checkPseudo(i) || - checkShash(i) || - checkAny(i) || - checkSC(i) || - checkNamespace(i); + var l; + + if (l = checkParentSelector(i)) tokens[i].simpleselector1_child = 1; + else if (l = checkNthselector(i)) tokens[i].simpleselector1_child = 2; + else if (l = checkCombinator(i)) tokens[i].simpleselector1_child = 3; + else if (l = checkAttrib(i)) tokens[i].simpleselector1_child = 4; + else if (l = checkPseudo(i)) tokens[i].simpleselector1_child = 5; + else if (l = checkShash(i)) tokens[i].simpleselector1_child = 6; + else if (l = checkAny(i)) tokens[i].simpleselector1_child = 7; + else if (l = checkSC(i)) tokens[i].simpleselector1_child = 8; + else if (l = checkNamespace(i)) tokens[i].simpleselector1_child = 9; + else if (l = checkDeepSelector(i)) tokens[i].simpleselector1_child = 10; + + return l; } /** * @returns {Array} */ function getSimpleSelector1() { - if (checkParentSelector(pos)) return getParentSelector(); - else if (checkNthselector(pos)) return getNthselector(); - else if (checkCombinator(pos)) return getCombinator(); - else if (checkAttrib(pos)) return getAttrib(); - else if (checkPseudo(pos)) return getPseudo(); - else if (checkShash(pos)) return getShash(); - else if (checkAny(pos)) return getAny(); - else if (checkSC(pos)) return getSC(); - else if (checkNamespace(pos)) return getNamespace(); + var childType = tokens[pos].simpleselector1_child; + if (childType === 1) return getParentSelector(); + else if (childType === 2) return getNthselector(); + else if (childType === 3) return getCombinator(); + else if (childType === 4) return getAttrib(); + else if (childType === 5) return getPseudo(); + else if (childType === 6) return getShash(); + else if (childType === 7) return getAny(); + else if (childType === 8) return getSC(); + else if (childType === 9) return getNamespace(); + else if (childType === 10) return getDeepSelector(); } /** @@ -2712,9 +2748,10 @@ module.exports = (function() { */ function getString() { var startPos = pos, - x = [NodeType.StringType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.StringType, x, token.ln, token.col); } /** @@ -2749,7 +2786,7 @@ module.exports = (function() { */ function getStylesheet() { var startPos = pos, - x = [NodeType.StylesheetType]; + x = []; while (pos < tokensLength) { if (checkSC(pos)) x = x.concat(getSC()); @@ -2759,10 +2796,11 @@ module.exports = (function() { else if (checkMixin(pos)) x.push(getMixin()); else if (checkDeclaration(pos)) x.push(getDeclaration()); else if (checkDeclDelim(pos)) x.push(getDeclDelim()); - else throwError(); + else throwError(pos); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.StylesheetType, x, token.ln, token.col); } /** @@ -2811,7 +2849,7 @@ module.exports = (function() { t; while (t = getTset()) { - if (typeof t[0] === 'string') x.push(t); + if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); else x = x.concat(t); } @@ -2834,9 +2872,10 @@ module.exports = (function() { */ function getUnary() { var startPos = pos, - x = [NodeType.UnaryType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.UnaryType, x, token.ln, token.col); } /** @@ -2852,9 +2891,10 @@ module.exports = (function() { */ function getUnknown() { var startPos = pos, - x = [NodeType.UnknownType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.UnknownType, x, token.ln, token.col); } /** @@ -2881,6 +2921,7 @@ module.exports = (function() { var startPos = pos, uriExcluding = {}, uri, + token, l, raw; @@ -2893,16 +2934,17 @@ module.exports = (function() { uriExcluding[TokenType.RightParenthesis] = 1; if (checkUri1(pos)) { - uri = [NodeType.UriType] + uri = [] .concat(getSC()) .concat([getString()]) .concat(getSC()); pos++; } else { - uri = [NodeType.UriType].concat(getSC()), + uri = getSC(), l = checkExcluding(uriExcluding, pos), - raw = [NodeType.RawType, joinValues(pos, pos + l)]; + token = tokens[pos]; + raw = new Node(NodeType.RawType, joinValues (pos, pos + l), token.ln, token.col); uri.push(raw); @@ -2913,7 +2955,8 @@ module.exports = (function() { pos++; } - return uri; + token = tokens[startPos]; + return new Node(NodeType.UriType, uri, token.ln, token.col); } /** @@ -2978,7 +3021,7 @@ module.exports = (function() { */ function getValue() { var startPos = pos, - x = [NodeType.ValueType], + x = [], s, _pos; while (pos < tokensLength) { @@ -2991,7 +3034,8 @@ module.exports = (function() { x.push(_getValue()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ValueType, x, token.ln, token.col); } /** @@ -3034,14 +3078,15 @@ module.exports = (function() { */ function getVariable() { var startPos = pos, - x = [NodeType.VariableType]; + x = []; pos++; if (checkVariable(pos)) x.push(getVariable()); else x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.VariableType, x, token.ln, token.col); } /** @@ -3073,11 +3118,12 @@ module.exports = (function() { */ function getVariablesList() { var startPos = pos, - x = [NodeType.VariablesListType, getVariable()]; + x = [getVariable()]; pos += 3; - return x; + var token = tokens[startPos]; + return new Node(NodeType.VariablesListType, x, token.ln, token.col); } /** @@ -3101,17 +3147,19 @@ module.exports = (function() { */ function getVhash() { var startPos = pos, - x = [NodeType.VhashType]; + x; pos++; - x.push(getNmName2()); + x = getNmName2(); - return x; + var token = tokens[startPos]; + return new Node(NodeType.VhashType, x, token.ln, token.col); } - return function(_tokens, rule) { + return function(_tokens, rule, _needInfo) { tokens = _tokens; + needInfo = _needInfo; tokensLength = tokens.length; pos = 0; diff --git a/node_modules/gonzales-pe/lib/less/stringify.js b/node_modules/gonzales-pe/lib/less/stringify.js new file mode 100644 index 0000000..2d008d3 --- /dev/null +++ b/node_modules/gonzales-pe/lib/less/stringify.js @@ -0,0 +1,95 @@ +module.exports = function stringify(tree) { + // TODO: Better error message + if (!tree) throw new Error('We need tree to translate'); + + function _t(tree) { + var type = tree.type; + if (_unique[type]) return _unique[type](tree); + if (typeof tree.content === 'string') return tree.content; + if (Array.isArray(tree.content)) return _composite(tree.content); + return ''; + } + + function _composite(t, i) { + if (!t) return ''; + + var s = ''; + i = i || 0; + for (; i < t.length; i++) s += _t(t[i]); + return s; + } + + var _unique = { + 'arguments': function(t) { + return '(' + _composite(t.content) + ')'; + }, + 'atkeyword': function(t) { + return '@' + _composite(t.content); + }, + 'atruler': function(t) { + return _t(t.content[0]) + _t(t.content[1]) + '{' + _t(t.content[2]) + '}'; + }, + 'attribute': function(t) { + return '[' + _composite(t.content) + ']'; + }, + 'block': function(t) { + return '{' + _composite(t.content) + '}'; + }, + 'braces': function(t) { + return t.content[0] + _composite(t.content.slice(2)) + t.content[1]; + }, + 'class': function(t) { + return '.' + _composite(t.content); + }, + 'color': function(t) { + return '#' + t.content; + }, + 'escapedString': function(t) { + return '~' + t.content; + }, + 'filter': function(t) { + return _t(t.content[0]) + ':' + _t(t.content[1]); + }, + 'functionExpression': function(t) { + return 'expression(' + t.content + ')'; + }, + 'id': function (t) { + return '#' + t.content; + }, + 'important': function(t) { + return '!' + _composite(t.content) + 'important'; + }, + 'interpolatedVariable': function(t) { + return '@{' + _composite(t.content) + '}'; + }, + 'multilineComment': function (t) { + return '/*' + t.content + '*/'; + }, + 'nthSelector': function(t) { + return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; + }, + 'percentage': function(t) { + return _t(t.content) + '%'; + }, + 'pseudoClass': function(t) { + return ':' + _composite(t.content); + }, + 'pseudoElement': function(t) { + return '::' + _composite(t.content); + }, + 'singlelineComment': function (t) { + return '/' + '/' + t.content; + }, + 'uri': function(t) { + return 'url(' + _composite(t.content) + ')'; + }, + 'variable': function(t) { + return '@' + _composite(t.content); + }, + 'variablesList': function(t) { + return _composite(t.content) + '...'; + } + }; + + return _t(tree); +} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/tokenizer.js b/node_modules/gonzales-pe/lib/less/tokenizer.js similarity index 83% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/scss/tokenizer.js rename to node_modules/gonzales-pe/lib/less/tokenizer.js index e67d138..cdaedbb 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/tokenizer.js +++ b/node_modules/gonzales-pe/lib/less/tokenizer.js @@ -8,7 +8,8 @@ module.exports = function(css) { cn, // next character pos = 0, tn = 0, - ln = 1; + ln = 1, + col = 1; var Punctuation = { ' ': TokenType.Space, @@ -52,8 +53,14 @@ module.exports = function(css) { * @param {string} type * @param {string} value */ - function pushToken(type, value) { - tokens.push({ tn: tn++, ln: ln, type: type, value: value }); + function pushToken(type, value, column) { + tokens.push({ + tn: tn++, + ln: ln, + col: column, + type: type, + value: value + }); } /** @@ -78,8 +85,8 @@ module.exports = function(css) { } // Add a substring containing only spaces to tokens: - pushToken(TokenType.Space, css.substring(start, pos)); - pos--; + pushToken(TokenType.Space, css.substring(start, pos--), col); + col += (pos - start); } /** @@ -91,14 +98,15 @@ module.exports = function(css) { var start = pos; // Read the string until we meet a matching quote: - for (pos = pos + 1; pos < css.length; pos++) { + for (pos++; pos < css.length; pos++) { // Skip escaped quotes: if (css.charAt(pos) === '\\') pos++; else if (css.charAt(pos) === q) break; } // Add the string (including quotes) to tokens: - pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1)); + pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1), col); + col += (pos - start); } /** @@ -114,8 +122,8 @@ module.exports = function(css) { } // Add the number to tokens: - pushToken(TokenType.DecimalNumber, css.substring(start, pos)); - pos--; + pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col); + col += (pos - start); } /** @@ -135,14 +143,14 @@ module.exports = function(css) { else if (css.charAt(pos) in Punctuation) break; } - var ident = css.substring(start, pos); + var ident = css.substring(start, pos--); // Enter url mode if parsed substring is `url`: urlMode = urlMode || ident === 'url'; // Add identifier to tokens: - pushToken(TokenType.Identifier, ident); - pos--; + pushToken(TokenType.Identifier, ident, col); + col += (pos - start); } /** @@ -163,7 +171,16 @@ module.exports = function(css) { } // Add full comment (including `/*` and `*/`) to the list of tokens: - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); + var comment = css.substring(start, pos + 1); + pushToken(TokenType.CommentML, comment, col); + + var newlines = comment.split('\n'); + if (newlines.length > 1) { + ln += newlines.length - 1; + col = newlines[newlines.length - 1].length; + } else { + col += (pos - start); + } } /** @@ -176,15 +193,15 @@ module.exports = function(css) { // Read the string until we meet line break. // Since we already know first 2 characters (`//`), start reading // from `pos + 2`: - for (pos = pos + 2; pos < css.length; pos++) { + for (pos+=2; pos < css.length; pos++) { if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { break; } } // Add comment (including `//` and line break) to the list of tokens: - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; + pushToken(TokenType.CommentSL, css.substring(start, pos--), col); + col += pos - start; } /** @@ -195,7 +212,7 @@ module.exports = function(css) { */ function getTokens(css) { // Parse string, character by character: - for (pos = 0; pos < css.length; pos++) { + for (pos = 0; pos < css.length; col++, pos++) { c = css.charAt(pos); cn = css.charAt(pos + 1); @@ -221,14 +238,17 @@ module.exports = function(css) { // If current character is a space: else if (c === ' ') { - parseSpaces(css) + parseSpaces(css); } // If current character is a punctuation mark: else if (c in Punctuation) { // Add it to the list of tokens: - pushToken(Punctuation[c], c); - if (c === '\n' || c === '\r') ln++; // Go to next line + pushToken(Punctuation[c], c, col); + if (c === '\n' || c === '\r') { + ln++; + col = 0; + } // Go to next line if (c === ')') urlMode = false; // exit url mode if (c === '{') blockMode++; // enter a block if (c === '}') blockMode--; // exit a block diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/node-types.js b/node_modules/gonzales-pe/lib/node-types.js similarity index 62% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/sass/node-types.js rename to node_modules/gonzales-pe/lib/node-types.js index 3118be2..782d525 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/node-types.js +++ b/node_modules/gonzales-pe/lib/node-types.js @@ -6,56 +6,58 @@ module.exports = { AtrulerqType: 'atrulerq', AtrulersType: 'atrulers', AtrulesType: 'atrules', - AttribType: 'attrib', - AttrselectorType: 'attrselector', + AttribType: 'attribute', + AttrselectorType: 'attributeSelector', BlockType: 'block', BracesType: 'braces', ClassType: 'class', CombinatorType: 'combinator', - CommentMLType: 'commentML', - CommentSLType: 'commentSL', + CommentMLType: 'multilineComment', + CommentSLType: 'singlelineComment', ConditionType: 'condition', ConditionalStatementType: 'conditionalStatement', DeclarationType: 'declaration', - DeclDelimType: 'declDelim', + DeclDelimType: 'declarationDelimiter', DefaultType: 'default', - DelimType: 'delim', + DelimType: 'delimiter', DimensionType: 'dimension', + EscapedStringType: 'escapedString', FilterType: 'filter', - FiltervType: 'filterv', + FiltervType: 'filterValue', FunctionType: 'function', FunctionExpressionType: 'functionExpression', IdentType: 'ident', ImportantType: 'important', - IncludeType :'include', + IncludeType: 'include', InterpolationType: 'interpolation', + InterpolatedVariableType: 'interpolatedVariable', LoopType: 'loop', MixinType: 'mixin', NamespaceType: 'namespace', NthType: 'nth', - NthselectorType: 'nthselector', + NthselectorType: 'nthSelector', NumberType: 'number', OperatorType: 'operator', - ParentSelectorType: 'parentselector', + ParentSelectorType: 'parentSelector', PercentageType: 'percentage', PlaceholderType: 'placeholder', ProgidType: 'progid', PropertyType: 'property', - PropertyDelimType: 'propertyDelim', - PseudocType: 'pseudoc', - PseudoeType: 'pseudoe', + PropertyDelimType: 'propertyDelimiter', + PseudocType: 'pseudoClass', + PseudoeType: 'pseudoElement', RawType: 'raw', RulesetType: 'ruleset', - SType: 's', + SType: 'space', SelectorType: 'selector', - ShashType: 'shash', - SimpleselectorType: 'simpleselector', + ShashType: 'id', + SimpleselectorType: 'simpleSelector', StringType: 'string', StylesheetType: 'stylesheet', - UnaryType: 'unary', + UnaryType: 'unaryOperator', UriType: 'uri', ValueType: 'value', VariableType: 'variable', - VariablesListType: 'variableslist', - VhashType: 'vhash' + VariablesListType: 'variablesList', + VhashType: 'color' }; diff --git a/node_modules/gonzales-pe/lib/node.js b/node_modules/gonzales-pe/lib/node.js new file mode 100644 index 0000000..21f616d --- /dev/null +++ b/node_modules/gonzales-pe/lib/node.js @@ -0,0 +1,151 @@ +/** + * @param {string} type + * @param {array|string} content + * @param {number} line + * @param {number} column + * @constructor + */ +function Node(type, content, line, column) { + this.type = type; + this.content = content; + this.start = { + line: line, + column: column + }; +} + +Node.prototype = { + type: null, + + content: null, + + start: null, + + /** + * @param {String} type Node type + * @return {Boolean} Whether there is a child node of given type + */ + contains: function(type) { + return this.content.some(function(node) { + return node.type === type; + }); + }, + + /** + * @param {String} type + * @return {Node} First child node + */ + first: function(type) { + if (!type || !Array.isArray(this.content)) return this.content[0]; + + var i = 0; + var l = this.content.length; + + for (; i < l; i++) { + if (this.content[i].type === type) return this.content[i]; + } + }, + + /** + * @param {String} type Node type + * @param {Function} callback Function to call for every found node + */ + forEach: function(type, callback) { + if (!Array.isArray(this.content)) return; + + if (typeof type !== 'string') callback = type, type = null; + + var i = 0; + var l = this.content.length; + + for (; i < l; i++) { + if (!type || this.content[i] && this.content[i].type === type) + callback(this.content[i], i); + } + }, + + /** + * @param {Number} index + * @return {Node} + */ + get: function(index) { + return Array.isArray(this.content) && this.content[index]; + }, + + /** + * @param {Number} index + * @param {Node} node + */ + insert: function(index, node) { + Array.isArray(this.content) && this.content.splice(index, 0, node); + }, + + /** + * @param {String} type + * @return {Boolean} Whether the node is of given type + */ + is: function(type) { + return this.type === type; + }, + + /** + * @param {String} type + * @return {Node} Last child node + */ + last: function(type) { + var i = this.content.length - 1; + + if (!type || !Array.isArray(this.content)) + return this.content[i]; + + + for (;;i--) { + if (this.content[i].type === type) return this.content[i]; + } + }, + + /** + * @param {Function} callback + */ + map: function(callback) { + callback(this); + + if (!Array.isArray(this.content)) return; + + this.content.forEach(function(node) { + if (node instanceof Node) + node.map(callback); + }); + }, + + /** + * @param {Number} index + */ + remove: function(index) { + Array.isArray(this.content) && this.content.splice(index, 1); + }, + + get length() { + return this.content.length; + }, + + toString: function() { + return JSON.stringify(this, false, 2); + }, + + //TODO(tonyganch): Save syntax name while creating a node. + toCSS: function(syntax) { + if (!syntax) return console.error('Empty syntax name.'); + + try { + stringify = require('./' + syntax + '/stringify'); + } catch (e) { + var message = 'Syntax "' + syntax + '" is not supported yet, sorry'; + return console.error(message); + } + + return stringify(this); + } +}; + +module.exports = Node; diff --git a/node_modules/gonzales-pe/lib/parse.js b/node_modules/gonzales-pe/lib/parse.js new file mode 100644 index 0000000..bf9cc98 --- /dev/null +++ b/node_modules/gonzales-pe/lib/parse.js @@ -0,0 +1,42 @@ +var fs = require('fs'); +var ParsingError = require('./parsing-error'); + +var Defaults = { + SYNTAX: 'css', + NEED_INFO: false, + CSS_RULE: 'stylesheet', + JS_RULE: 'program' +}; + +/** + * @param {String} css + * @param {Object} options + * @return {Object} AST + */ +function parse(css, options) { + if (!css || typeof css !== 'string') + throw new Error('Please, pass a string to parse'); + + var syntax = options && options.syntax || Defaults.SYNTAX; + var needInfo = options && options.needInfo || Defaults.NEED_INFO; + var rule = options && options.rule || + (syntax === 'js' ? Defaults.JS_RULE : Defaults.CSS_RULE); + + if (!fs.existsSync(__dirname + '/' + syntax)) + return console.error('Syntax "' + syntax + '" is not supported yet, sorry'); + + var getTokens = require('./' + syntax + '/tokenizer'); + var mark = require('./' + syntax + '/mark'); + var parse = require('./' + syntax + '/parse'); + + var tokens = getTokens(css); + mark(tokens); + + try { + return parse(tokens, rule, needInfo); + } catch (e) { + throw new ParsingError(e, css); + } +} + +module.exports = parse; diff --git a/node_modules/gonzales-pe/lib/parsing-error.js b/node_modules/gonzales-pe/lib/parsing-error.js new file mode 100644 index 0000000..8df354c --- /dev/null +++ b/node_modules/gonzales-pe/lib/parsing-error.js @@ -0,0 +1,79 @@ +var parserPackage = require('../package.json'); + +/** + * @param {Error} e + * @param {String} css + */ +function ParsingError(e, css) { + this.line = e.line; + this.syntax = e.syntax; + this.css_ = css; +} + +ParsingError.prototype = { + /** + * @type {Number} + */ + line: null, + + /** + * @type {String} + */ + name: 'Parsing error', + + /** + * @type {String} + */ + syntax: null, + + /** + * @type {String} + */ + version: parserPackage.version, + + /** + * @return {String} + */ + toString: function() { + return this.name + ': ' + this.message; + }, + + /** + * @type {String} + */ + get message() { + return [ + 'Please check the validity of the block starting from line #' + this.line, + '', + this.codeFragment_, + '', + 'Gonzales PE version: ' + this.version, + 'Syntax: ' + this.syntax + ].join('\n'); + }, + + /** + * @type {String} + */ + get codeFragment_() { + var LINES_AROUND = 2; + + var result = []; + var currentLineNumber = this.line; + var start = currentLineNumber - 1 - LINES_AROUND; + var end = currentLineNumber + LINES_AROUND; + var lines = this.css_.split(/\r\n|\r|\n/); + + for (var i = start; i < end; i++) { + var line = lines[i]; + if (!line) continue; + var ln = i + 1; + var mark = ln === currentLineNumber ? '*' : ' '; + result.push(ln + mark + '| ' + line); + } + + return result.join('\n'); + } +}; + +module.exports = ParsingError; diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/mark.js b/node_modules/gonzales-pe/lib/sass/mark.js similarity index 99% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/sass/mark.js rename to node_modules/gonzales-pe/lib/sass/mark.js index b70680a..81597ff 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/mark.js +++ b/node_modules/gonzales-pe/lib/sass/mark.js @@ -145,6 +145,7 @@ module.exports = (function() { prevIL = currentIL; if (tokens[i].type === TokenType.Newline) continue; else if (tokens[i].type === TokenType.Space && + tokens[i + 1] && tokens[i + 1].type === TokenType.Newline) continue; else if (tokens[i].type !== TokenType.Space) currentIL = 0; else { diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/rules.js b/node_modules/gonzales-pe/lib/sass/parse.js similarity index 82% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/sass/rules.js rename to node_modules/gonzales-pe/lib/sass/parse.js index 922ff44..4d7b30b 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/rules.js +++ b/node_modules/gonzales-pe/lib/sass/parse.js @@ -1,8 +1,9 @@ +var Node = require('../node'); +var NodeType = require('../node-types'); var TokenType = require('../token-types'); -var NodeType = require('./node-types'); module.exports = (function() { - var tokens, tokensLength, pos; + var tokens, tokensLength, pos, needInfo; var rules = { 'arguments': function() { return checkArguments(pos) && getArguments(); }, @@ -122,7 +123,6 @@ module.exports = (function() { return s; } - ///////////////////////////////////// ///////////////////////////////////// ///////////////////////////////////// @@ -133,40 +133,46 @@ module.exports = (function() { * @returns {Number} */ function checkAny(i) { - return checkBraces(i) || - checkString(i) || - checkVariablesList(i) || - checkVariable(i) || - checkPlaceholder(i) || - checkPercentage(i) || - checkDimension(i) || - checkNumber(i) || - checkUri(i) || - checkFunctionExpression(i) || - checkFunction(i) || - checkIdent(i) || - checkClass(i) || - checkUnary(i); + var l; + + if (l = checkBraces(i)) tokens[i].any_child = 1; + else if (l = checkString(i)) tokens[i].any_child = 2; + else if (l = checkVariablesList(i)) tokens[i].any_child = 3; + else if (l = checkVariable(i)) tokens[i].any_child = 4; + else if (l = checkPlaceholder(i)) tokens[i].any_child = 5; + else if (l = checkPercentage(i)) tokens[i].any_child = 6; + else if (l = checkDimension(i)) tokens[i].any_child = 7; + else if (l = checkNumber(i)) tokens[i].any_child = 8; + else if (l = checkUri(i)) tokens[i].any_child = 9; + else if (l = checkFunctionExpression(i)) tokens[i].any_child = 10; + else if (l = checkFunction(i)) tokens[i].any_child = 11; + else if (l = checkIdent(i)) tokens[i].any_child = 12; + else if (l = checkClass(i)) tokens[i].any_child = 13; + else if (l = checkUnary(i)) tokens[i].any_child = 14; + + return l; } /** * @returns {Array} */ function getAny() { - if (checkBraces(pos)) return getBraces(); - else if (checkString(pos)) return getString(); - else if (checkVariablesList(pos)) return getVariablesList(); - else if (checkVariable(pos)) return getVariable(); - else if (checkPlaceholder(pos)) return getPlaceholder(); - else if (checkPercentage(pos)) return getPercentage(); - else if (checkDimension(pos)) return getDimension(); - else if (checkNumber(pos)) return getNumber(); - else if (checkUri(pos)) return getUri(); - else if (checkFunctionExpression(pos)) return getFunctionExpression(); - else if (checkFunction(pos)) return getFunction(); - else if (checkIdent(pos)) return getIdent(); - else if (checkClass(pos)) return getClass(); - else if (checkUnary(pos)) return getUnary(); + var childType = tokens[pos].any_child; + + if (childType === 1) return getBraces(); + else if (childType === 2) return getString(); + else if (childType === 3) return getVariablesList(); + else if (childType === 4) return getVariable(); + else if (childType === 5) return getPlaceholder(); + else if (childType === 6) return getPercentage(); + else if (childType === 7) return getDimension(); + else if (childType === 8) return getNumber(); + else if (childType === 9) return getUri(); + else if (childType === 10) return getFunctionExpression(); + else if (childType === 11) return getFunction(); + else if (childType === 12) return getIdent(); + else if (childType === 13) return getClass(); + else if (childType === 14) return getUnary(); } /** @@ -197,46 +203,54 @@ module.exports = (function() { * @returns {Number} Length of argument */ function checkArgument(i) { - return checkDeclaration(i) || - checkFunction(i) || - checkVariablesList(i) || - checkVariable(i) || - checkSC(i) || - checkDelim(i) || - checkDeclDelim(i) || - checkString(i) || - checkPercentage(i) || - checkDimension(i) || - checkNumber(i) || - checkUri(i) || - checkInterpolation(i) || - checkIdent(i) || - checkVhash(i) || - checkOperator(i) || - checkUnary(i); + var l; + + if (l = checkBraces(i)) tokens[i].argument_child = 1; + else if (l = checkDeclaration(i)) tokens[i].argument_child = 2; + else if (l = checkFunction(i)) tokens[i].argument_child = 3; + else if (l = checkVariablesList(i)) tokens[i].argument_child = 4; + else if (l = checkVariable(i)) tokens[i].argument_child = 5; + else if (l = checkSC(i)) tokens[i].argument_child = 6; + else if (l = checkDelim(i)) tokens[i].argument_child = 7; + else if (l = checkDeclDelim(i)) tokens[i].argument_child = 8; + else if (l = checkString(i)) tokens[i].argument_child = 9; + else if (l = checkPercentage(i)) tokens[i].argument_child = 10; + else if (l = checkDimension(i)) tokens[i].argument_child = 11; + else if (l = checkNumber(i)) tokens[i].argument_child = 12; + else if (l = checkUri(i)) tokens[i].argument_child = 13; + else if (l = checkInterpolation(i)) tokens[i].argument_child = 14; + else if (l = checkIdent(i)) tokens[i].argument_child = 15; + else if (l = checkVhash(i)) tokens[i].argument_child = 16; + else if (l = checkOperator(i)) tokens[i].argument_child = 17; + else if (l = checkUnary(i)) tokens[i].argument_child = 18; + + return l; } /** * @returns {Array} Node that is part of arguments list */ function getArgument() { - if (checkDeclaration(pos)) return getDeclaration(); - else if (checkFunction(pos)) return getFunction(); - else if (checkVariablesList(pos)) return getVariablesList(); - else if (checkVariable(pos)) return getVariable(); - else if (checkSC(pos)) return getSC(); - else if (checkDelim(pos)) return getDelim(); - else if (checkDeclDelim(pos)) return getDeclDelim(); - else if (checkString(pos)) return getString(); - else if (checkPercentage(pos)) return getPercentage(); - else if (checkDimension(pos)) return getDimension(); - else if (checkNumber(pos)) return getNumber(); - else if (checkUri(pos)) return getUri(); - else if (checkInterpolation(pos)) return getInterpolation(); - else if (checkIdent(pos)) return getIdent(); - else if (checkVhash(pos)) return getVhash(); - else if (checkOperator(pos)) return getOperator(); - else if (checkUnary(pos)) return getUnary(); + var childType = tokens[pos].argument_child; + + if (childType === 1) return getBraces(); + else if (childType === 2) return getDeclaration(); + else if (childType === 3) return getFunction(); + else if (childType === 4) return getVariablesList(); + else if (childType === 5) return getVariable(); + else if (childType === 6) return getSC(); + else if (childType === 7) return getDelim(); + else if (childType === 8) return getDeclDelim(); + else if (childType === 9) return getString(); + else if (childType === 10) return getPercentage(); + else if (childType === 11) return getDimension(); + else if (childType === 12) return getNumber(); + else if (childType === 13) return getUri(); + else if (childType === 14) return getInterpolation(); + else if (childType === 15) return getIdent(); + else if (childType === 16) return getVhash(); + else if (childType === 17) return getOperator(); + else if (childType === 18) return getUnary(); } /** @@ -261,14 +275,11 @@ module.exports = (function() { * `@` (e.g. `import`, `include`) */ function getAtkeyword() { - var startPos = pos, - x; + var startPos = pos++, + x = [getIdent()]; - pos++; - - x = [NodeType.AtkeywordType, getIdent()]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtkeywordType, x, token.ln, token.col); } /** @@ -339,7 +350,7 @@ module.exports = (function() { pos++; - x = [NodeType.AttribType] + x = [] .concat(getSC()) .concat([getIdent()]) .concat(getSC()) @@ -350,7 +361,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttribType, x, token.ln, token.col); } /** @@ -385,14 +397,15 @@ module.exports = (function() { pos++; - x = [NodeType.AttribType] + x = [] .concat(getSC()) .concat([getIdent()]) .concat(getSC()); pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttribType, x, token.ln, token.col); } /** @@ -433,14 +446,13 @@ module.exports = (function() { */ function getAttrselector() { var startPos = pos, - s = tokens[pos++].value, - x; + s = tokens[pos++].value; - if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) s += tokens[pos++].value; + if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) + s += tokens[pos++].value; - x = [NodeType.AttrselectorType, s]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttrselectorType, s, token.ln, token.col); } /** @@ -511,11 +523,12 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulebType, getAtkeyword()] + x = [getAtkeyword()] .concat(getTsets()) .concat([getBlock()]); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulebType, x, token.ln, token.col); } /** @@ -553,7 +566,7 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulerType, getAtkeyword(), getAtrulerq()]; + x = [getAtkeyword(), getAtrulerq()]; pos++; @@ -561,7 +574,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulerType, x, token.ln, token.col); } /** @@ -577,11 +591,10 @@ module.exports = (function() { */ function getAtrulerq() { var startPos = pos, - x; - - x = [NodeType.AtrulerqType].concat(getTsets()); + x = getTsets(); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulerqType, x, token.ln, token.col); } /** @@ -612,9 +625,7 @@ module.exports = (function() { */ function getAtrulers() { var startPos = pos, - x; - - x = [NodeType.AtrulersType].concat(getSC()); + x = getSC(); while (!tokens[pos].atrulers_end) { if (checkSC(pos)) x = x.concat(getSC()); @@ -624,7 +635,8 @@ module.exports = (function() { x = x.concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulersType, x, token.ln, token.col); } /** @@ -652,9 +664,10 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulesType, getAtkeyword()].concat(getTsets()); + x = [getAtkeyword()].concat(getTsets()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulesType, x, token.ln, token.col); } /** @@ -674,14 +687,15 @@ module.exports = (function() { function getBlock() { var startPos = pos, end = tokens[pos].block_end, - x = [NodeType.BlockType]; + x = []; while (pos < end) { if (checkBlockdecl(pos)) x = x.concat(getBlockdecl()); else throwError(); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.BlockType, x, token.ln, token.col); } /** @@ -934,10 +948,11 @@ module.exports = (function() { pos++; - x = [NodeType.BracesType, tokens[left].value, tokens[right].value] + x = [tokens[left].value, tokens[right].value] .concat(tsets); - return x; + var token = tokens[startPos]; + return new Node(NodeType.BracesType, x, token.ln, token.col); } /** @@ -946,19 +961,21 @@ module.exports = (function() { * @returns {Number} Length of the class selector */ function checkClass(i) { - var l; + var start = i, + l; if (i >= tokensLength) return 0; if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && - (l = checkInterpolation(i) || checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; + if (tokens[i++].type !== TokenType.FullStop) return 0; + + while (i < tokensLength) { + if (l = checkInterpolation(i) || checkIdent(i)) i += l; + else break; } - return 0; + return i - start; } /** @@ -967,14 +984,17 @@ module.exports = (function() { * identifier (without `.`, e.g. `abc`). */ function getClass() { - var startPos = pos, - x = [NodeType.ClassType]; + var startPos = pos++, + x = []; - pos++; - - x.push(checkInterpolation(pos) ? getInterpolation() : getIdent()); + while (pos < tokensLength) { + if (checkInterpolation(pos)) x.push(getInterpolation()); + else if (checkIdent(pos)) x.push(getIdent()); + else break; + } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ClassType, x, token.ln, token.col); } /** @@ -1002,11 +1022,10 @@ module.exports = (function() { */ function getCombinator() { var startPos = pos, - x; + x = tokens[pos++].value; - x = [NodeType.CombinatorType, tokens[pos++].value]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.CombinatorType, x, token.ln, token.col); } /** @@ -1025,15 +1044,12 @@ module.exports = (function() { */ function getCommentML() { var startPos = pos, - s = tokens[pos].value.substring(2), - l = s.length, - x; + x = tokens[pos].value.substring(2); pos++; - x = [NodeType.CommentMLType, s]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.CommentMLType, x, token.ln, token.col); } /** @@ -1052,11 +1068,10 @@ module.exports = (function() { */ function getCommentSL() { var startPos = pos, - x; + x = tokens[pos++].value.substring(2); - x = [NodeType.CommentSLType, tokens[pos++].value.substring(2)]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.CommentSLType, x, token.ln, token.col); } /** @@ -1104,9 +1119,7 @@ module.exports = (function() { */ function getCondition() { var startPos = pos, - x = [NodeType.ConditionType]; - - x.push(getAtkeyword()); + x = [getAtkeyword()]; while (pos < tokensLength) { if (checkBlock(pos)) break; @@ -1120,7 +1133,8 @@ module.exports = (function() { x.push(_getCondition()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ConditionType, x, token.ln, token.col); } function _getCondition() { @@ -1161,13 +1175,14 @@ module.exports = (function() { */ function getConditionalStatement() { var startPos = pos, - x = [NodeType.ConditionalStatementType]; + x = []; x.push(getCondition()); x = x.concat(getSC()); x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ConditionalStatementType, x, token.ln, token.col); } /** @@ -1224,7 +1239,7 @@ module.exports = (function() { */ function getDeclaration1() { var startPos = pos, - x = [NodeType.DeclarationType]; + x = []; x.push(getProperty()); if (checkS(pos)) x.push(getS()); @@ -1232,7 +1247,8 @@ module.exports = (function() { if (checkS(pos)) x.push(getS()); x.push(getValue()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.DeclarationType, x, token.ln, token.col); } /** @@ -1269,14 +1285,15 @@ module.exports = (function() { */ function getDeclaration2() { var startPos = pos, - x = [NodeType.DeclarationType]; + x = []; x.push(getPropertyDelim()); x.push(getProperty()); x = x.concat(getSC()); x.push(getValue()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.DeclarationType, x, token.ln, token.col); } /** @@ -1296,12 +1313,26 @@ module.exports = (function() { * @returns {Array} `['declDelim']` */ function getDeclDelim() { - var startPos = pos, - x = [NodeType.DeclDelimType]; + var startPos = pos++; - pos++; + var token = tokens[startPos]; + return new Node(NodeType.DeclDelimType, '\n', token.ln, token.col); + } - return x; + function checkDeepSelector(i) { + if (tokens[i + 2] && + tokens[i].value + tokens[i + 1].value + tokens[i + 2].value === '/deep/') { + return 3; + } + } + + function getDeepSelector() { + var _pos = pos++; + var ident = getIdent(); + ident.content = '/deep/'; + ident.start.column -= 1; + pos = _pos + 3; + return ident; } /** @@ -1327,7 +1358,7 @@ module.exports = (function() { */ function getDefault() { var startPos = pos, - x = [NodeType.DefaultType], + x = [], sc; // Skip `!`: @@ -1340,7 +1371,8 @@ module.exports = (function() { x = x.concat(sc); - return x; + var token = tokens[startPos]; + return new Node(NodeType.DefaultType, x, token.ln, token.col); } /** @@ -1357,12 +1389,10 @@ module.exports = (function() { * @returns {Array} `['delim']` */ function getDelim() { - var startPos = pos, - x = [NodeType.DelimType]; - - pos++; + var startPos = pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.DelimType, ',', token.ln, token.col); } /** @@ -1389,12 +1419,14 @@ module.exports = (function() { */ function getDimension() { var startPos = pos, - x = [NodeType.DimensionType, getNumber()], - ident = [NodeType.IdentType, getNmName2()]; + x = [getNumber()], + token = tokens[pos], + ident = new Node(NodeType.IdentType, getNmName2(), token.ln, token.col); x.push(ident); - return x; + token = tokens[startPos]; + return new Node(NodeType.DimensionType, x, token.ln, token.col); } /** @@ -1424,13 +1456,14 @@ module.exports = (function() { */ function getFilter() { var startPos = pos, - x = [NodeType.FilterType, getFilterp()]; + x = [getFilterp()]; pos++; x.push(getFilterv()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.FilterType, x, token.ln, token.col); } /** @@ -1471,14 +1504,15 @@ module.exports = (function() { */ function getFilterp() { var startPos = pos, - ident = [NodeType.IdentType, joinValues2(pos, tokens[pos].filterp_l)], + token = tokens[pos], + ident = new Node(NodeType.IdentType, joinValues2(pos, tokens[pos].filterp_l), token.ln, token.col), x; pos += tokens[pos].filterp_l; - x = [NodeType.PropertyType, ident].concat(getSC()); + x = [ident].concat(getSC()); - return x; + return new Node(NodeType.PropertyType, x, token.ln, token.col); } /** @@ -1515,20 +1549,22 @@ module.exports = (function() { */ function getFilterv() { var startPos = pos, - x = [NodeType.FiltervType], + token = tokens[startPos], + x = [], last_progid = tokens[pos].last_progid; while (pos < last_progid) { x.push(getProgid()); } - if (checkDeclDelim(pos)) return x; + if (checkDeclDelim(pos)) + return new Node(NodeType.FiltervType, x, token.ln, token.col); if (checkSC(pos)) x = x.concat(getSC()); if (pos < tokensLength && checkImportant(pos)) x.push(getImportant()); - return x; + return new Node(NodeType.FiltervType, x, token.ln, token.col); } /** @@ -1549,17 +1585,16 @@ module.exports = (function() { */ function getFunctionExpression() { var startPos = pos, - x, e; + x; pos++; - e = joinValues(pos + 1, tokens[pos].right - 1); + x = joinValues(pos + 1, tokens[pos].right - 1); pos = tokens[pos].right + 1; - x = [NodeType.FunctionExpressionType, e]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.FunctionExpressionType, [x], token.ln, token.col); } /** @@ -1585,14 +1620,15 @@ module.exports = (function() { function getFunction() { var startPos = pos, ident = getIdent(), - x = [NodeType.FunctionType, ident], + x = [ident], body; - body = ident[1] === 'not' ? getNotArguments() : getArguments(); + body = ident.content === 'not' ? getNotArguments() : getArguments(); x.push(body); - return x; + var token = tokens[startPos]; + return new Node(NodeType.FunctionType, x, token.ln, token.col); } /** @@ -1600,7 +1636,7 @@ module.exports = (function() { */ function getArguments() { var startPos = pos, - x = [NodeType.ArgumentsType], + x = [], body; pos++; @@ -1609,7 +1645,7 @@ module.exports = (function() { if (checkDeclaration(pos)) x.push(getDeclaration()); else if (checkArgument(pos)) { body = getArgument(); - if (typeof body[0] === 'string') x.push(body); + if (typeof body.content === 'string') x.push(body); else x = x.concat(body); } else if (checkClass(pos)) x.push(getClass()); else throwError(); @@ -1617,7 +1653,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ArgumentsType, x, token.ln, token.col); } /** @@ -1625,18 +1662,20 @@ module.exports = (function() { */ function getNotArguments() { var startPos = pos, - x = [NodeType.ArgumentsType]; + x = []; pos++; - while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) { + while (pos < tokensLength && + tokens[pos].type !== TokenType.RightParenthesis) { if (checkSimpleSelector(pos)) x.push(getSimpleSelector()); else throwError(); } pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ArgumentsType, x, token.ln, token.col); } /** @@ -1646,7 +1685,6 @@ module.exports = (function() { */ function checkIdent(i) { var start = i, - interpolations = [], wasIdent, wasInt = false, l; @@ -1656,36 +1694,28 @@ module.exports = (function() { // Check if token is part of an identifier starting with `_`: if (tokens[i].type === TokenType.LowLine) return checkIdentLowLine(i); + if (tokens[i].type === TokenType.HyphenMinus && + tokens[i + 1].type === TokenType.DecimalNumber) return 0; + // If token is a character, `-`, `$` or `*`, skip it & continue: if (l = _checkIdent(i)) i += l; else return 0; - if (l > 1) { - interpolations.push(i - l); - wasInt = true; - } else { - // Remember if previous token's type was identifier: - wasIdent = tokens[i - 1].type === TokenType.Identifier; - } + // Remember if previous token's type was identifier: + wasIdent = tokens[i - 1].type === TokenType.Identifier; while (i < tokensLength) { l = _checkIdent(i); if (!l) break; - if (l > 1) { - wasInt = true; - interpolations.push(i); - } else { - wasIdent = true; - } + wasIdent = true; i += l; } if (!wasIdent && !wasInt && tokens[start].type !== TokenType.Asterisk) return 0; tokens[start].ident_last = i - 1; - if (interpolations.length) tokens[start].interpolations = interpolations; return i - start; } @@ -1695,8 +1725,8 @@ module.exports = (function() { tokens[i].type === TokenType.Identifier || tokens[i].type === TokenType.DollarSign || tokens[i].type === TokenType.LowLine || + tokens[i].type === TokenType.DecimalNumber || tokens[i].type === TokenType.Asterisk) return 1; - if (l = checkInterpolation(i)) return l; return 0; } @@ -1729,24 +1759,12 @@ module.exports = (function() { */ function getIdent() { var startPos = pos, - interpolations = tokens[pos].interpolations, - x = [NodeType.IdentType]; - - if (interpolations) { - for (var i = 0, l = interpolations.length; i < l; i++) { - var s = joinValues(pos, interpolations[i] - 1); - if (s) x.push(s); - pos = interpolations[i]; - x.push(getInterpolation()); - } - } + x = joinValues(pos, tokens[pos].ident_last); - if (pos < tokensLength && pos <= tokens[startPos].ident_last) { - x.push(joinValues(pos, tokens[startPos].ident_last)); - pos = tokens[pos].ident_last + 1; - } + pos = tokens[pos].ident_last + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.IdentType, x, token.ln, token.col); } /** @@ -1771,16 +1789,13 @@ module.exports = (function() { * @returns {Array} `['important', sc]` where `sc` is optional whitespace */ function getImportant() { - var startPos = pos, - x = [NodeType.ImportantType]; - - pos++; - - x = x.concat(getSC()); + var startPos = pos++, + x = getSC(); pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ImportantType, x, token.ln, token.col); } /** @@ -1867,7 +1882,7 @@ module.exports = (function() { */ function getInclude1() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -1883,7 +1898,8 @@ module.exports = (function() { x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1924,7 +1940,7 @@ module.exports = (function() { */ function getInclude2() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -1936,7 +1952,8 @@ module.exports = (function() { x.push(getArguments()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1975,7 +1992,7 @@ module.exports = (function() { */ function getInclude3() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -1987,7 +2004,8 @@ module.exports = (function() { x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -2017,7 +2035,7 @@ module.exports = (function() { */ function getInclude4() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -2025,7 +2043,8 @@ module.exports = (function() { x.push(getIncludeSelector()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -2067,7 +2086,7 @@ module.exports = (function() { */ function getInclude5() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getOperator()); @@ -2083,7 +2102,8 @@ module.exports = (function() { x = x.concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -2120,7 +2140,7 @@ module.exports = (function() { */ function getInclude6() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getOperator()); @@ -2132,7 +2152,8 @@ module.exports = (function() { x = x.concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -2168,7 +2189,7 @@ module.exports = (function() { */ function getInclude7() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getOperator()); @@ -2180,7 +2201,8 @@ module.exports = (function() { x = x.concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -2205,13 +2227,14 @@ module.exports = (function() { */ function getInclude8() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getOperator()); x.push(getIncludeSelector()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -2235,17 +2258,18 @@ module.exports = (function() { */ function getIncludeSelector() { var startPos = pos, - x = [NodeType.SimpleselectorType], + x = [], t; while (pos < tokensLength && checkSimpleSelector2(pos)) { t = getSimpleSelector2(); - if (typeof t[0] === 'string') x.push(t); + if (typeof t.content === 'string') x.push(t); else x = x.concat(t); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SimpleselectorType, x, token.ln, token.col); } /** @@ -2277,7 +2301,7 @@ module.exports = (function() { */ function getInterpolation() { var startPos = pos, - x = [NodeType.InterpolationType]; + x = []; // Skip `#{`: pos += 2; @@ -2287,7 +2311,8 @@ module.exports = (function() { // Skip `}`: pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.InterpolationType, x, token.ln, token.col); } /** @@ -2329,7 +2354,7 @@ module.exports = (function() { */ function getLoop() { var startPos = pos, - x = [NodeType.LoopType]; + x = []; x.push(getAtkeyword()); @@ -2347,7 +2372,8 @@ module.exports = (function() { else if (checkString(pos)) x.push(getString()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.LoopType, x, token.ln, token.col); } /** @@ -2407,7 +2433,7 @@ module.exports = (function() { */ function getMixin1() { var startPos = pos, - x = [NodeType.MixinType, getAtkeyword()]; + x = [getAtkeyword()]; x = x.concat(getSC()); @@ -2424,7 +2450,8 @@ module.exports = (function() { x.push(getBlock()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.MixinType, x, token.ln, token.col); } /** @@ -2467,7 +2494,7 @@ module.exports = (function() { */ function getMixin2() { var startPos = pos, - x = [NodeType.MixinType, getOperator()]; + x = [getOperator()]; x = x.concat(getSC()); @@ -2484,7 +2511,8 @@ module.exports = (function() { x.push(getBlock()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.MixinType, x, token.ln, token.col); } /** @@ -2501,12 +2529,10 @@ module.exports = (function() { * @returns {Array} `['namespace']` */ function getNamespace() { - var startPos = pos, - x = [NodeType.NamespaceType]; - - pos++; + var startPos = pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.NamespaceType, '|', token.ln, token.col); } /** @@ -2610,16 +2636,17 @@ module.exports = (function() { */ function getNth() { var startPos = pos, - x = [NodeType.NthType]; + x; if (tokens[pos].nth_last) { - x.push(joinValues(pos, tokens[pos].nth_last)); + x = joinValues(pos, tokens[pos].nth_last); pos = tokens[pos].nth_last + 1; } else { - x.push(tokens[pos++].value); + x = tokens[pos++].value; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.NthType, x, token.ln, token.col); } /** @@ -2720,8 +2747,9 @@ module.exports = (function() { */ function getNthselector() { var startPos = pos, - nthf = [NodeType.IdentType, getNthf()], - x = [NodeType.NthselectorType]; + token = tokens[pos], + nthf = new Node(NodeType.IdentType, getNthf(), token.ln, token.col), + x = []; x.push(nthf); @@ -2736,7 +2764,7 @@ module.exports = (function() { pos++; - return x; + return new Node(NodeType.NthselectorType, x, token.ln, token.col); } /** @@ -2786,8 +2814,7 @@ module.exports = (function() { function getNumber() { var s = '', startPos = pos, - l = tokens[pos].number_l, - x = [NodeType.NumberType]; + l = tokens[pos].number_l; for (var j = 0; j < l; j++) { s += tokens[pos + j].value; @@ -2795,9 +2822,8 @@ module.exports = (function() { pos += l; - x.push(s); - - return x; + var token = tokens[startPos]; + return new Node(NodeType.NumberType, s, token.ln, token.col); } /** @@ -2813,6 +2839,8 @@ module.exports = (function() { case TokenType.Comma: case TokenType.Colon: case TokenType.EqualsSign: + case TokenType.EqualitySign: + case TokenType.InequalitySign: case TokenType.LessThanSign: case TokenType.GreaterThanSign: case TokenType.Asterisk: @@ -2829,9 +2857,10 @@ module.exports = (function() { */ function getOperator() { var startPos = pos, - x = [NodeType.OperatorType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.OperatorType, x, token.ln, token.col); } /** @@ -2848,12 +2877,10 @@ module.exports = (function() { * @returns {Array} `['parentSelector']` */ function getParentSelector() { - var startPos = pos, - x = [NodeType.ParentSelectorType, '&']; + var startPos = pos++; - pos++; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.ParentSelectorType, '&', token.ln, token.col); } /** @@ -2880,11 +2907,12 @@ module.exports = (function() { */ function getPercentage() { var startPos = pos, - x = [NodeType.PercentageType, getNumber()]; + x = [getNumber()]; pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.PercentageType, x, token.ln, token.col); } /** @@ -2912,13 +2940,14 @@ module.exports = (function() { */ function getPlaceholder() { var startPos = pos, - x = [NodeType.PlaceholderType]; + x = []; pos++; x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PlaceholderType, x, token.ln, token.col); } /** @@ -2957,11 +2986,12 @@ module.exports = (function() { progid_end = tokens[pos].progid_end, x; - x = [NodeType.ProgidType] + x = [] .concat(getSC()) .concat([_getProgid(progid_end)]); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ProgidType, x, token.ln, token.col); } /** @@ -2970,11 +3000,12 @@ module.exports = (function() { */ function _getProgid(progid_end) { var startPos = pos, - x = [NodeType.RawType, joinValues(pos, progid_end)]; + x = joinValues(pos, progid_end); pos = progid_end + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.RawType, x, token.ln, token.col); } /** @@ -3000,11 +3031,12 @@ module.exports = (function() { */ function getProperty() { var startPos = pos, - x = [NodeType.PropertyType]; + x = []; x.push(checkVariable(pos) ? getVariable() : getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PropertyType, x, token.ln, token.col); } /** @@ -3021,12 +3053,10 @@ module.exports = (function() { * @returns {Array} `['propertyDelim']` */ function getPropertyDelim() { - var startPos = pos, - x = [NodeType.PropertyDelimType]; + var startPos = pos++; - pos++; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.PropertyDelimType, ':', token.ln, token.col); } /** @@ -3064,13 +3094,14 @@ module.exports = (function() { */ function getPseudoe() { var startPos = pos, - x = [NodeType.PseudoeType]; + x = []; pos += 2; x.push(checkInterpolation(pos) ? getInterpolation() : getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PseudoeType, x, token.ln, token.col); } /** @@ -3090,7 +3121,7 @@ module.exports = (function() { */ function getPseudoc() { var startPos = pos, - x = [NodeType.PseudocType]; + x = []; pos ++; @@ -3098,7 +3129,8 @@ module.exports = (function() { else if (checkFunction(pos)) x.push(getFunction()); else x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PseudocType, x, token.ln, token.col); } /** @@ -3129,7 +3161,7 @@ module.exports = (function() { */ function getRuleset() { var startPos = pos, - x = [NodeType.RulesetType]; + x = []; while (pos < tokensLength) { if (checkBlock(pos)) {x.push(getBlock()); break;} @@ -3137,7 +3169,8 @@ module.exports = (function() { else break; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.RulesetType, x, token.ln, token.col); } /** @@ -3156,11 +3189,12 @@ module.exports = (function() { */ function getS() { var startPos = pos, - x = [NodeType.SType, joinValues(pos, tokens[pos].ws_last)]; + x = joinValues(pos, tokens[pos].ws_last); pos = tokens[pos].ws_last + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.SType, x, token.ln, token.col); } /** @@ -3248,7 +3282,7 @@ module.exports = (function() { */ function getSelector() { var startPos = pos, - x = [NodeType.SelectorType], + x = [], selector_end = tokens[pos].selector_end, ln = tokens[pos].ln; @@ -3261,7 +3295,8 @@ module.exports = (function() { x.push(checkDelim(pos) ? getDelim() : getSimpleSelector()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SelectorType, x, token.ln, token.col); } /** @@ -3286,13 +3321,14 @@ module.exports = (function() { */ function getShash() { var startPos = pos, - x = [NodeType.ShashType]; + x = []; pos++; x.push(getNmName()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ShashType, x, token.ln, token.col); } /** @@ -3321,7 +3357,7 @@ module.exports = (function() { */ function getSimpleSelector() { var startPos = pos, - x = [NodeType.SimpleselectorType], + x = [], t, ln = tokens[pos].ln; @@ -3331,11 +3367,12 @@ module.exports = (function() { t = getSimpleSelector1(); - if (typeof t[0] === 'string') x.push(t); + if (typeof t.content === 'string') x.push(t); else x = x.concat(t); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SimpleselectorType, x, token.ln, token.col); } /** @@ -3343,30 +3380,39 @@ module.exports = (function() { * @returns {Number} */ function checkSimpleSelector1(i) { - return checkParentSelector(i) || - checkNthselector(i) || - checkCombinator(i) || - checkAttrib(i) || - checkPseudo(i) || - checkShash(i) || - checkAny(i) || - checkSC(i) || - checkNamespace(i); + var l; + + if (l = checkParentSelector(i)) tokens[i].simpleselector1_child = 1; + else if (l = checkInterpolation(i)) tokens[i].simpleselector1_child = 2; + else if (l = checkNthselector(i)) tokens[i].simpleselector1_child = 3; + else if (l = checkCombinator(i)) tokens[i].simpleselector1_child = 4; + else if (l = checkAttrib(i)) tokens[i].simpleselector1_child = 5; + else if (l = checkPseudo(i)) tokens[i].simpleselector1_child = 6; + else if (l = checkShash(i)) tokens[i].simpleselector1_child = 7; + else if (l = checkAny(i)) tokens[i].simpleselector1_child = 8; + else if (l = checkSC(i)) tokens[i].simpleselector1_child = 9; + else if (l = checkNamespace(i)) tokens[i].simpleselector1_child = 10; + else if (l = checkDeepSelector(i)) tokens[i].simpleselector1_child = 11; + + return l; } /** * @returns {Array} */ function getSimpleSelector1() { - if (checkParentSelector(pos)) return getParentSelector(); - else if (checkNthselector(pos)) return getNthselector(); - else if (checkCombinator(pos)) return getCombinator(); - else if (checkAttrib(pos)) return getAttrib(); - else if (checkPseudo(pos)) return getPseudo(); - else if (checkShash(pos)) return getShash(); - else if (checkAny(pos)) return getAny(); - else if (checkSC(pos)) return getSC(); - else if (checkNamespace(pos)) return getNamespace(); + var childType = tokens[pos].simpleselector1_child; + if (childType === 1) return getParentSelector(); + if (childType === 2) return getInterpolation(); + if (childType === 3) return getNthselector(); + if (childType === 4) return getCombinator(); + if (childType === 5) return getAttrib(); + if (childType === 6) return getPseudo(); + if (childType === 7) return getShash(); + if (childType === 8) return getAny(); + if (childType === 9) return getSC(); + if (childType === 10) return getNamespace(); + if (childType === 11) return getDeepSelector(); } /** @@ -3414,9 +3460,10 @@ module.exports = (function() { */ function getString() { var startPos = pos, - x = [NodeType.StringType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.StringType, x, token.ln, token.col); } /** @@ -3452,7 +3499,7 @@ module.exports = (function() { */ function getStylesheet() { var startPos = pos, - x = [NodeType.StylesheetType]; + x = []; while (pos < tokensLength) { if (checkSC(pos)) x = x.concat(getSC()); @@ -3467,7 +3514,8 @@ module.exports = (function() { else throwError(); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.StylesheetType, x, token.ln, token.col); } /** @@ -3518,7 +3566,7 @@ module.exports = (function() { while (tokens[pos - 1].type !== TokenType.Newline && (t = getTset())) { - if (typeof t[0] === 'string') x.push(t); + if (typeof t.content === 'string') x.push(t); else x = x.concat(t); } @@ -3541,9 +3589,10 @@ module.exports = (function() { */ function getUnary() { var startPos = pos, - x = [NodeType.UnaryType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.UnaryType, x, token.ln, token.col); } /** @@ -3559,9 +3608,10 @@ module.exports = (function() { */ function getUnknown() { var startPos = pos, - x = [NodeType.UnknownType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.UnknownType, x, token.ln, token.col); } /** @@ -3588,6 +3638,7 @@ module.exports = (function() { var startPos = pos, uriExcluding = {}, uri, + token, l, raw; @@ -3600,16 +3651,17 @@ module.exports = (function() { uriExcluding[TokenType.RightParenthesis] = 1; if (checkUri1(pos)) { - uri = [NodeType.UriType] + uri = [] .concat(getSC()) .concat([getString()]) .concat(getSC()); pos++; } else { - uri = [NodeType.UriType].concat(getSC()), + uri = [].concat(getSC()), l = checkExcluding(uriExcluding, pos), - raw = [NodeType.RawType, joinValues(pos, pos + l)]; + token = tokens[pos], + raw = new Node(NodeType.RawType, joinValues(pos, pos + l), token.ln, token.col); uri.push(raw); @@ -3620,7 +3672,8 @@ module.exports = (function() { pos++; } - return uri; + token = tokens[startPos]; + return new Node(NodeType.UriType, uri, token.ln, token.col); } /** @@ -3677,10 +3730,11 @@ module.exports = (function() { */ function _checkValue(i) { return checkVhash(i) || - checkAny(i) || checkOperator(i) || checkImportant(i) || - checkDefault(i); + checkDefault(i) || + checkAny(i) || + checkInterpolation(i); } /** @@ -3688,7 +3742,7 @@ module.exports = (function() { */ function getValue() { var startPos = pos, - x = [NodeType.ValueType], + x = [], t, _pos, s; while (pos < tokensLength) { @@ -3710,7 +3764,8 @@ module.exports = (function() { if (checkBlock(_pos)) break; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ValueType, x, token.ln, token.col); } /** @@ -3718,10 +3773,11 @@ module.exports = (function() { */ function _getValue() { if (checkVhash(pos)) return getVhash(); - if (checkAny(pos)) return getAny(); if (checkOperator(pos)) return getOperator(); if (checkImportant(pos)) return getImportant(); if (checkDefault(pos)) return getDefault(); + if (checkAny(pos)) return getAny(); + if (checkInterpolation(pos)) return getInterpolation(); } /** @@ -3744,13 +3800,14 @@ module.exports = (function() { */ function getVariable() { var startPos = pos, - x = [NodeType.VariableType]; + x = []; pos++; x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.VariableType, x, token.ln, token.col); } /** @@ -3782,11 +3839,12 @@ module.exports = (function() { */ function getVariablesList() { var startPos = pos, - x = [NodeType.VariablesListType, getVariable()]; + x = [getVariable()]; pos += 3; - return x; + var token = tokens[startPos]; + return new Node(NodeType.VariablesListType, x, token.ln, token.col); } /** @@ -3810,17 +3868,19 @@ module.exports = (function() { */ function getVhash() { var startPos = pos, - x = [NodeType.VhashType]; + x; pos++; - x.push(getNmName2()); + x = getNmName2(); - return x; + var token = tokens[startPos]; + return new Node(NodeType.VhashType, x, token.ln, token.col); } - return function(_tokens, rule) { + return function(_tokens, rule, _needInfo) { tokens = _tokens; + needInfo = _needInfo; tokensLength = tokens.length; pos = 0; diff --git a/node_modules/gonzales-pe/lib/sass/stringify.js b/node_modules/gonzales-pe/lib/sass/stringify.js new file mode 100644 index 0000000..5162000 --- /dev/null +++ b/node_modules/gonzales-pe/lib/sass/stringify.js @@ -0,0 +1,98 @@ +module.exports = function stringify(tree) { + // TODO: Better error message + if (!tree) throw new Error('We need tree to translate'); + + function _t(tree) { + var type = tree.type; + if (_unique[type]) return _unique[type](tree); + if (typeof tree.content === 'string') return tree.content; + if (Array.isArray(tree.content)) return _composite(tree.content); + return ''; + } + + function _composite(t, i) { + if (!t) return ''; + + var s = ''; + i = i || 0; + for (; i < t.length; i++) s += _t(t[i]); + return s; + } + + var _unique = { + 'arguments': function(t) { + return '(' + _composite(t.content) + ')'; + }, + 'atkeyword': function(t) { + return '@' + _composite(t.content); + }, + 'atruler': function(t) { + return _t(t.content[0]) + _t(t.content[1]) + '{' + _t(t.content[2]) + '}'; + }, + 'attribute': function(t) { + return '[' + _composite(t.content) + ']'; + }, + 'block': function(t) { + return _composite(t.content); + }, + 'braces': function(t) { + return t.content[0] + _composite(t.content.slice(2)) + t.content[1]; + }, + 'class': function(t) { + return '.' + _composite(t.content); + }, + 'color': function(t) { + return '#' + t.content; + }, + 'default': function(t) { + return '!' + _composite(t.content) + 'default'; + }, + 'filter': function(t) { + return _t(t.content[0]) + ':' + _t(t.content[1]); + }, + 'functionExpression': function(t) { + return 'expression(' + t.content + ')'; + }, + 'id': function (t) { + return '#' + t.content; + }, + 'important': function(t) { + return '!' + _composite(t.content) + 'important'; + }, + 'interpolation': function(t) { + return '#{' + _composite(t.content) + '}'; + }, + 'multilineComment': function (t) { + return '/*' + t.content; + }, + 'nthSelector': function(t) { + return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; + }, + 'percentage': function(t) { + return _composite(t.content) + '%'; + }, + 'placeholder': function(t) { + return '%' + _composite(t.content); + }, + 'pseudoClass': function(t) { + return ':' + _composite(t.content); + }, + 'pseudoElement': function(t) { + return '::' + _composite(t.content); + }, + 'singlelineComment': function (t) { + return '/' + '/' + t.content; + }, + 'uri': function(t) { + return 'url(' + _composite(t.content) + ')'; + }, + 'variable': function(t) { + return '$' + _composite(t.content); + }, + 'variablesList': function(t) { + return _composite(t.content) + '...'; + } + }; + + return _t(tree); +} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/tokenizer.js b/node_modules/gonzales-pe/lib/sass/tokenizer.js similarity index 76% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/sass/tokenizer.js rename to node_modules/gonzales-pe/lib/sass/tokenizer.js index 9416772..fa85a84 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/sass/tokenizer.js +++ b/node_modules/gonzales-pe/lib/sass/tokenizer.js @@ -8,7 +8,8 @@ module.exports = function(css) { cn, // next character pos = 0, tn = 0, - ln = 1; + ln = 1, + col = 1; var Punctuation = { ' ': TokenType.Space, @@ -34,6 +35,8 @@ module.exports = function(css) { ';': TokenType.Semicolon, '<': TokenType.LessThanSign, '=': TokenType.EqualsSign, + '==': TokenType.EqualitySign, + '!=': TokenType.InequalitySign, '>': TokenType.GreaterThanSign, '?': TokenType.QuestionMark, '@': TokenType.CommercialAt, @@ -52,8 +55,14 @@ module.exports = function(css) { * @param {string} type * @param {string} value */ - function pushToken(type, value) { - tokens.push({ tn: tn++, ln: ln, type: type, value: value }); + function pushToken(type, value, column) { + tokens.push({ + tn: tn++, + ln: ln, + col: column, + type: type, + value: value + }); } /** @@ -78,8 +87,8 @@ module.exports = function(css) { } // Add a substring containing only spaces to tokens: - pushToken(TokenType.Space, css.substring(start, pos)); - pos--; + pushToken(TokenType.Space, css.substring(start, pos--), col); + col += pos - start; } /** @@ -91,14 +100,15 @@ module.exports = function(css) { var start = pos; // Read the string until we meet a matching quote: - for (pos = pos + 1; pos < css.length; pos++) { + for (pos++; pos < css.length; pos++) { // Skip escaped quotes: if (css.charAt(pos) === '\\') pos++; else if (css.charAt(pos) === q) break; } // Add the string (including quotes) to tokens: - pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1)); + pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1), col); + col += pos - start; } /** @@ -114,8 +124,8 @@ module.exports = function(css) { } // Add the number to tokens: - pushToken(TokenType.DecimalNumber, css.substring(start, pos)); - pos--; + pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col); + col += pos - start; } /** @@ -135,14 +145,34 @@ module.exports = function(css) { else if (css.charAt(pos) in Punctuation) break; } - var ident = css.substring(start, pos); + var ident = css.substring(start, pos--); // Enter url mode if parsed substring is `url`: urlMode = urlMode || ident === 'url'; // Add identifier to tokens: - pushToken(TokenType.Identifier, ident); - pos--; + pushToken(TokenType.Identifier, ident, col); + col += pos - start; + } + + /** + * Parse equality sign + * @param {string} sass Unparsed part of SASS string + */ + function parseEquality(css) { + pushToken(TokenType.EqualitySign, '==', col); + pos++; + col++; + } + + /** + * Parse inequality sign + * @param {string} sass Unparsed part of SASS string + */ + function parseInequality(css) { + pushToken(TokenType.InequalitySign, '!=', col); + pos++; + col++; } /** @@ -160,7 +190,7 @@ module.exports = function(css) { else break; } - for (pos = pos + 2; pos < css.length; pos++) { + for (pos += 2; pos < css.length; pos++) { if (css.charAt(pos) === '\n') { // Get new line's indent level: var _il = 0; @@ -170,13 +200,23 @@ module.exports = function(css) { } if (_il > il) { - pos = _pos; + col = 0; + pos += _pos - pos; } else break; } } // Add full comment (including `/*`) to the list of tokens: - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); + var comment = css.substring(start, pos + 1); + pushToken(TokenType.CommentML, comment, col); + + var newlines = comment.split('\n'); + if (newlines.length > 1) { + ln += newlines.length - 1; + col = newlines[newlines.length - 1].length; + } else { + col += (pos - start); + } } /** @@ -204,13 +244,13 @@ module.exports = function(css) { // Since we already know first 2 characters (`//`), start reading // from `pos + 2`: if (!onlyToken) { - for (pos = pos + 2; pos < css.length; pos++) { + for (pos += 2; pos < css.length; pos++) { if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { break; } } } else { - for (pos = pos + 2; pos < css.length; pos++) { + for (pos+=2; pos < css.length; pos++) { if (css.charAt(pos) === '\n') { // Get new line's indent level: var _il = 0; @@ -220,15 +260,16 @@ module.exports = function(css) { } if (_il > il) { - pos = _pos; + col = 0; + pos += _pos - pos; } else break; } } } // Add comment (including `//` and line break) to the list of tokens: - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; + pushToken(TokenType.CommentSL, css.substring(start, pos--), col); + col += pos - start; } /** @@ -239,7 +280,7 @@ module.exports = function(css) { */ function getTokens(css) { // Parse string, character by character: - for (pos = 0; pos < css.length; pos++) { + for (pos = 0; pos < css.length; col++, pos++) { c = css.charAt(pos); cn = css.charAt(pos + 1); @@ -265,14 +306,27 @@ module.exports = function(css) { // If current character is a space: else if (c === ' ') { - parseSpaces(css) + parseSpaces(css); + } + + // If current character is `=`, it must be combined with next `=` + else if (c === '=' && cn === '=') { + parseEquality(css); + } + + // If we meet `!=`, this must be inequality + else if (c === '!' && cn === '=') { + parseInequality(css); } // If current character is a punctuation mark: else if (c in Punctuation) { // Add it to the list of tokens: - pushToken(Punctuation[c], c); - if (c === '\n' || c === '\r') ln++; // Go to next line + pushToken(Punctuation[c], c, col); + if (c === '\n' || c === '\r') { + ln++; + col = 0; + } // Go to next line if (c === ')') urlMode = false; // exit url mode if (c === '{') blockMode++; // enter a block if (c === '}') blockMode--; // exit a block diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/mark.js b/node_modules/gonzales-pe/lib/scss/mark.js similarity index 100% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/scss/mark.js rename to node_modules/gonzales-pe/lib/scss/mark.js diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/rules.js b/node_modules/gonzales-pe/lib/scss/parse.js similarity index 85% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/scss/rules.js rename to node_modules/gonzales-pe/lib/scss/parse.js index 9c0d7c6..c085f07 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/scss/rules.js +++ b/node_modules/gonzales-pe/lib/scss/parse.js @@ -1,8 +1,9 @@ +var Node = require('../node'); +var NodeType = require('../node-types'); var TokenType = require('../token-types'); -var NodeType = require('./node-types'); module.exports = (function() { - var tokens, tokensLength, pos; + var tokens, tokensLength, pos, needInfo; var rules = { 'arguments': function() { return checkArguments(pos) && getArguments(); }, @@ -122,7 +123,6 @@ module.exports = (function() { return s; } - ///////////////////////////////////// ///////////////////////////////////// ///////////////////////////////////// @@ -197,7 +197,8 @@ module.exports = (function() { * @returns {Number} Length of argument */ function checkArgument(i) { - return checkDeclaration(i) || + return checkBraces(i) || + checkDeclaration(i) || checkFunction(i) || checkVariablesList(i) || checkVariable(i) || @@ -220,7 +221,8 @@ module.exports = (function() { * @returns {Array} Node that is part of arguments list */ function getArgument() { - if (checkDeclaration(pos)) return getDeclaration(); + if (checkBraces(pos)) return getBraces(); + else if (checkDeclaration(pos)) return getDeclaration(); else if (checkFunction(pos)) return getFunction(); else if (checkVariablesList(pos)) return getVariablesList(); else if (checkVariable(pos)) return getVariable(); @@ -266,9 +268,10 @@ module.exports = (function() { pos++; - x = [NodeType.AtkeywordType, getIdent()]; + x = [getIdent()]; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtkeywordType, x, token.ln, token.col); } /** @@ -339,7 +342,7 @@ module.exports = (function() { pos++; - x = [NodeType.AttribType] + x = [] .concat(getSC()) .concat([getIdent()]) .concat(getSC()) @@ -350,7 +353,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttribType, x, token.ln, token.col); } /** @@ -385,14 +389,15 @@ module.exports = (function() { pos++; - x = [NodeType.AttribType] + x = [] .concat(getSC()) .concat([getIdent()]) .concat(getSC()); pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttribType, x, token.ln, token.col); } /** @@ -438,9 +443,8 @@ module.exports = (function() { if (tokens[pos] && tokens[pos].type === TokenType.EqualsSign) s += tokens[pos++].value; - x = [NodeType.AttrselectorType, s]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.AttrselectorType, s, token.ln, token.col); } /** @@ -511,11 +515,12 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulebType, getAtkeyword()] + x = [getAtkeyword()] .concat(getTsets()) .concat([getBlock()]); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulebType, x, token.ln, token.col); } /** @@ -553,7 +558,7 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulerType, getAtkeyword(), getAtrulerq()]; + x = [getAtkeyword(), getAtrulerq()]; pos++; @@ -561,7 +566,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulerType, x, token.ln, token.col); } /** @@ -579,9 +585,10 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulerqType].concat(getTsets()); + x = getTsets(); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulerqType, x, token.ln, token.col); } /** @@ -614,7 +621,7 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulersType].concat(getSC()); + x = getSC(); while (!tokens[pos].atrulers_end) { if (checkSC(pos)) x = x.concat(getSC()); @@ -624,7 +631,8 @@ module.exports = (function() { x = x.concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulersType, x, token.ln, token.col); } /** @@ -652,9 +660,10 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.AtrulesType, getAtkeyword()].concat(getTsets()); + x = [getAtkeyword()].concat(getTsets()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.AtrulesType, x, token.ln, token.col); } /** @@ -674,7 +683,7 @@ module.exports = (function() { function getBlock() { var startPos = pos, end = tokens[pos].right, - x = [NodeType.BlockType]; + x = []; pos++; @@ -686,7 +695,8 @@ module.exports = (function() { pos = end + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.BlockType, x, token.ln, token.col); } /** @@ -924,10 +934,11 @@ module.exports = (function() { pos++; - x = [NodeType.BracesType, tokens[left].value, tokens[right].value] + x = [tokens[left].value, tokens[right].value] .concat(tsets); - return x; + var token = tokens[startPos]; + return new Node(NodeType.BracesType, x, token.ln, token.col); } /** @@ -936,19 +947,21 @@ module.exports = (function() { * @returns {Number} Length of the class selector */ function checkClass(i) { - var l; + var start = i, + l; if (i >= tokensLength) return 0; if (tokens[i].class_l) return tokens[i].class_l; - if (tokens[i++].type === TokenType.FullStop && - (l = checkInterpolation(i) || checkIdent(i))) { - tokens[i].class_l = l + 1; - return l + 1; + if (tokens[i++].type !== TokenType.FullStop) return 0; + + while (i < tokensLength) { + if (l = checkInterpolation(i) || checkIdent(i)) i += l; + else break; } - return 0; + return i - start; } /** @@ -958,13 +971,18 @@ module.exports = (function() { */ function getClass() { var startPos = pos, - x = [NodeType.ClassType]; + x = []; pos++; - x.push(checkInterpolation(pos) ? getInterpolation() : getIdent()); + while (pos < tokensLength) { + if (checkInterpolation(pos)) x.push(getInterpolation()); + else if (checkIdent(pos)) x.push(getIdent()); + else break; + } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ClassType, x, token.ln, token.col); } /** @@ -994,9 +1012,10 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.CombinatorType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.CombinatorType, x, token.ln, token.col); } /** @@ -1023,9 +1042,8 @@ module.exports = (function() { pos++; - x = [NodeType.CommentMLType, s]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.CommentMLType, s, token.ln, token.col); } /** @@ -1046,9 +1064,10 @@ module.exports = (function() { var startPos = pos, x; - x = [NodeType.CommentSLType, tokens[pos++].value.substring(2)]; + x = tokens[pos++].value.substring(2); - return x; + var token = tokens[startPos]; + return new Node(NodeType.CommentSLType, x, token.ln, token.col); } /** @@ -1096,7 +1115,7 @@ module.exports = (function() { */ function getCondition() { var startPos = pos, - x = [NodeType.ConditionType]; + x = []; x.push(getAtkeyword()); @@ -1112,7 +1131,8 @@ module.exports = (function() { x.push(_getCondition()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ConditionType, x, token.ln, token.col); } function _getCondition() { @@ -1153,13 +1173,14 @@ module.exports = (function() { */ function getConditionalStatement() { var startPos = pos, - x = [NodeType.ConditionalStatementType]; + x = []; x.push(getCondition()); x = x.concat(getSC()); x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ConditionalStatementType, x, token.ln, token.col); } /** @@ -1196,7 +1217,7 @@ module.exports = (function() { */ function getDeclaration() { var startPos = pos, - x = [NodeType.DeclarationType]; + x = []; x.push(getProperty()); x = x.concat(getSC()); @@ -1204,7 +1225,8 @@ module.exports = (function() { x = x.concat(getSC()); x.push(getValue()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.DeclarationType, x, token.ln, token.col); } /** @@ -1221,12 +1243,26 @@ module.exports = (function() { * @returns {Array} `['declDelim']` */ function getDeclDelim() { - var startPos = pos, - x = [NodeType.DeclDelimType]; + var startPos = pos++; - pos++; + var token = tokens[startPos]; + return new Node(NodeType.DeclDelimType, ';', token.ln, token.col); + } - return x; + function checkDeepSelector(i) { + if (tokens[i + 2] && + tokens[i].value + tokens[i + 1].value + tokens[i + 2].value === '/deep/') { + return 3; + } + } + + function getDeepSelector() { + var _pos = pos++; + var ident = getIdent(); + ident.content = '/deep/'; + ident.start.column -= 1; + pos = _pos + 3; + return ident; } /** @@ -1252,7 +1288,7 @@ module.exports = (function() { */ function getDefault() { var startPos = pos, - x = [NodeType.DefaultType], + x = [], sc; // Skip `!`: @@ -1265,7 +1301,8 @@ module.exports = (function() { x = x.concat(sc); - return x; + var token = tokens[startPos]; + return new Node(NodeType.DefaultType, x, token.ln, token.col); } /** @@ -1282,12 +1319,12 @@ module.exports = (function() { * @returns {Array} `['delim']` */ function getDelim() { - var startPos = pos, - x = [NodeType.DelimType]; + var startPos = pos; pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.DelimType, ',', token.ln, token.col); } /** @@ -1314,12 +1351,14 @@ module.exports = (function() { */ function getDimension() { var startPos = pos, - x = [NodeType.DimensionType, getNumber()], - ident = [NodeType.IdentType, getNmName2()]; + x = [getNumber()], + token = tokens[pos], + ident = new Node(NodeType.IdentType, getNmName2(), token.ln, token.col); x.push(ident); - return x; + token = tokens[startPos]; + return new Node(NodeType.DimensionType, x, token.ln, token.col); } /** @@ -1349,13 +1388,14 @@ module.exports = (function() { */ function getFilter() { var startPos = pos, - x = [NodeType.FilterType, getFilterp()]; + x = [getFilterp()]; pos++; x.push(getFilterv()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.FilterType, x, token.ln, token.col); } /** @@ -1396,14 +1436,17 @@ module.exports = (function() { */ function getFilterp() { var startPos = pos, - ident = [NodeType.IdentType, joinValues2(pos, tokens[pos].filterp_l)], + token = tokens[pos], + identValue = joinValues2(pos, tokens[pos].filterp_l), + ident = new Node(NodeType.IdentType, identValue, token.ln, token.col), x; pos += tokens[pos].filterp_l; - x = [NodeType.PropertyType, ident].concat(getSC()); + x = [ident].concat(getSC()); - return x; + token = tokens[startPos]; + return new Node(NodeType.PropertyType, x, token.ln, token.col); } /** @@ -1440,7 +1483,7 @@ module.exports = (function() { */ function getFilterv() { var startPos = pos, - x = [NodeType.FiltervType], + x = [], last_progid = tokens[pos].last_progid; x = x.concat(getSC()); @@ -1453,7 +1496,8 @@ module.exports = (function() { if (pos < tokensLength && checkImportant(pos)) x.push(getImportant()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.FiltervType, x, token.ln, token.col); } /** @@ -1482,9 +1526,8 @@ module.exports = (function() { pos = tokens[pos].right + 1; - x = [NodeType.FunctionExpressionType, e]; - - return x; + var token = tokens[startPos]; + return new Node(NodeType.FunctionExpressionType, [e], token.ln, token.col); } /** @@ -1510,14 +1553,15 @@ module.exports = (function() { function getFunction() { var startPos = pos, ident = getIdent(), - x = [NodeType.FunctionType, ident], + x = [ident], body; - body = ident[1] === 'not' ? getNotArguments() : getArguments(); + body = ident.content === 'not' ? getNotArguments() : getArguments(); x.push(body); - return x; + var token = tokens[startPos]; + return new Node(NodeType.FunctionType, x, token.ln, token.col); } /** @@ -1525,7 +1569,7 @@ module.exports = (function() { */ function getArguments() { var startPos = pos, - x = [NodeType.ArgumentsType], + x = [], body; pos++; @@ -1534,7 +1578,7 @@ module.exports = (function() { if (checkDeclaration(pos)) x.push(getDeclaration()); else if (checkArgument(pos)) { body = getArgument(); - if (typeof body[0] === 'string') x.push(body); + if (typeof body.content === 'string') x.push(body); else x = x.concat(body); } else if (checkClass(pos)) x.push(getClass()); else throwError(); @@ -1542,7 +1586,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ArgumentsType, x, token.ln, token.col); } /** @@ -1550,7 +1595,7 @@ module.exports = (function() { */ function getNotArguments() { var startPos = pos, - x = [NodeType.ArgumentsType]; + x = []; pos++; @@ -1561,7 +1606,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ArgumentsType, x, token.ln, token.col); } /** @@ -1581,29 +1627,22 @@ module.exports = (function() { // Check if token is part of an identifier starting with `_`: if (tokens[i].type === TokenType.LowLine) return checkIdentLowLine(i); + if (tokens[i].type === TokenType.HyphenMinus && + tokens[i + 1].type === TokenType.DecimalNumber) return 0; + // If token is a character, `-`, `$` or `*`, skip it & continue: if (l = _checkIdent(i)) i += l; else return 0; - if (l > 1) { - interpolations.push(i - l); - wasInt = true; - } else { - // Remember if previous token's type was identifier: - wasIdent = tokens[i - 1].type === TokenType.Identifier; - } + // Remember if previous token's type was identifier: + wasIdent = tokens[i - 1].type === TokenType.Identifier; while (i < tokensLength) { l = _checkIdent(i); if (!l) break; - if (l > 1) { - wasInt = true; - interpolations.push(i); - } else { - wasIdent = true; - } + wasIdent = true; i += l; } @@ -1620,8 +1659,8 @@ module.exports = (function() { tokens[i].type === TokenType.Identifier || tokens[i].type === TokenType.DollarSign || tokens[i].type === TokenType.LowLine || + tokens[i].type === TokenType.DecimalNumber || tokens[i].type === TokenType.Asterisk) return 1; - if (l = checkInterpolation(i)) return l; return 0; }; @@ -1654,24 +1693,12 @@ module.exports = (function() { */ function getIdent() { var startPos = pos, - interpolations = tokens[pos].interpolations, - x = [NodeType.IdentType]; - - if (interpolations) { - for (var i = 0, l = interpolations.length; i < l; i++) { - var s = joinValues(pos, interpolations[i] - 1); - if (s) x.push(s); - pos = interpolations[i]; - x.push(getInterpolation()); - } - } + x = joinValues(pos, tokens[pos].ident_last); - if (pos < tokensLength && pos <= tokens[startPos].ident_last) { - x.push(joinValues(pos, tokens[startPos].ident_last)); - pos = tokens[pos].ident_last + 1; - } + pos = tokens[pos].ident_last + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.IdentType, x, token.ln, token.col); } /** @@ -1697,7 +1724,7 @@ module.exports = (function() { */ function getImportant() { var startPos = pos, - x = [NodeType.ImportantType]; + x = []; pos++; @@ -1705,7 +1732,8 @@ module.exports = (function() { pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ImportantType, x, token.ln, token.col); } /** @@ -1784,7 +1812,7 @@ module.exports = (function() { */ function getInclude1() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -1800,7 +1828,8 @@ module.exports = (function() { x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1841,7 +1870,7 @@ module.exports = (function() { */ function getInclude2() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -1853,7 +1882,8 @@ module.exports = (function() { x.push(getArguments()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1892,7 +1922,7 @@ module.exports = (function() { */ function getInclude3() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -1904,7 +1934,8 @@ module.exports = (function() { x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1934,7 +1965,7 @@ module.exports = (function() { */ function getInclude4() { var startPos = pos, - x = [NodeType.IncludeType]; + x = []; x.push(getAtkeyword()); @@ -1942,7 +1973,8 @@ module.exports = (function() { x.push(getIncludeSelector()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.IncludeType, x, token.ln, token.col); } /** @@ -1954,7 +1986,7 @@ module.exports = (function() { l; while (i < tokensLength) { - if (l = checkSimpleSelector2(i)) i += l; + if (l = checkIncludeSelector_(i)) i += l; else break; } @@ -1966,19 +1998,50 @@ module.exports = (function() { */ function getIncludeSelector() { var startPos = pos, - x = [NodeType.SimpleselectorType], + x = [], t; - while (pos < tokensLength && checkSimpleSelector2(pos)) { - t = getSimpleSelector2(); + while (pos < tokensLength && checkIncludeSelector_(pos)) { + t = getIncludeSelector_(); - if (typeof t[0] === 'string') x.push(t); + if (typeof t.content === 'string') x.push(t); else x = x.concat(t); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SimpleselectorType, x, token.ln, token.col); + } + + /** + * @param {Number} i Token's index number + * @returns {Number} + */ + function checkIncludeSelector_(i) { + return checkNthselector(i) || + checkAttrib(i) || + checkPseudo(i) || + checkShash(i) || + checkPlaceholder(i) || + checkIdent(i) || + checkClass(i) || + checkInterpolation(i); + } + + /** + * @returns {Array} + */ + function getIncludeSelector_() { + if (checkNthselector(pos)) return getNthselector(); + else if (checkAttrib(pos)) return getAttrib(); + else if (checkPseudo(pos)) return getPseudo(); + else if (checkShash(pos)) return getShash(); + else if (checkPlaceholder(pos)) return getPlaceholder(); + else if (checkIdent(pos)) return getIdent(); + else if (checkClass(pos)) return getClass(); + else if (checkInterpolation(pos)) return getInterpolation(); } + /** * Check if token is part of an interpolated variable (e.g. `#{$nani}`). * @param {Number} i Token's index number @@ -2008,7 +2071,7 @@ module.exports = (function() { */ function getInterpolation() { var startPos = pos, - x = [NodeType.InterpolationType]; + x = []; // Skip `#{`: pos += 2; @@ -2018,7 +2081,8 @@ module.exports = (function() { // Skip `}`: pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.InterpolationType, x, token.ln, token.col); } /** @@ -2060,7 +2124,7 @@ module.exports = (function() { */ function getLoop() { var startPos = pos, - x = [NodeType.LoopType]; + x = []; x.push(getAtkeyword()); @@ -2078,7 +2142,8 @@ module.exports = (function() { else if (checkString(pos)) x.push(getString()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.LoopType, x, token.ln, token.col); } /** @@ -2118,7 +2183,7 @@ module.exports = (function() { */ function getMixin() { var startPos = pos, - x = [NodeType.MixinType, getAtkeyword()]; + x = [getAtkeyword()]; x = x.concat(getSC()); @@ -2132,7 +2197,8 @@ module.exports = (function() { if (checkBlock(pos)) x.push(getBlock()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.MixinType, x, token.ln, token.col); } /** @@ -2149,12 +2215,12 @@ module.exports = (function() { * @returns {Array} `['namespace']` */ function getNamespace() { - var startPos = pos, - x = [NodeType.NamespaceType]; + var startPos = pos; pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.NamespaceType, '|', token.ln, token.col); } /** @@ -2258,16 +2324,17 @@ module.exports = (function() { */ function getNth() { var startPos = pos, - x = [NodeType.NthType]; + x; if (tokens[pos].nth_last) { - x.push(joinValues(pos, tokens[pos].nth_last)); + x = joinValues(pos, tokens[pos].nth_last); pos = tokens[pos].nth_last + 1; } else { - x.push(tokens[pos++].value); + x = tokens[pos++].value; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.NthType, x, token.ln, token.col); } /** @@ -2368,8 +2435,9 @@ module.exports = (function() { */ function getNthselector() { var startPos = pos, - nthf = [NodeType.IdentType, getNthf()], - x = [NodeType.NthselectorType]; + token = tokens[pos], + nthf = new Node(NodeType.IdentType, getNthf(), token.ln, token.col), + x = []; x.push(nthf); @@ -2384,7 +2452,8 @@ module.exports = (function() { pos++; - return x; + token = tokens[startPos]; + return new Node(NodeType.NthselectorType, x, token.ln, token.col); } /** @@ -2434,8 +2503,7 @@ module.exports = (function() { function getNumber() { var s = '', startPos = pos, - l = tokens[pos].number_l, - x = [NodeType.NumberType]; + l = tokens[pos].number_l; for (var j = 0; j < l; j++) { s += tokens[pos + j].value; @@ -2443,9 +2511,8 @@ module.exports = (function() { pos += l; - x.push(s); - - return x; + var token = tokens[startPos]; + return new Node(NodeType.NumberType, s, token.ln, token.col); } /** @@ -2461,6 +2528,8 @@ module.exports = (function() { case TokenType.Comma: case TokenType.Colon: case TokenType.EqualsSign: + case TokenType.EqualitySign: + case TokenType.InequalitySign: case TokenType.LessThanSign: case TokenType.GreaterThanSign: case TokenType.Asterisk: @@ -2477,9 +2546,10 @@ module.exports = (function() { */ function getOperator() { var startPos = pos, - x = [NodeType.OperatorType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.OperatorType, x, token.ln, token.col); } /** @@ -2496,12 +2566,12 @@ module.exports = (function() { * @returns {Array} `['parentSelector']` */ function getParentSelector() { - var startPos = pos, - x = [NodeType.ParentSelectorType, '&']; + var startPos = pos; pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.ParentSelectorType, '&', token.ln, token.col); } /** @@ -2528,11 +2598,12 @@ module.exports = (function() { */ function getPercentage() { var startPos = pos, - x = [NodeType.PercentageType, getNumber()]; + x = [getNumber()]; pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.PercentageType, x, token.ln, token.col); } /** @@ -2560,13 +2631,14 @@ module.exports = (function() { */ function getPlaceholder() { var startPos = pos, - x = [NodeType.PlaceholderType]; + x = []; pos++; x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PlaceholderType, x, token.ln, token.col); } /** @@ -2607,12 +2679,13 @@ module.exports = (function() { progid_end = tokens[pos].progid_end, x; - x = [NodeType.ProgidType] + x = [] .concat(getSC()) .concat([_getProgid(progid_end)]) .concat(getSC()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ProgidType, x, token.ln, token.col); } /** @@ -2621,11 +2694,12 @@ module.exports = (function() { */ function _getProgid(progid_end) { var startPos = pos, - x = [NodeType.RawType, joinValues(pos, progid_end)]; + x = joinValues(pos, progid_end); pos = progid_end + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.RawType, x, token.ln, token.col); } /** @@ -2651,11 +2725,12 @@ module.exports = (function() { */ function getProperty() { var startPos = pos, - x = [NodeType.PropertyType]; + x = []; x.push(checkVariable(pos) ? getVariable() : getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PropertyType, x, token.ln, token.col); } /** @@ -2672,12 +2747,12 @@ module.exports = (function() { * @returns {Array} `['propertyDelim']` */ function getPropertyDelim() { - var startPos = pos, - x = [NodeType.PropertyDelimType]; + var startPos = pos; pos++; - return x; + var token = tokens[startPos]; + return new Node(NodeType.PropertyDelimType, ':', token.ln, token.col); } /** @@ -2715,13 +2790,14 @@ module.exports = (function() { */ function getPseudoe() { var startPos = pos, - x = [NodeType.PseudoeType]; + x = []; pos += 2; x.push(checkInterpolation(pos) ? getInterpolation() : getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PseudoeType, x, token.ln, token.col); } /** @@ -2741,7 +2817,7 @@ module.exports = (function() { */ function getPseudoc() { var startPos = pos, - x = [NodeType.PseudocType]; + x = []; pos ++; @@ -2749,7 +2825,8 @@ module.exports = (function() { else if (checkFunction(pos)) x.push(getFunction()); else x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.PseudocType, x, token.ln, token.col); } /** @@ -2780,7 +2857,7 @@ module.exports = (function() { */ function getRuleset() { var startPos = pos, - x = [NodeType.RulesetType]; + x = []; while (pos < tokensLength) { if (checkBlock(pos)) {x.push(getBlock()); break;} @@ -2788,7 +2865,8 @@ module.exports = (function() { else break; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.RulesetType, x, token.ln, token.col); } /** @@ -2807,11 +2885,12 @@ module.exports = (function() { */ function getS() { var startPos = pos, - x = [NodeType.SType, joinValues(pos, tokens[pos].ws_last)]; + x = joinValues(pos, tokens[pos].ws_last); pos = tokens[pos].ws_last + 1; - return x; + var token = tokens[startPos]; + return new Node(NodeType.SType, x, token.ln, token.col); } /** @@ -2884,14 +2963,15 @@ module.exports = (function() { */ function getSelector() { var startPos = pos, - x = [NodeType.SelectorType], + x = [], selector_end = tokens[pos].selector_end; while (pos <= selector_end) { x.push(checkDelim(pos) ? getDelim() : getSimpleSelector()); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SelectorType, x, token.ln, token.col); } /** @@ -2916,13 +2996,14 @@ module.exports = (function() { */ function getShash() { var startPos = pos, - x = [NodeType.ShashType]; + x = []; pos++; x.push(getNmName()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.ShashType, x, token.ln, token.col); } /** @@ -2946,18 +3027,19 @@ module.exports = (function() { */ function getSimpleSelector() { var startPos = pos, - x = [NodeType.SimpleselectorType], + x = [], t; while (pos < tokensLength) { if (!checkSimpleSelector1(pos)) break; t = getSimpleSelector1(); - if (typeof t[0] === 'string') x.push(t); + if ((needInfo && typeof t[1] === 'string') || typeof t[0] === 'string') x.push(t); else x = x.concat(t); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.SimpleselectorType, x, token.ln, token.col); } /** @@ -2965,30 +3047,39 @@ module.exports = (function() { * @returns {Number} */ function checkSimpleSelector1(i) { - return checkParentSelector(i) || - checkNthselector(i) || - checkCombinator(i) || - checkAttrib(i) || - checkPseudo(i) || - checkShash(i) || - checkAny(i) || - checkSC(i) || - checkNamespace(i); + var l; + + if (l = checkParentSelector(i)) tokens[i].simpleselector1_child = 1; + else if (l = checkInterpolation(i)) tokens[i].simpleselector1_child = 2; + else if (l = checkNthselector(i)) tokens[i].simpleselector1_child = 3; + else if (l = checkCombinator(i)) tokens[i].simpleselector1_child = 4; + else if (l = checkAttrib(i)) tokens[i].simpleselector1_child = 5; + else if (l = checkPseudo(i)) tokens[i].simpleselector1_child = 6; + else if (l = checkShash(i)) tokens[i].simpleselector1_child = 7; + else if (l = checkAny(i)) tokens[i].simpleselector1_child = 8; + else if (l = checkSC(i)) tokens[i].simpleselector1_child = 9; + else if (l = checkNamespace(i)) tokens[i].simpleselector1_child = 10; + else if (l = checkDeepSelector(i)) tokens[i].simpleselector1_child = 11; + + return l; } /** * @returns {Array} */ function getSimpleSelector1() { - if (checkParentSelector(pos)) return getParentSelector(); - else if (checkNthselector(pos)) return getNthselector(); - else if (checkCombinator(pos)) return getCombinator(); - else if (checkAttrib(pos)) return getAttrib(); - else if (checkPseudo(pos)) return getPseudo(); - else if (checkShash(pos)) return getShash(); - else if (checkAny(pos)) return getAny(); - else if (checkSC(pos)) return getSC(); - else if (checkNamespace(pos)) return getNamespace(); + var childType = tokens[pos].simpleselector1_child; + if (childType === 1) return getParentSelector(); + if (childType === 2) return getInterpolation(); + if (childType === 3) return getNthselector(); + if (childType === 4) return getCombinator(); + if (childType === 5) return getAttrib(); + if (childType === 6) return getPseudo(); + if (childType === 7) return getShash(); + if (childType === 8) return getAny(); + if (childType === 9) return getSC(); + if (childType === 10) return getNamespace(); + if (childType === 11) return getDeepSelector(); } /** @@ -3036,9 +3127,10 @@ module.exports = (function() { */ function getString() { var startPos = pos, - x = [NodeType.StringType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.StringType, x, token.ln, token.col); } /** @@ -3074,7 +3166,7 @@ module.exports = (function() { */ function getStylesheet() { var startPos = pos, - x = [NodeType.StylesheetType]; + x = []; while (pos < tokensLength) { if (checkSC(pos)) x = x.concat(getSC()); @@ -3089,7 +3181,8 @@ module.exports = (function() { else throwError(); } - return x; + var token = tokens[startPos]; + return new Node(NodeType.StylesheetType, x, token.ln, token.col); } /** @@ -3100,7 +3193,8 @@ module.exports = (function() { return checkVhash(i) || checkAny(i) || checkSC(i) || - checkOperator(i); + checkOperator(i) || + checkInterpolation(i); } /** @@ -3111,6 +3205,7 @@ module.exports = (function() { else if (checkAny(pos)) return getAny(); else if (checkSC(pos)) return getSC(); else if (checkOperator(pos)) return getOperator(); + else if (checkInterpolation(pos)) return getInterpolation(); } /** @@ -3138,7 +3233,7 @@ module.exports = (function() { t; while (t = getTset()) { - if (typeof t[0] === 'string') x.push(t); + if (typeof t.content === 'string') x.push(t); else x = x.concat(t); } @@ -3161,9 +3256,10 @@ module.exports = (function() { */ function getUnary() { var startPos = pos, - x = [NodeType.UnaryType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.UnaryType, x, token.ln, token.col); } /** @@ -3179,9 +3275,10 @@ module.exports = (function() { */ function getUnknown() { var startPos = pos, - x = [NodeType.UnknownType, tokens[pos++].value]; + x = tokens[pos++].value; - return x; + var token = tokens[startPos]; + return new Node(NodeType.UnknownType, x, token.ln, token.col); } /** @@ -3208,6 +3305,7 @@ module.exports = (function() { var startPos = pos, uriExcluding = {}, uri, + token, l, raw; @@ -3220,16 +3318,17 @@ module.exports = (function() { uriExcluding[TokenType.RightParenthesis] = 1; if (checkUri1(pos)) { - uri = [NodeType.UriType] + uri = [] .concat(getSC()) .concat([getString()]) .concat(getSC()); pos++; } else { - uri = [NodeType.UriType].concat(getSC()), + uri = [].concat(getSC()), l = checkExcluding(uriExcluding, pos), - raw = [NodeType.RawType, joinValues(pos, pos + l)]; + token = tokens[pos], + raw = new Node(NodeType.RawType, joinValues(pos, pos + l), token.ln, token.col); uri.push(raw); @@ -3240,7 +3339,8 @@ module.exports = (function() { pos++; } - return uri; + token = tokens[startPos]; + return new Node(NodeType.UriType, uri, token.ln, token.col); } /** @@ -3295,11 +3395,11 @@ module.exports = (function() { checkVariable(i) || checkVhash(i) || checkBlock(i) || - checkAny(i) || checkAtkeyword(i) || checkOperator(i) || checkImportant(i) || - checkDefault(i); + checkDefault(i) || + checkAny(i); } /** @@ -3307,7 +3407,7 @@ module.exports = (function() { */ function getValue() { var startPos = pos, - x = [NodeType.ValueType], + x = [], t, _pos, s; while (pos < tokensLength) { @@ -3324,7 +3424,8 @@ module.exports = (function() { if (checkBlock(_pos)) break; } - return x; + var token = tokens[startPos]; + return new Node(NodeType.ValueType, x, token.ln, token.col); } /** @@ -3335,11 +3436,11 @@ module.exports = (function() { else if (checkVariable(pos)) return getVariable(); else if (checkVhash(pos)) return getVhash(); else if (checkBlock(pos)) return getBlock(); - else if (checkAny(pos)) return getAny(); else if (checkAtkeyword(pos)) return getAtkeyword(); else if (checkOperator(pos)) return getOperator(); else if (checkImportant(pos)) return getImportant(); else if (checkDefault(pos)) return getDefault(); + else if (checkAny(pos)) return getAny(); } /** @@ -3362,13 +3463,14 @@ module.exports = (function() { */ function getVariable() { var startPos = pos, - x = [NodeType.VariableType]; + x = []; pos++; x.push(getIdent()); - return x; + var token = tokens[startPos]; + return new Node(NodeType.VariableType, x, token.ln, token.col); } /** @@ -3400,11 +3502,12 @@ module.exports = (function() { */ function getVariablesList() { var startPos = pos, - x = [NodeType.VariablesListType, getVariable()]; + x = getVariable(); pos += 3; - return x; + var token = tokens[startPos]; + return new Node(NodeType.VariablesListType, [x], token.ln, token.col); } /** @@ -3428,17 +3531,19 @@ module.exports = (function() { */ function getVhash() { var startPos = pos, - x = [NodeType.VhashType]; + x; pos++; - x.push(getNmName2()); + x = getNmName2(); - return x; + var token = tokens[startPos]; + return new Node(NodeType.VhashType, x, token.ln, token.col); } - return function(_tokens, rule) { + return function(_tokens, rule, _needInfo) { tokens = _tokens; + needInfo = _needInfo; tokensLength = tokens.length; pos = 0; diff --git a/node_modules/gonzales-pe/lib/scss/stringify.js b/node_modules/gonzales-pe/lib/scss/stringify.js new file mode 100644 index 0000000..3a0530d --- /dev/null +++ b/node_modules/gonzales-pe/lib/scss/stringify.js @@ -0,0 +1,98 @@ +module.exports = function stringify(tree) { + // TODO: Better error message + if (!tree) throw new Error('We need tree to translate'); + + function _t(tree) { + var type = tree.type; + if (_unique[type]) return _unique[type](tree); + if (typeof tree.content === 'string') return tree.content; + if (Array.isArray(tree.content)) return _composite(tree.content); + return ''; + } + + function _composite(t, i) { + if (!t) return ''; + + var s = ''; + i = i || 0; + for (; i < t.length; i++) s += _t(t[i]); + return s; + } + + var _unique = { + 'arguments': function(t) { + return '(' + _composite(t.content) + ')'; + }, + 'atkeyword': function(t) { + return '@' + _composite(t.content); + }, + 'atruler': function(t) { + return _t(t.content[0]) + _t(t.content[1]) + '{' + _t(t.content[2]) + '}'; + }, + 'attribute': function(t) { + return '[' + _composite(t.content) + ']'; + }, + 'block': function(t) { + return '{' + _composite(t.content) + '}'; + }, + 'braces': function(t) { + return t.content[0] + _composite(t.content.slice(2)) + t.content[1]; + }, + 'class': function(t) { + return '.' + _composite(t.content); + }, + 'color': function(t) { + return '#' + t.content; + }, + 'default': function(t) { + return '!' + _composite(t.content) + 'default'; + }, + 'filter': function(t) { + return _t(t.content[0]) + ':' + _t(t.content[1]); + }, + 'functionExpression': function(t) { + return 'expression(' + t.content + ')'; + }, + 'id': function (t) { + return '#' + t.content; + }, + 'important': function(t) { + return '!' + _composite(t.content) + 'important'; + }, + 'interpolation': function(t) { + return '#{' + _composite(t.content) + '}'; + }, + 'multilineComment': function (t) { + return '/*' + t.content + '*/'; + }, + 'nthSelector': function(t) { + return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')'; + }, + 'percentage': function(t) { + return _composite(t.content) + '%'; + }, + 'placeholder': function(t) { + return '%' + _composite(t.content); + }, + 'pseudoClass': function(t) { + return ':' + _composite(t.content); + }, + 'pseudoElement': function(t) { + return '::' + _composite(t.content); + }, + 'singlelineComment': function (t) { + return '/' + '/' + t.content; + }, + 'uri': function(t) { + return 'url(' + _composite(t.content) + ')'; + }, + 'variable': function(t) { + return '$' + _composite(t.content); + }, + 'variablesList': function(t) { + return _composite(t.content) + '...'; + } + }; + + return _t(tree); +} diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/tokenizer.js b/node_modules/gonzales-pe/lib/scss/tokenizer.js similarity index 74% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/less/tokenizer.js rename to node_modules/gonzales-pe/lib/scss/tokenizer.js index e67d138..e0c5218 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/less/tokenizer.js +++ b/node_modules/gonzales-pe/lib/scss/tokenizer.js @@ -8,7 +8,8 @@ module.exports = function(css) { cn, // next character pos = 0, tn = 0, - ln = 1; + ln = 1, + col = 1; var Punctuation = { ' ': TokenType.Space, @@ -34,6 +35,8 @@ module.exports = function(css) { ';': TokenType.Semicolon, '<': TokenType.LessThanSign, '=': TokenType.EqualsSign, + '==': TokenType.EqualitySign, + '!=': TokenType.InequalitySign, '>': TokenType.GreaterThanSign, '?': TokenType.QuestionMark, '@': TokenType.CommercialAt, @@ -52,8 +55,14 @@ module.exports = function(css) { * @param {string} type * @param {string} value */ - function pushToken(type, value) { - tokens.push({ tn: tn++, ln: ln, type: type, value: value }); + function pushToken(type, value, column) { + tokens.push({ + tn: tn++, + ln: ln, + col: column, + type: type, + value: value + }); } /** @@ -78,8 +87,8 @@ module.exports = function(css) { } // Add a substring containing only spaces to tokens: - pushToken(TokenType.Space, css.substring(start, pos)); - pos--; + pushToken(TokenType.Space, css.substring(start, pos--), col); + col += pos - start; } /** @@ -91,14 +100,15 @@ module.exports = function(css) { var start = pos; // Read the string until we meet a matching quote: - for (pos = pos + 1; pos < css.length; pos++) { + for (pos++; pos < css.length; pos++) { // Skip escaped quotes: if (css.charAt(pos) === '\\') pos++; else if (css.charAt(pos) === q) break; } // Add the string (including quotes) to tokens: - pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1)); + pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1), col); + col += pos - start; } /** @@ -114,8 +124,8 @@ module.exports = function(css) { } // Add the number to tokens: - pushToken(TokenType.DecimalNumber, css.substring(start, pos)); - pos--; + pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col); + col += pos - start; } /** @@ -135,16 +145,37 @@ module.exports = function(css) { else if (css.charAt(pos) in Punctuation) break; } - var ident = css.substring(start, pos); + var ident = css.substring(start, pos--); // Enter url mode if parsed substring is `url`: urlMode = urlMode || ident === 'url'; // Add identifier to tokens: - pushToken(TokenType.Identifier, ident); - pos--; + pushToken(TokenType.Identifier, ident, col); + col += pos - start; } + /** + * Parse equality sign + * @param {string} sass Unparsed part of SASS string + */ + function parseEquality(css) { + pushToken(TokenType.EqualitySign, '==', col); + pos++; + col++; + } + + /** + * Parse inequality sign + * @param {string} sass Unparsed part of SASS string + */ + function parseInequality(css) { + pushToken(TokenType.InequalitySign, '!=', col); + pos++; + col++; + } + + /** * Parse a multiline comment * @param {string} css Unparsed part of CSS string @@ -155,7 +186,7 @@ module.exports = function(css) { // Read the string until we meet `*/`. // Since we already know first 2 characters (`/*`), start reading // from `pos + 2`: - for (pos = pos + 2; pos < css.length; pos++) { + for (pos += 2; pos < css.length; pos++) { if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') { pos++; break; @@ -163,7 +194,16 @@ module.exports = function(css) { } // Add full comment (including `/*` and `*/`) to the list of tokens: - pushToken(TokenType.CommentML, css.substring(start, pos + 1)); + var comment = css.substring(start, pos + 1); + pushToken(TokenType.CommentML, comment, col); + + var newlines = comment.split('\n'); + if (newlines.length > 1) { + ln += newlines.length - 1; + col = newlines[newlines.length - 1].length; + } else { + col += (pos - start); + } } /** @@ -176,15 +216,15 @@ module.exports = function(css) { // Read the string until we meet line break. // Since we already know first 2 characters (`//`), start reading // from `pos + 2`: - for (pos = pos + 2; pos < css.length; pos++) { + for (pos += 2; pos < css.length; pos++) { if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') { break; } } // Add comment (including `//` and line break) to the list of tokens: - pushToken(TokenType.CommentSL, css.substring(start, pos)); - pos--; + pushToken(TokenType.CommentSL, css.substring(start, pos--), col); + col += pos - start; } /** @@ -195,7 +235,7 @@ module.exports = function(css) { */ function getTokens(css) { // Parse string, character by character: - for (pos = 0; pos < css.length; pos++) { + for (pos = 0; pos < css.length; col++, pos++) { c = css.charAt(pos); cn = css.charAt(pos + 1); @@ -221,14 +261,27 @@ module.exports = function(css) { // If current character is a space: else if (c === ' ') { - parseSpaces(css) + parseSpaces(css); + } + + // If current character is `=`, it must be combined with next `=` + else if (c === '=' && cn === '=') { + parseEquality(css); + } + + // If we meet `!=`, this must be inequality + else if (c === '!' && cn === '=') { + parseInequality(css); } // If current character is a punctuation mark: else if (c in Punctuation) { // Add it to the list of tokens: - pushToken(Punctuation[c], c); - if (c === '\n' || c === '\r') ln++; // Go to next line + pushToken(Punctuation[c], c, col); + if (c === '\n' || c === '\r') { + ln++; + col = 0; + } // Go to next line if (c === ')') urlMode = false; // exit url mode if (c === '{') blockMode++; // enter a block if (c === '}') blockMode--; // exit a block diff --git a/node_modules/csscomb/node_modules/gonzales-pe/lib/token-types.js b/node_modules/gonzales-pe/lib/token-types.js similarity index 94% rename from node_modules/csscomb/node_modules/gonzales-pe/lib/token-types.js rename to node_modules/gonzales-pe/lib/token-types.js index 8fa6fb0..fb8fc1f 100644 --- a/node_modules/csscomb/node_modules/gonzales-pe/lib/token-types.js +++ b/node_modules/gonzales-pe/lib/token-types.js @@ -27,6 +27,8 @@ module.exports = { Semicolon: 'Semicolon', // ; LessThanSign: 'LessThanSign', // < EqualsSign: 'EqualsSign', // = + EqualitySign: 'EqualitySign', // == + InequalitySign: 'InequalitySign', // != GreaterThanSign: 'GreaterThanSign', // > QuestionMark: 'QuestionMark', // ? CommercialAt: 'CommercialAt', // @ diff --git a/node_modules/gonzales-pe/package.json b/node_modules/gonzales-pe/package.json new file mode 100644 index 0000000..e8b5729 --- /dev/null +++ b/node_modules/gonzales-pe/package.json @@ -0,0 +1,83 @@ +{ + "_args": [ + [ + "gonzales-pe@3.0.0-28", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb" + ] + ], + "_from": "gonzales-pe@3.0.0-28", + "_id": "gonzales-pe@3.0.0-28", + "_inCache": true, + "_installable": true, + "_location": "/gonzales-pe", + "_npmUser": { + "email": "tonyganch+github@gmail.com", + "name": "tonyganch" + }, + "_npmVersion": "2.0.0-beta.0", + "_phantomChildren": {}, + "_requested": { + "name": "gonzales-pe", + "raw": "gonzales-pe@3.0.0-28", + "rawSpec": "3.0.0-28", + "scope": null, + "spec": "3.0.0-28", + "type": "version" + }, + "_requiredBy": [ + "/csscomb", + "/csscomb-core" + ], + "_resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-28.tgz", + "_shasum": "dd50b41dd15b682a28c40e5f0ff2007901ac62bd", + "_shrinkwrap": null, + "_spec": "gonzales-pe@3.0.0-28", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb", + "author": { + "email": "tonyganch+github@gmail.com", + "name": "Tony Ganch", + "url": "http://tonyganch.com" + }, + "bin": { + "gonzales": "./bin/gonzales.js" + }, + "bugs": { + "url": "http://github.com/tonyganch/gonzales-pe/issues" + }, + "dependencies": {}, + "description": "Gonzales Preprocessor Edition (fast CSS parser)", + "devDependencies": { + "coffee-script": "~1.7.1", + "mocha": "~1.20.0" + }, + "directories": {}, + "dist": { + "shasum": "dd50b41dd15b682a28c40e5f0ff2007901ac62bd", + "tarball": "http://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-28.tgz" + }, + "engines": { + "node": ">=0.6.0" + }, + "gitHead": "b3c273defdef00c499ed739648c74ae9e2649147", + "homepage": "http://github.com/tonyganch/gonzales-pe", + "license": "MIT", + "main": "./lib/gonzales", + "maintainers": [ + { + "name": "tonyganch", + "email": "tonyganch@gmail.com" + } + ], + "name": "gonzales-pe", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/tonyganch/gonzales-pe.git" + }, + "scripts": { + "log": "(mkdir -p log && node ./test/mocha.js) | tee ./log/test.log", + "test": "node ./test/mocha.js" + }, + "version": "3.0.0-28" +} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/LICENSE b/node_modules/inherits/LICENSE similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/LICENSE rename to node_modules/inherits/LICENSE diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/README.md b/node_modules/inherits/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/README.md rename to node_modules/inherits/README.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/inherits.js rename to node_modules/inherits/inherits.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/inherits_browser.js b/node_modules/inherits/inherits_browser.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/inherits_browser.js rename to node_modules/inherits/inherits_browser.js diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json new file mode 100644 index 0000000..ad7d617 --- /dev/null +++ b/node_modules/inherits/package.json @@ -0,0 +1,77 @@ +{ + "_args": [ + [ + "inherits@2", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/glob" + ] + ], + "_from": "inherits@>=2.0.0 <3.0.0", + "_id": "inherits@2.0.1", + "_inCache": true, + "_installable": true, + "_location": "/inherits", + "_npmUser": { + "email": "i@izs.me", + "name": "isaacs" + }, + "_npmVersion": "1.3.8", + "_phantomChildren": {}, + "_requested": { + "name": "inherits", + "raw": "inherits@2", + "rawSpec": "2", + "scope": null, + "spec": ">=2.0.0 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_shrinkwrap": null, + "_spec": "inherits@2", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/glob", + "browser": "./inherits_browser.js", + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "dependencies": {}, + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "homepage": "https://github.com/isaacs/inherits#readme", + "keywords": [ + "browser", + "browserify", + "class", + "inheritance", + "inherits", + "klass", + "object-oriented", + "oop" + ], + "license": "ISC", + "main": "./inherits.js", + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "name": "inherits", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits.git" + }, + "scripts": { + "test": "node test" + }, + "version": "2.0.1" +} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/test.js b/node_modules/inherits/test.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/glob/node_modules/inherits/test.js rename to node_modules/inherits/test.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/.npmignore b/node_modules/lru-cache/.npmignore similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/.npmignore rename to node_modules/lru-cache/.npmignore diff --git a/node_modules/lru-cache/.travis.yml b/node_modules/lru-cache/.travis.yml new file mode 100644 index 0000000..4af02b3 --- /dev/null +++ b/node_modules/lru-cache/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - '0.8' + - '0.10' + - '0.12' + - 'iojs' +before_install: + - npm install -g npm@latest diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS b/node_modules/lru-cache/CONTRIBUTORS similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS rename to node_modules/lru-cache/CONTRIBUTORS diff --git a/node_modules/lru-cache/LICENSE b/node_modules/lru-cache/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/lru-cache/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/README.md b/node_modules/lru-cache/README.md similarity index 70% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/README.md rename to node_modules/lru-cache/README.md index 03ee0f9..c06814e 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/README.md +++ b/node_modules/lru-cache/README.md @@ -24,6 +24,24 @@ If you put more stuff in it, then items will fall out. If you try to put an oversized thing in it, then it'll fall out right away. +## Keys should always be Strings or Numbers + +Note: this module will print warnings to `console.error` if you use a +key that is not a String or Number. Because items are stored in an +object, which coerces keys to a string, it won't go well for you if +you try to use a key that is not a unique string, it'll cause surprise +collisions. For example: + +```JavaScript +// Bad Example! Dont' do this! +var cache = LRU() +var a = {} +var b = {} +cache.set(a, 'this is a') +cache.set(b, 'this is b') +console.log(cache.get(a)) // prints: 'this is b' +``` + ## Options * `max` The maximum size of the cache, checked by applying the length @@ -36,7 +54,7 @@ away. * `length` Function that is used to calculate the length of stored items. If you're storing strings or buffers, then you probably want to do something like `function(n){return n.length}`. The default is - `function(n){return 1}`, which is fine if you want to store `n` + `function(n){return 1}`, which is fine if you want to store `max` like-sized things. * `dispose` Function that is called on items when they are dropped from the cache. This can be handy if you want to close file @@ -54,11 +72,12 @@ away. ## API -* `set(key, value)` +* `set(key, value, maxAge)` * `get(key) => value` Both of these will update the "recently used"-ness of the key. - They do what you think. + They do what you think. `max` is optional and overrides the + cache `max` option if provided. * `peek(key)` @@ -95,3 +114,24 @@ away. * `values()` Return an array of the values in the cache. + +* `length()` + + Return total length of objects in cache taking into account + `length` options function. + +* `itemCount` + + Return total quantity of objects currently in cache. Note, that + `stale` (see options) items are returned as part of this item + count. + +* `dump()` + + Return an array of the cache entries ready for serialization and usage + with 'destinationCache.load(arr)`. + +* `load(cacheEntriesArray)` + + Loads another cache entries array, obtained with `sourceCache.dump()`, + into the cache. The destination cache is reset before loading new entries diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js b/node_modules/lru-cache/lib/lru-cache.js similarity index 70% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js rename to node_modules/lru-cache/lib/lru-cache.js index d1d1381..2bbe653 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +++ b/node_modules/lru-cache/lib/lru-cache.js @@ -13,6 +13,14 @@ function hOP (obj, key) { function naiveLength () { return 1 } +var didTypeWarning = false +function typeCheckKey(key) { + if (!didTypeWarning && typeof key !== 'string' && typeof key !== 'number') { + didTypeWarning = true + console.error(new TypeError("LRU: key must be a string or number. Almost certainly a bug! " + typeof key).stack) + } +} + function LRUCache (options) { if (!(this instanceof LRUCache)) return new LRUCache(options) @@ -86,11 +94,13 @@ Object.defineProperty(LRUCache.prototype, "itemCount", LRUCache.prototype.forEach = function (fn, thisp) { thisp = thisp || this - var i = 0; - for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) { + var i = 0 + var itemCount = this._itemCount + + for (var k = this._mru - 1; k >= 0 && i < itemCount; k--) if (this._lruList[k]) { i++ var hit = this._lruList[k] - if (this._maxAge && (Date.now() - hit.now > this._maxAge)) { + if (isStale(this, hit)) { del(this, hit) if (!this._allowStale) hit = undefined } @@ -135,29 +145,60 @@ LRUCache.prototype.reset = function () { this._itemCount = 0 } -// Provided for debugging/dev purposes only. No promises whatsoever that -// this API stays stable. LRUCache.prototype.dump = function () { - return this._cache + var arr = [] + var i = 0 + + for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) { + var hit = this._lruList[k] + if (!isStale(this, hit)) { + //Do not store staled hits + ++i + arr.push({ + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }); + } + } + //arr has the most read first + return arr } LRUCache.prototype.dumpLru = function () { return this._lruList } -LRUCache.prototype.set = function (key, value) { +LRUCache.prototype.set = function (key, value, maxAge) { + maxAge = maxAge || this._maxAge + typeCheckKey(key) + + var now = maxAge ? Date.now() : 0 + var len = this._lengthCalculator(value) + if (hOP(this._cache, key)) { + if (len > this._max) { + del(this, this._cache[key]) + return false + } // dispose of the old one before overwriting - if (this._dispose) this._dispose(key, this._cache[key].value) - if (this._maxAge) this._cache[key].now = Date.now() + if (this._dispose) + this._dispose(key, this._cache[key].value) + + this._cache[key].now = now + this._cache[key].maxAge = maxAge this._cache[key].value = value + this._length += (len - this._cache[key].length) + this._cache[key].length = len this.get(key) + + if (this._length > this._max) + trim(this) + return true } - var len = this._lengthCalculator(value) - var age = this._maxAge ? Date.now() : 0 - var hit = new Entry(key, value, this._mru++, len, age) + var hit = new Entry(key, value, this._mru++, len, now, maxAge) // oversized objects fall out of cache automatically. if (hit.length > this._max) { @@ -169,24 +210,29 @@ LRUCache.prototype.set = function (key, value) { this._lruList[hit.lu] = this._cache[key] = hit this._itemCount ++ - if (this._length > this._max) trim(this) + if (this._length > this._max) + trim(this) + return true } LRUCache.prototype.has = function (key) { + typeCheckKey(key) if (!hOP(this._cache, key)) return false var hit = this._cache[key] - if (this._maxAge && (Date.now() - hit.now > this._maxAge)) { + if (isStale(this, hit)) { return false } return true } LRUCache.prototype.get = function (key) { + typeCheckKey(key) return get(this, key, true) } LRUCache.prototype.peek = function (key) { + typeCheckKey(key) return get(this, key, false) } @@ -197,13 +243,36 @@ LRUCache.prototype.pop = function () { } LRUCache.prototype.del = function (key) { + typeCheckKey(key) del(this, this._cache[key]) } +LRUCache.prototype.load = function (arr) { + //reset the cache + this.reset(); + + var now = Date.now() + //A previous serialized cache has the most recent items first + for (var l = arr.length - 1; l >= 0; l-- ) { + var hit = arr[l] + typeCheckKey(hit.k) + var expiresAt = hit.e || 0 + if (expiresAt === 0) { + //the item was created without expiration in a non aged cache + this.set(hit.k, hit.v) + } else { + var maxAge = expiresAt - now + //dont add already expired items + if (maxAge > 0) this.set(hit.k, hit.v, maxAge) + } + } +} + function get (self, key, doUse) { + typeCheckKey(key) var hit = self._cache[key] if (hit) { - if (self._maxAge && (Date.now() - hit.now > self._maxAge)) { + if (isStale(self, hit)) { del(self, hit) if (!self._allowStale) hit = undefined } else { @@ -214,6 +283,18 @@ function get (self, key, doUse) { return hit } +function isStale(self, hit) { + if (!hit || (!hit.maxAge && !self._maxAge)) return false + var stale = false; + var diff = Date.now() - hit.now + if (hit.maxAge) { + stale = diff > hit.maxAge + } else { + stale = self._maxAge && (diff > self._maxAge) + } + return stale; +} + function use (self, hit) { shiftLU(self, hit) hit.lu = self._mru ++ @@ -241,12 +322,13 @@ function del (self, hit) { } // classy, since V8 prefers predictable objects. -function Entry (key, value, lu, length, now) { +function Entry (key, value, lu, length, now, maxAge) { this.key = key this.value = value this.lu = lu this.length = length this.now = now + if (maxAge) this.maxAge = maxAge } })() diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json new file mode 100644 index 0000000..bd862ac --- /dev/null +++ b/node_modules/lru-cache/package.json @@ -0,0 +1,84 @@ +{ + "_args": [ + [ + "lru-cache@2", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/minimatch" + ] + ], + "_from": "lru-cache@>=2.0.0 <3.0.0", + "_id": "lru-cache@2.7.3", + "_inCache": true, + "_installable": true, + "_location": "/lru-cache", + "_nodeVersion": "4.0.0", + "_npmUser": { + "email": "i@izs.me", + "name": "isaacs" + }, + "_npmVersion": "3.3.2", + "_phantomChildren": {}, + "_requested": { + "name": "lru-cache", + "raw": "lru-cache@2", + "rawSpec": "2", + "scope": null, + "spec": ">=2.0.0 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/minimatch" + ], + "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "_shasum": "6d4524e8b955f95d4f5b58851ce21dd72fb4e952", + "_shrinkwrap": null, + "_spec": "lru-cache@2", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/minimatch", + "author": { + "email": "i@izs.me", + "name": "Isaac Z. Schlueter" + }, + "bugs": { + "url": "https://github.com/isaacs/node-lru-cache/issues" + }, + "dependencies": {}, + "description": "A cache object that deletes the least-recently-used items.", + "devDependencies": { + "tap": "^1.2.0", + "weak": "" + }, + "directories": {}, + "dist": { + "shasum": "6d4524e8b955f95d4f5b58851ce21dd72fb4e952", + "tarball": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz" + }, + "gitHead": "292048199f6d28b77fbe584279a1898e25e4c714", + "homepage": "https://github.com/isaacs/node-lru-cache#readme", + "keywords": [ + "cache", + "lru", + "mru" + ], + "license": "ISC", + "main": "lib/lru-cache.js", + "maintainers": [ + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + } + ], + "name": "lru-cache", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-lru-cache.git" + }, + "scripts": { + "test": "tap test --gc" + }, + "version": "2.7.3" +} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/basic.js b/node_modules/lru-cache/test/basic.js similarity index 86% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/basic.js rename to node_modules/lru-cache/test/basic.js index f72697c..b47225f 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/basic.js +++ b/node_modules/lru-cache/test/basic.js @@ -93,31 +93,6 @@ test("reset", function (t) { }) -// Note: `.dump()` is a debugging tool only. No guarantees are made -// about the format/layout of the response. -test("dump", function (t) { - var cache = new LRU(10) - var d = cache.dump(); - t.equal(Object.keys(d).length, 0, "nothing in dump for empty cache") - cache.set("a", "A") - var d = cache.dump() // { a: { key: "a", value: "A", lu: 0 } } - t.ok(d.a) - t.equal(d.a.key, "a") - t.equal(d.a.value, "A") - t.equal(d.a.lu, 0) - - cache.set("b", "B") - cache.get("b") - d = cache.dump() - t.ok(d.b) - t.equal(d.b.key, "b") - t.equal(d.b.value, "B") - t.equal(d.b.lu, 2) - - t.end() -}) - - test("basic with weighed length", function (t) { var cache = new LRU({ max: 100, @@ -182,6 +157,32 @@ test("lru recently gotten with weighed length", function (t) { t.end() }) +test("lru recently updated with weighed length", function (t) { + var cache = new LRU({ + max: 8, + length: function (item) { return item.length } + }) + cache.set("a", "A") + cache.set("b", "BB") + cache.set("c", "CCC") + t.equal(cache.length, 6) //CCC BB A + cache.set("a", "+A") + t.equal(cache.length, 7) //+A CCC BB + cache.set("b", "++BB") + t.equal(cache.length, 6) //++BB +A + t.equal(cache.get("c"), undefined) + + cache.set("c", "oversized") + t.equal(cache.length, 6) //++BB +A + t.equal(cache.get("c"), undefined) + + cache.set("a", "oversized") + t.equal(cache.length, 4) //++BB + t.equal(cache.get("a"), undefined) + t.equal(cache.get("b"), "++BB") + t.end() +}) + test("set returns proper booleans", function(t) { var cache = new LRU({ max: 5, @@ -215,7 +216,7 @@ test("drop the old items", function(t) { cache.set("c", "C") // timed out t.notOk(cache.get("a")) - }, 60) + }, 60 + 25) setTimeout(function () { t.notOk(cache.get("b")) @@ -228,6 +229,32 @@ test("drop the old items", function(t) { }, 155) }) +test("individual item can have it's own maxAge", function(t) { + var cache = new LRU({ + max: 5, + maxAge: 50 + }) + + cache.set("a", "A", 20) + setTimeout(function () { + t.notOk(cache.get("a")) + t.end() + }, 25) +}) + +test("individual item can have it's own maxAge > cache's", function(t) { + var cache = new LRU({ + max: 5, + maxAge: 20 + }) + + cache.set("a", "A", 50) + setTimeout(function () { + t.equal(cache.get("a"), "A") + t.end() + }, 25) +}) + test("disposal function", function(t) { var disposed = false var cache = new LRU({ diff --git a/node_modules/lru-cache/test/foreach.js b/node_modules/lru-cache/test/foreach.js new file mode 100644 index 0000000..4190417 --- /dev/null +++ b/node_modules/lru-cache/test/foreach.js @@ -0,0 +1,120 @@ +var test = require('tap').test +var LRU = require('../') + +test('forEach', function (t) { + var l = new LRU(5) + for (var i = 0; i < 10; i ++) { + l.set(i.toString(), i.toString(2)) + } + + var i = 9 + l.forEach(function (val, key, cache) { + t.equal(cache, l) + t.equal(key, i.toString()) + t.equal(val, i.toString(2)) + i -= 1 + }) + + // get in order of most recently used + l.get(6) + l.get(8) + + var order = [ 8, 6, 9, 7, 5 ] + var i = 0 + + l.forEach(function (val, key, cache) { + var j = order[i ++] + t.equal(cache, l) + t.equal(key, j.toString()) + t.equal(val, j.toString(2)) + }) + t.equal(i, order.length); + + t.end() +}) + +test('keys() and values()', function (t) { + var l = new LRU(5) + for (var i = 0; i < 10; i ++) { + l.set(i.toString(), i.toString(2)) + } + + t.similar(l.keys(), ['9', '8', '7', '6', '5']) + t.similar(l.values(), ['1001', '1000', '111', '110', '101']) + + // get in order of most recently used + l.get(6) + l.get(8) + + t.similar(l.keys(), ['8', '6', '9', '7', '5']) + t.similar(l.values(), ['1000', '110', '1001', '111', '101']) + + t.end() +}) + +test('all entries are iterated over', function(t) { + var l = new LRU(5) + for (var i = 0; i < 10; i ++) { + l.set(i.toString(), i.toString(2)) + } + + var i = 0 + l.forEach(function (val, key, cache) { + if (i > 0) { + cache.del(key) + } + i += 1 + }) + + t.equal(i, 5) + t.equal(l.keys().length, 1) + + t.end() +}) + +test('all stale entries are removed', function(t) { + var l = new LRU({ max: 5, maxAge: -5, stale: true }) + for (var i = 0; i < 10; i ++) { + l.set(i.toString(), i.toString(2)) + } + + var i = 0 + l.forEach(function () { + i += 1 + }) + + t.equal(i, 5) + t.equal(l.keys().length, 0) + + t.end() +}) + +test('expires', function (t) { + var l = new LRU({ + max: 10, + maxAge: 50 + }) + for (var i = 0; i < 10; i++) { + l.set(i.toString(), i.toString(2), ((i % 2) ? 25 : undefined)) + } + + var i = 0 + var order = [ 8, 6, 4, 2, 0 ] + setTimeout(function () { + l.forEach(function (val, key, cache) { + var j = order[i++] + t.equal(cache, l) + t.equal(key, j.toString()) + t.equal(val, j.toString(2)) + }) + t.equal(i, order.length); + + setTimeout(function () { + var count = 0; + l.forEach(function (val, key, cache) { count++; }) + t.equal(0, count); + t.end() + }, 25) + + }, 26) +}) diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js b/node_modules/lru-cache/test/memory-leak.js similarity index 99% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js rename to node_modules/lru-cache/test/memory-leak.js index 7af45b0..b5912f6 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +++ b/node_modules/lru-cache/test/memory-leak.js @@ -1,5 +1,6 @@ #!/usr/bin/env node --expose_gc + var weak = require('weak'); var test = require('tap').test var LRU = require('../') diff --git a/node_modules/lru-cache/test/serialize.js b/node_modules/lru-cache/test/serialize.js new file mode 100644 index 0000000..1094194 --- /dev/null +++ b/node_modules/lru-cache/test/serialize.js @@ -0,0 +1,216 @@ +var test = require('tap').test +var LRU = require('../') + +test('dump', function (t) { + var cache = new LRU() + + t.equal(cache.dump().length, 0, "nothing in dump for empty cache") + + cache.set("a", "A") + cache.set("b", "B") + t.deepEqual(cache.dump(), [ + { k: "b", v: "B", e: 0 }, + { k: "a", v: "A", e: 0 } + ]) + + cache.set("a", "A"); + t.deepEqual(cache.dump(), [ + { k: "a", v: "A", e: 0 }, + { k: "b", v: "B", e: 0 } + ]) + + cache.get("b"); + t.deepEqual(cache.dump(), [ + { k: "b", v: "B", e: 0 }, + { k: "a", v: "A", e: 0 } + ]) + + cache.del("a"); + t.deepEqual(cache.dump(), [ + { k: "b", v: "B", e: 0 } + ]) + + t.end() +}) + +test("do not dump stale items", function(t) { + var cache = new LRU({ + max: 5, + maxAge: 50 + }) + + //expires at 50 + cache.set("a", "A") + + setTimeout(function () { + //expires at 75 + cache.set("b", "B") + var s = cache.dump() + t.equal(s.length, 2) + t.equal(s[0].k, "b") + t.equal(s[1].k, "a") + }, 25) + + setTimeout(function () { + //expires at 110 + cache.set("c", "C") + var s = cache.dump() + t.equal(s.length, 2) + t.equal(s[0].k, "c") + t.equal(s[1].k, "b") + }, 60) + + setTimeout(function () { + //expires at 130 + cache.set("d", "D", 40) + var s = cache.dump() + t.equal(s.length, 2) + t.equal(s[0].k, "d") + t.equal(s[1].k, "c") + }, 90) + + setTimeout(function () { + var s = cache.dump() + t.equal(s.length, 1) + t.equal(s[0].k, "d") + }, 120) + + setTimeout(function () { + var s = cache.dump() + t.deepEqual(s, []) + t.end() + }, 155) +}) + +test("load basic cache", function(t) { + var cache = new LRU(), + copy = new LRU() + + cache.set("a", "A") + cache.set("b", "B") + + copy.load(cache.dump()) + t.deepEquals(cache.dump(), copy.dump()) + + t.end() +}) + + +test("load staled cache", function(t) { + var cache = new LRU({maxAge: 50}), + copy = new LRU({maxAge: 50}), + arr + + //expires at 50 + cache.set("a", "A") + setTimeout(function () { + //expires at 80 + cache.set("b", "B") + arr = cache.dump() + t.equal(arr.length, 2) + }, 30) + + setTimeout(function () { + copy.load(arr) + t.equal(copy.get("a"), undefined) + t.equal(copy.get("b"), "B") + }, 60) + + setTimeout(function () { + t.equal(copy.get("b"), undefined) + t.end() + }, 90) +}) + +test("load to other size cache", function(t) { + var cache = new LRU({max: 2}), + copy = new LRU({max: 1}) + + cache.set("a", "A") + cache.set("b", "B") + + copy.load(cache.dump()) + t.equal(copy.get("a"), undefined) + t.equal(copy.get("b"), "B") + + //update the last read from original cache + cache.get("a") + copy.load(cache.dump()) + t.equal(copy.get("a"), "A") + t.equal(copy.get("b"), undefined) + + t.end() +}) + + +test("load to other age cache", function(t) { + var cache = new LRU({maxAge: 50}), + aged = new LRU({maxAge: 100}), + simple = new LRU(), + arr, + expired + + //created at 0 + //a would be valid till 0 + 50 + cache.set("a", "A") + setTimeout(function () { + //created at 20 + //b would be valid till 20 + 50 + cache.set("b", "B") + //b would be valid till 20 + 70 + cache.set("c", "C", 70) + arr = cache.dump() + t.equal(arr.length, 3) + }, 20) + + setTimeout(function () { + t.equal(cache.get("a"), undefined) + t.equal(cache.get("b"), "B") + t.equal(cache.get("c"), "C") + + aged.load(arr) + t.equal(aged.get("a"), undefined) + t.equal(aged.get("b"), "B") + t.equal(aged.get("c"), "C") + + simple.load(arr) + t.equal(simple.get("a"), undefined) + t.equal(simple.get("b"), "B") + t.equal(simple.get("c"), "C") + }, 60) + + setTimeout(function () { + t.equal(cache.get("a"), undefined) + t.equal(cache.get("b"), undefined) + t.equal(cache.get("c"), "C") + + aged.load(arr) + t.equal(aged.get("a"), undefined) + t.equal(aged.get("b"), undefined) + t.equal(aged.get("c"), "C") + + simple.load(arr) + t.equal(simple.get("a"), undefined) + t.equal(simple.get("b"), undefined) + t.equal(simple.get("c"), "C") + }, 80) + + setTimeout(function () { + t.equal(cache.get("a"), undefined) + t.equal(cache.get("b"), undefined) + t.equal(cache.get("c"), undefined) + + aged.load(arr) + t.equal(aged.get("a"), undefined) + t.equal(aged.get("b"), undefined) + t.equal(aged.get("c"), undefined) + + simple.load(arr) + t.equal(simple.get("a"), undefined) + t.equal(simple.get("b"), undefined) + t.equal(simple.get("c"), undefined) + t.end() + }, 100) + +}) + diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/LICENSE b/node_modules/minimatch/LICENSE similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/LICENSE rename to node_modules/minimatch/LICENSE diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/README.md b/node_modules/minimatch/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/README.md rename to node_modules/minimatch/README.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/minimatch.js rename to node_modules/minimatch/minimatch.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/package.json b/node_modules/minimatch/package.json similarity index 54% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/package.json rename to node_modules/minimatch/package.json index f2237ef..0cd1a5f 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/package.json +++ b/node_modules/minimatch/package.json @@ -1,52 +1,83 @@ { - "author": { - "name": "Isaac Z. Schlueter", + "_args": [ + [ + "minimatch@0.2.12", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb-core" + ] + ], + "_from": "minimatch@0.2.12", + "_id": "minimatch@0.2.12", + "_inCache": true, + "_installable": true, + "_location": "/minimatch", + "_npmUser": { "email": "i@izs.me", - "url": "http://blog.izs.me" + "name": "isaacs" }, - "name": "minimatch", - "description": "a glob matcher in javascript", - "version": "0.2.12", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/minimatch.git" + "_npmVersion": "1.2.18", + "_phantomChildren": {}, + "_requested": { + "name": "minimatch", + "raw": "minimatch@0.2.12", + "rawSpec": "0.2.12", + "scope": null, + "spec": "0.2.12", + "type": "version" }, - "main": "minimatch.js", - "scripts": { - "test": "tap test" + "_requiredBy": [ + "/csscomb-core", + "/glob" + ], + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.12.tgz", + "_shasum": "ea82a012ac662c7ddfaa144f1c147e6946f5dafb", + "_shrinkwrap": null, + "_spec": "minimatch@0.2.12", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb-core", + "author": { + "email": "i@izs.me", + "name": "Isaac Z. Schlueter", + "url": "http://blog.izs.me" }, - "engines": { - "node": "*" + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" }, "dependencies": { "lru-cache": "2", "sigmund": "~1.0.0" }, + "description": "a glob matcher in javascript", "devDependencies": { "tap": "" }, - "license": { - "type": "MIT", - "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" - }, - "_id": "minimatch@0.2.12", + "directories": {}, "dist": { "shasum": "ea82a012ac662c7ddfaa144f1c147e6946f5dafb", "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-0.2.12.tgz" }, - "_from": "minimatch@0.2.12", - "_npmVersion": "1.2.18", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "engines": { + "node": "*" }, + "homepage": "https://github.com/isaacs/minimatch#readme", + "license": { + "type": "MIT", + "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" + }, + "main": "minimatch.js", "maintainers": [ { "name": "isaacs", "email": "i@izs.me" } ], - "directories": {}, - "_shasum": "ea82a012ac662c7ddfaa144f1c147e6946f5dafb", - "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.12.tgz" + "name": "minimatch", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "scripts": { + "test": "tap test" + }, + "version": "0.2.12" } diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/basic.js b/node_modules/minimatch/test/basic.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/basic.js rename to node_modules/minimatch/test/basic.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/brace-expand.js b/node_modules/minimatch/test/brace-expand.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/brace-expand.js rename to node_modules/minimatch/test/brace-expand.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/caching.js b/node_modules/minimatch/test/caching.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/caching.js rename to node_modules/minimatch/test/caching.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/defaults.js b/node_modules/minimatch/test/defaults.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/test/defaults.js rename to node_modules/minimatch/test/defaults.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/.npmignore b/node_modules/node-uuid/.npmignore similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/.npmignore rename to node_modules/node-uuid/.npmignore diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/LICENSE.md b/node_modules/node-uuid/LICENSE.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/LICENSE.md rename to node_modules/node-uuid/LICENSE.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/README.md b/node_modules/node-uuid/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/README.md rename to node_modules/node-uuid/README.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/README.md b/node_modules/node-uuid/benchmark/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/README.md rename to node_modules/node-uuid/benchmark/README.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/bench.gnu b/node_modules/node-uuid/benchmark/bench.gnu similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/bench.gnu rename to node_modules/node-uuid/benchmark/bench.gnu diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/bench.sh b/node_modules/node-uuid/benchmark/bench.sh similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/bench.sh rename to node_modules/node-uuid/benchmark/bench.sh diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/benchmark-native.c b/node_modules/node-uuid/benchmark/benchmark-native.c similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/benchmark-native.c rename to node_modules/node-uuid/benchmark/benchmark-native.c diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/benchmark.js b/node_modules/node-uuid/benchmark/benchmark.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/benchmark/benchmark.js rename to node_modules/node-uuid/benchmark/benchmark.js diff --git a/node_modules/node-uuid/package.json b/node_modules/node-uuid/package.json new file mode 100644 index 0000000..34749e3 --- /dev/null +++ b/node_modules/node-uuid/package.json @@ -0,0 +1,75 @@ +{ + "_args": [ + [ + "node-uuid@1.4.0", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/vow-fs" + ] + ], + "_from": "node-uuid@1.4.0", + "_id": "node-uuid@1.4.0", + "_inCache": true, + "_installable": true, + "_location": "/node-uuid", + "_phantomChildren": {}, + "_requested": { + "name": "node-uuid", + "raw": "node-uuid@1.4.0", + "rawSpec": "1.4.0", + "scope": null, + "spec": "1.4.0", + "type": "version" + }, + "_requiredBy": [ + "/vow-fs" + ], + "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.0.tgz", + "_shasum": "07f9b2337572ff6275c775e1d48513f3a45d7a65", + "_shrinkwrap": null, + "_spec": "node-uuid@1.4.0", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/vow-fs", + "author": { + "email": "robert@broofa.com", + "name": "Robert Kieffer" + }, + "bugs": { + "url": "https://github.com/broofa/node-uuid/issues" + }, + "contributors": [ + { + "name": "Christoph Tavan", + "email": "dev@tavan.de" + } + ], + "dependencies": {}, + "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "07f9b2337572ff6275c775e1d48513f3a45d7a65", + "tarball": "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.0.tgz" + }, + "homepage": "https://github.com/broofa/node-uuid#readme", + "keywords": [ + "guid", + "rfc4122", + "uuid" + ], + "lib": ".", + "main": "./uuid.js", + "maintainers": [ + { + "name": "broofa", + "email": "robert@broofa.com" + } + ], + "name": "node-uuid", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/broofa/node-uuid.git" + }, + "scripts": {}, + "url": "http://github.com/broofa/node-uuid", + "version": "1.4.0" +} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/test/compare_v1.js b/node_modules/node-uuid/test/compare_v1.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/test/compare_v1.js rename to node_modules/node-uuid/test/compare_v1.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/test/test.html b/node_modules/node-uuid/test/test.html similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/test/test.html rename to node_modules/node-uuid/test/test.html diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/test/test.js b/node_modules/node-uuid/test/test.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/test/test.js rename to node_modules/node-uuid/test/test.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/uuid.js b/node_modules/node-uuid/uuid.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/node-uuid/uuid.js rename to node_modules/node-uuid/uuid.js diff --git a/node_modules/sigmund/LICENSE b/node_modules/sigmund/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/sigmund/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/README.md b/node_modules/sigmund/README.md similarity index 91% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/README.md rename to node_modules/sigmund/README.md index 7e36512..25a38a5 100644 --- a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/README.md +++ b/node_modules/sigmund/README.md @@ -11,7 +11,7 @@ string key suitable for caches and the like. function doSomething (someObj) { var key = sigmund(someObj, maxDepth) // max depth defaults to 10 var cached = cache.get(key) - if (cached) return cached) + if (cached) return cached var result = expensiveCalculation(someObj) cache.set(key, result) @@ -26,11 +26,11 @@ For example, the object `{0:'foo'}` will be treated identically to the array `['foo']`. Also, just as there is no way to summon the soul from the scribblings -of a cocain-addled psychoanalyst, there is no way to revive the object +of a cocaine-addled psychoanalyst, there is no way to revive the object from the signature string that sigmund gives you. In fact, it's barely even readable. -As with `sys.inspect` and `JSON.stringify`, larger objects will +As with `util.inspect` and `JSON.stringify`, larger objects will produce larger signature strings. Because sigmund is a bit less strict than the more thorough diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/bench.js b/node_modules/sigmund/bench.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/bench.js rename to node_modules/sigmund/bench.js diff --git a/node_modules/sigmund/package.json b/node_modules/sigmund/package.json new file mode 100644 index 0000000..53bb28d --- /dev/null +++ b/node_modules/sigmund/package.json @@ -0,0 +1,85 @@ +{ + "_args": [ + [ + "sigmund@~1.0.0", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/minimatch" + ] + ], + "_from": "sigmund@>=1.0.0 <1.1.0", + "_id": "sigmund@1.0.1", + "_inCache": true, + "_installable": true, + "_location": "/sigmund", + "_nodeVersion": "2.0.1", + "_npmUser": { + "email": "isaacs@npmjs.com", + "name": "isaacs" + }, + "_npmVersion": "2.10.0", + "_phantomChildren": {}, + "_requested": { + "name": "sigmund", + "raw": "sigmund@~1.0.0", + "rawSpec": "~1.0.0", + "scope": null, + "spec": ">=1.0.0 <1.1.0", + "type": "range" + }, + "_requiredBy": [ + "/minimatch" + ], + "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "_shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590", + "_shrinkwrap": null, + "_spec": "sigmund@~1.0.0", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/minimatch", + "author": { + "email": "i@izs.me", + "name": "Isaac Z. Schlueter", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/sigmund/issues" + }, + "dependencies": {}, + "description": "Quick and dirty signatures for Objects.", + "devDependencies": { + "tap": "~0.3.0" + }, + "directories": { + "test": "test" + }, + "dist": { + "shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590", + "tarball": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz" + }, + "gitHead": "527f97aa5bb253d927348698c0cd3bb267d098c6", + "homepage": "https://github.com/isaacs/sigmund#readme", + "keywords": [ + "data", + "key", + "object", + "psychoanalysis", + "signature" + ], + "license": "ISC", + "main": "sigmund.js", + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "name": "sigmund", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/sigmund.git" + }, + "scripts": { + "bench": "node bench.js", + "test": "tap test/*.js" + }, + "version": "1.0.1" +} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/sigmund.js b/node_modules/sigmund/sigmund.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/sigmund.js rename to node_modules/sigmund/sigmund.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/test/basic.js b/node_modules/sigmund/test/basic.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/minimatch/node_modules/sigmund/test/basic.js rename to node_modules/sigmund/test/basic.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/.npmignore b/node_modules/vow-fs/.npmignore similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/.npmignore rename to node_modules/vow-fs/.npmignore diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/.travis.yml b/node_modules/vow-fs/.travis.yml similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/.travis.yml rename to node_modules/vow-fs/.travis.yml diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/README.md b/node_modules/vow-fs/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/README.md rename to node_modules/vow-fs/README.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/lib/fs.js b/node_modules/vow-fs/lib/fs.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/lib/fs.js rename to node_modules/vow-fs/lib/fs.js diff --git a/node_modules/vow-fs/package.json b/node_modules/vow-fs/package.json new file mode 100644 index 0000000..51877eb --- /dev/null +++ b/node_modules/vow-fs/package.json @@ -0,0 +1,91 @@ +{ + "_args": [ + [ + "vow-fs@0.3.2", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb-core" + ] + ], + "_from": "vow-fs@0.3.2", + "_id": "vow-fs@0.3.2", + "_inCache": true, + "_installable": true, + "_location": "/vow-fs", + "_npmUser": { + "email": "dfilatov@yandex-team.ru", + "name": "dfilatov" + }, + "_npmVersion": "1.3.21", + "_phantomChildren": {}, + "_requested": { + "name": "vow-fs", + "raw": "vow-fs@0.3.2", + "rawSpec": "0.3.2", + "scope": null, + "spec": "0.3.2", + "type": "version" + }, + "_requiredBy": [ + "/csscomb-core" + ], + "_resolved": "https://registry.npmjs.org/vow-fs/-/vow-fs-0.3.2.tgz", + "_shasum": "ea2b034d85e1db8c277eb2e9a86d1c15f5d38e7a", + "_shrinkwrap": null, + "_spec": "vow-fs@0.3.2", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb-core", + "author": { + "email": "dfilatov@yandex-team.ru", + "name": "Dmitry Filatov" + }, + "bugs": { + "url": "https://github.com/dfilatov/vow-fs/issues" + }, + "contributors": [ + { + "name": "Dmitry Filatov", + "email": "dfilatov@yandex-team.ru" + } + ], + "dependencies": { + "glob": "3.2.8", + "node-uuid": "1.4.0", + "vow": "0.4.4", + "vow-queue": "0.3.1" + }, + "description": "File I/O by Vow", + "devDependencies": { + "istanbul": "", + "nodeunit": "" + }, + "directories": {}, + "dist": { + "shasum": "ea2b034d85e1db8c277eb2e9a86d1c15f5d38e7a", + "tarball": "http://registry.npmjs.org/vow-fs/-/vow-fs-0.3.2.tgz" + }, + "engines": { + "node": ">= 0.6.0" + }, + "homepage": "https://github.com/dfilatov/vow-fs", + "keywords": [ + "file system", + "promise", + "vow" + ], + "main": "lib/fs", + "maintainers": [ + { + "name": "dfilatov", + "email": "dfilatov@yandex-team.ru" + } + ], + "name": "vow-fs", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/dfilatov/vow-fs.git" + }, + "scripts": { + "test": "./node_modules/istanbul/lib/cli.js test test/runner.js" + }, + "version": "0.3.2" +} diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/copy.js b/node_modules/vow-fs/test/copy.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/copy.js rename to node_modules/vow-fs/test/copy.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/issymlink.js b/node_modules/vow-fs/test/issymlink.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/issymlink.js rename to node_modules/vow-fs/test/issymlink.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/makedir.js b/node_modules/vow-fs/test/makedir.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/makedir.js rename to node_modules/vow-fs/test/makedir.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/maketmpfile.js b/node_modules/vow-fs/test/maketmpfile.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/maketmpfile.js rename to node_modules/vow-fs/test/maketmpfile.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/removedir.js b/node_modules/vow-fs/test/removedir.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/removedir.js rename to node_modules/vow-fs/test/removedir.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/runner.js b/node_modules/vow-fs/test/runner.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/test/runner.js rename to node_modules/vow-fs/test/runner.js diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.jscs.json b/node_modules/vow-queue/.jscs.json similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.jscs.json rename to node_modules/vow-queue/.jscs.json diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.jshintignore b/node_modules/vow-queue/.jshintignore similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.jshintignore rename to node_modules/vow-queue/.jshintignore diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.jshintrc b/node_modules/vow-queue/.jshintrc similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.jshintrc rename to node_modules/vow-queue/.jshintrc diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.npmignore b/node_modules/vow-queue/.npmignore similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.npmignore rename to node_modules/vow-queue/.npmignore diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.travis.yml b/node_modules/vow-queue/.travis.yml similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/.travis.yml rename to node_modules/vow-queue/.travis.yml diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/CHANGELOG.md b/node_modules/vow-queue/CHANGELOG.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/CHANGELOG.md rename to node_modules/vow-queue/CHANGELOG.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/CONTRIBUTION.md b/node_modules/vow-queue/CONTRIBUTION.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/CONTRIBUTION.md rename to node_modules/vow-queue/CONTRIBUTION.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/LICENSE b/node_modules/vow-queue/LICENSE similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/LICENSE rename to node_modules/vow-queue/LICENSE diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/Makefile b/node_modules/vow-queue/Makefile similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/Makefile rename to node_modules/vow-queue/Makefile diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/README.md b/node_modules/vow-queue/README.md similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/README.md rename to node_modules/vow-queue/README.md diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/bower.json b/node_modules/vow-queue/bower.json similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/bower.json rename to node_modules/vow-queue/bower.json diff --git a/node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/lib/queue.js b/node_modules/vow-queue/lib/queue.js similarity index 100% rename from node_modules/csscomb/node_modules/csscomb-core/node_modules/vow-fs/node_modules/vow-queue/lib/queue.js rename to node_modules/vow-queue/lib/queue.js diff --git a/node_modules/vow-queue/package.json b/node_modules/vow-queue/package.json new file mode 100644 index 0000000..81fd109 --- /dev/null +++ b/node_modules/vow-queue/package.json @@ -0,0 +1,91 @@ +{ + "_args": [ + [ + "vow-queue@0.3.1", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/vow-fs" + ] + ], + "_from": "vow-queue@0.3.1", + "_id": "vow-queue@0.3.1", + "_inCache": true, + "_installable": true, + "_location": "/vow-queue", + "_npmUser": { + "email": "dfilatov@yandex-team.ru", + "name": "dfilatov" + }, + "_npmVersion": "1.3.21", + "_phantomChildren": {}, + "_requested": { + "name": "vow-queue", + "raw": "vow-queue@0.3.1", + "rawSpec": "0.3.1", + "scope": null, + "spec": "0.3.1", + "type": "version" + }, + "_requiredBy": [ + "/vow-fs" + ], + "_resolved": "https://registry.npmjs.org/vow-queue/-/vow-queue-0.3.1.tgz", + "_shasum": "598c51a15b0a81a6d5fc05f4761ceb462de1e868", + "_shrinkwrap": null, + "_spec": "vow-queue@0.3.1", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/vow-fs", + "author": { + "email": "dfilatov@yandex-team.ru", + "name": "Dmitry Filatov" + }, + "bugs": { + "url": "https://github.com/dfilatov/vow-queue/issues" + }, + "contributors": [ + { + "name": "Dmitry Filatov", + "email": "dfilatov@yandex-team.ru" + } + ], + "dependencies": { + "vow": "~0.4.0" + }, + "description": "Vow-based task queue", + "devDependencies": { + "chai": "*", + "istanbul": "0.1.39", + "jscs": "1.0.0", + "jshint": "2.1.3", + "mocha": "1.11.0", + "mocha-istanbul": "*", + "vow": "~0.4.0" + }, + "directories": {}, + "dist": { + "shasum": "598c51a15b0a81a6d5fc05f4761ceb462de1e868", + "tarball": "http://registry.npmjs.org/vow-queue/-/vow-queue-0.3.1.tgz" + }, + "engines": { + "node": ">= 0.8.0" + }, + "homepage": "https://github.com/dfilatov/vow-queue", + "main": "lib/queue", + "maintainers": [ + { + "name": "dfilatov", + "email": "dfilatov@yandex-team.ru" + } + ], + "name": "vow-queue", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/dfilatov/vow-queue.git" + }, + "scripts": { + "clean": "make clean", + "coverage": "make coverage", + "lint": "make lint", + "test": "make validate" + }, + "version": "0.3.1" +} diff --git a/node_modules/csscomb/node_modules/vow/lib/vow.js b/node_modules/vow/lib/vow.js similarity index 100% rename from node_modules/csscomb/node_modules/vow/lib/vow.js rename to node_modules/vow/lib/vow.js diff --git a/node_modules/csscomb/node_modules/vow/package.json b/node_modules/vow/package.json similarity index 58% rename from node_modules/csscomb/node_modules/vow/package.json rename to node_modules/vow/package.json index 58f1c76..c3ddeba 100644 --- a/node_modules/csscomb/node_modules/vow/package.json +++ b/node_modules/vow/package.json @@ -1,19 +1,46 @@ { - "name": "vow", - "version": "0.4.4", - "description": "DOM Promise and Promises/A+ implementation for Node.js and browsers", - "homepage": "https://github.com/dfilatov/vow", - "keywords": [ - "nodejs", - "browser", - "async", - "promise", - "dom", - "a+" + "_args": [ + [ + "vow@0.4.4", + "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb" + ] ], + "_from": "vow@0.4.4", + "_id": "vow@0.4.4", + "_inCache": true, + "_installable": true, + "_location": "/vow", + "_npmUser": { + "email": "dfilatov@yandex-team.ru", + "name": "dfilatov" + }, + "_npmVersion": "1.3.21", + "_phantomChildren": {}, + "_requested": { + "name": "vow", + "raw": "vow@0.4.4", + "rawSpec": "0.4.4", + "scope": null, + "spec": "0.4.4", + "type": "version" + }, + "_requiredBy": [ + "/csscomb", + "/csscomb-core", + "/vow-fs", + "/vow-queue" + ], + "_resolved": "https://registry.npmjs.org/vow/-/vow-0.4.4.tgz", + "_shasum": "c9fe4609129d7f5aa621508ebe64b51c95bc7b98", + "_shrinkwrap": null, + "_spec": "vow@0.4.4", + "_where": "/Users/jsuh/Dropbox/Apps/Sublime Text 3/Packages/sublime-csscomb/node_modules/csscomb", "author": { - "name": "Dmitry Filatov", - "email": "dfilatov@yandex-team.ru" + "email": "dfilatov@yandex-team.ru", + "name": "Dmitry Filatov" + }, + "bugs": { + "url": "https://github.com/dfilatov/vow/issues" }, "contributors": [ { @@ -21,56 +48,57 @@ "email": "dfilatov@yandex-team.ru" } ], - "repository": { - "type": "git", - "url": "http://github.com/dfilatov/vow.git" - }, "dependencies": {}, + "description": "DOM Promise and Promises/A+ implementation for Node.js and browsers", "devDependencies": { - "nodeunit": "", + "bem-jsd": "1.3.1", + "highlight.js": "7.5.0", "istanbul": "", - "uglify-js": "1.3.4", - "promises-aplus-tests": "2.0.3", - "marked": "0.2.10", "jspath": "0.2.11", - "yate": "0.0.65", - "highlight.js": "7.5.0", - "bem-jsd": "1.3.1" - }, - "main": "lib/vow", - "engines": { - "node": ">= 0.4.0" + "marked": "0.2.10", + "nodeunit": "", + "promises-aplus-tests": "2.0.3", + "uglify-js": "1.3.4", + "yate": "0.0.65" }, - "scripts": { - "test": "./node_modules/istanbul/lib/cli.js test test/utils/runner.js" + "directories": {}, + "dist": { + "shasum": "c9fe4609129d7f5aa621508ebe64b51c95bc7b98", + "tarball": "http://registry.npmjs.org/vow/-/vow-0.4.4.tgz" }, "enb": { "sources": [ "lib/vow.js" ] }, - "bugs": { - "url": "https://github.com/dfilatov/vow/issues" - }, - "_id": "vow@0.4.4", - "dist": { - "shasum": "c9fe4609129d7f5aa621508ebe64b51c95bc7b98", - "tarball": "http://registry.npmjs.org/vow/-/vow-0.4.4.tgz" - }, - "_from": "vow@0.4.4", - "_npmVersion": "1.3.21", - "_npmUser": { - "name": "dfilatov", - "email": "dfilatov@yandex-team.ru" + "engines": { + "node": ">= 0.4.0" }, + "homepage": "https://github.com/dfilatov/vow", + "keywords": [ + "a+", + "async", + "browser", + "dom", + "nodejs", + "promise" + ], + "main": "lib/vow", "maintainers": [ { "name": "dfilatov", "email": "dfilatov@yandex-team.ru" } ], - "directories": {}, - "_shasum": "c9fe4609129d7f5aa621508ebe64b51c95bc7b98", - "_resolved": "https://registry.npmjs.org/vow/-/vow-0.4.4.tgz", - "readme": "ERROR: No README data found!" + "name": "vow", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/dfilatov/vow.git" + }, + "scripts": { + "test": "./node_modules/istanbul/lib/cli.js test test/utils/runner.js" + }, + "version": "0.4.4" } diff --git a/node_modules/csscomb/node_modules/vow/vow.min.js b/node_modules/vow/vow.min.js similarity index 100% rename from node_modules/csscomb/node_modules/vow/vow.min.js rename to node_modules/vow/vow.min.js