less 3.9.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.DS_Store +0 -0
- package/.eslintignore +4 -1
- package/.eslintrc.json +69 -87
- package/CHANGELOG.md +7 -0
- package/Gruntfile.js +336 -330
- package/bin/lessc +13110 -481
- package/dist/less.cjs.js +12571 -0
- package/dist/less.js +12878 -11507
- package/dist/less.min.js +7 -14
- package/dist/less.min.js.map +1 -0
- package/index.js +1 -1
- package/lib/less/constants.js +12 -12
- package/lib/less/contexts.js +93 -95
- package/lib/less/data/colors.js +1 -1
- package/lib/less/data/index.js +4 -4
- package/lib/less/data/unit-conversions.js +1 -1
- package/lib/less/default-options.js +53 -58
- package/lib/less/environment/abstract-file-manager.js +114 -110
- package/lib/less/environment/abstract-plugin-loader.js +139 -141
- package/lib/less/environment/environment-api.js +1 -1
- package/lib/less/environment/environment.js +44 -41
- package/lib/less/environment/file-manager-api.js +1 -1
- package/lib/less/functions/boolean.js +10 -12
- package/lib/less/functions/color-blending.js +20 -10
- package/lib/less/functions/color.js +63 -49
- package/lib/less/functions/data-uri.js +25 -39
- package/lib/less/functions/default.js +5 -7
- package/lib/less/functions/function-caller.js +42 -39
- package/lib/less/functions/function-registry.js +3 -3
- package/lib/less/functions/index.js +28 -16
- package/lib/less/functions/list.js +34 -28
- package/lib/less/functions/math-helper.js +4 -5
- package/lib/less/functions/math.js +8 -9
- package/lib/less/functions/number.js +26 -18
- package/lib/less/functions/string.js +13 -13
- package/lib/less/functions/svg.js +25 -25
- package/lib/less/functions/types.js +23 -27
- package/lib/less/import-manager.js +140 -138
- package/lib/less/index.js +72 -35
- package/lib/less/less-error.js +29 -30
- package/lib/less/logger.js +4 -4
- package/lib/less/parse-tree.js +53 -47
- package/lib/less/parse.js +23 -25
- package/lib/less/parser/chunker.js +17 -7
- package/lib/less/parser/parser-input.js +100 -93
- package/lib/less/parser/parser.js +310 -170
- package/lib/less/plugin-manager.js +146 -133
- package/lib/less/render.js +10 -13
- package/lib/less/source-map-builder.js +62 -57
- package/lib/less/source-map-output.js +118 -112
- package/lib/less/transform-tree.js +21 -18
- package/lib/less/tree/anonymous.js +35 -27
- package/lib/less/tree/assignment.js +29 -23
- package/lib/less/tree/atrule.js +150 -121
- package/lib/less/tree/attribute.js +32 -25
- package/lib/less/tree/call.js +87 -79
- package/lib/less/tree/color.js +202 -185
- package/lib/less/tree/combinator.js +25 -19
- package/lib/less/tree/comment.js +27 -21
- package/lib/less/tree/condition.js +41 -35
- package/lib/less/tree/debug-info.js +13 -17
- package/lib/less/tree/declaration.js +101 -88
- package/lib/less/tree/detached-ruleset.js +27 -20
- package/lib/less/tree/dimension.js +142 -124
- package/lib/less/tree/element.js +67 -58
- package/lib/less/tree/expression.js +66 -57
- package/lib/less/tree/extend.js +61 -53
- package/lib/less/tree/import.js +144 -141
- package/lib/less/tree/index.js +52 -40
- package/lib/less/tree/javascript.js +29 -25
- package/lib/less/tree/js-eval-node.js +50 -53
- package/lib/less/tree/keyword.js +15 -8
- package/lib/less/tree/media.js +137 -124
- package/lib/less/tree/mixin-call.js +178 -149
- package/lib/less/tree/mixin-definition.js +198 -178
- package/lib/less/tree/namespace-value.js +75 -67
- package/lib/less/tree/negative.js +24 -18
- package/lib/less/tree/node.js +138 -117
- package/lib/less/tree/operation.js +57 -49
- package/lib/less/tree/paren.js +20 -14
- package/lib/less/tree/property.js +65 -58
- package/lib/less/tree/quoted.js +62 -53
- package/lib/less/tree/ruleset.js +739 -680
- package/lib/less/tree/selector.js +129 -114
- package/lib/less/tree/unicode-descriptor.js +10 -6
- package/lib/less/tree/unit.js +117 -97
- package/lib/less/tree/url.js +54 -47
- package/lib/less/tree/value.js +38 -33
- package/lib/less/tree/variable-call.js +41 -34
- package/lib/less/tree/variable.js +58 -51
- package/lib/less/utils.js +110 -108
- package/lib/less/visitors/extend-visitor.js +157 -114
- package/lib/less/visitors/import-sequencer.js +47 -43
- package/lib/less/visitors/import-visitor.js +22 -23
- package/lib/less/visitors/index.js +14 -9
- package/lib/less/visitors/join-selector-visitor.js +32 -26
- package/lib/less/visitors/set-tree-visibility-visitor.js +37 -30
- package/lib/less/visitors/to-css-visitor.js +60 -57
- package/lib/less/visitors/visitor.js +44 -35
- package/lib/less-browser/add-default-options.js +4 -4
- package/lib/less-browser/bootstrap.js +11 -9
- package/lib/less-browser/browser.js +13 -12
- package/lib/less-browser/cache.js +9 -9
- package/lib/less-browser/error-reporting.js +27 -27
- package/lib/less-browser/file-manager.js +37 -35
- package/lib/less-browser/image-size.js +3 -3
- package/lib/less-browser/index.js +78 -73
- package/lib/less-browser/log-listener.js +6 -7
- package/lib/less-browser/plugin-loader.js +15 -13
- package/lib/less-browser/utils.js +20 -20
- package/lib/less-node/environment.js +4 -2
- package/lib/less-node/file-manager.js +128 -127
- package/lib/less-node/fs.js +2 -2
- package/lib/less-node/image-size.js +19 -18
- package/lib/less-node/index.js +16 -12
- package/lib/less-node/lessc-helper.js +4 -5
- package/lib/less-node/plugin-loader.js +41 -40
- package/lib/less-node/url-file-manager.js +41 -48
- package/lib/lessc.js +557 -0
- package/package.json +21 -11
- package/test/.DS_Store +0 -0
- package/test/browser/common.js +34 -30
- package/test/browser/css/urls.css +0 -3
- package/test/browser/less/plugin/plugin.js +4 -7
- package/test/browser/less/urls.less +0 -3
- package/test/browser/less.min.js +11 -0
- package/test/browser/less.min.js.map +1 -0
- package/test/browser/onload.js +13 -0
- package/test/browser/runner-browser-options.js +0 -5
- package/test/browser/test-runner-template.tmpl +39 -52
- package/test/browser/vendor/boot.js +148 -0
- package/test/browser/{jasmine-jsreporter.js → vendor/jasmine-jsreporter.js} +0 -0
- package/test/copy-bom.js +2 -1
- package/test/css/.DS_Store +0 -0
- package/test/css/functions-each.css +10 -0
- package/test/css/math/.DS_Store +0 -0
- package/test/css/namespacing/namespacing-1.css +4 -0
- package/test/css/urls.css +0 -1
- package/test/index.js +2 -5
- package/test/less/.DS_Store +0 -0
- package/test/less/colors.less +1 -1
- package/test/less/errors/color-func-invalid-color-2.less +2 -0
- package/test/less/errors/color-func-invalid-color-2.txt +3 -0
- package/test/less/functions-each.less +32 -0
- package/test/less/math/.DS_Store +0 -0
- package/test/less/namespacing/namespacing-1.less +10 -0
- package/test/less/urls.less +0 -1
- package/test/less-test.js +20 -11
- package/test/modify-vars.js +11 -2
- package/.travis.yml +0 -33
- package/appveyor.yml +0 -32
- package/browser.js +0 -1
- package/test/browser/less.js +0 -12956
- package/test/less-bom/3rd-party/bootstrap4.less +0 -1
- package/test/less-bom/3rd-party/uikit.less +0 -1
- package/test/less-bom/calc.less +0 -30
- package/test/less-bom/charsets.less +0 -3
- package/test/less-bom/colors.less +0 -116
- package/test/less-bom/comments.less +0 -102
- package/test/less-bom/comments2.less +0 -31
- package/test/less-bom/compression/compression.less +0 -36
- package/test/less-bom/css-3.less +0 -153
- package/test/less-bom/css-escapes.less +0 -42
- package/test/less-bom/css-grid.less +0 -30
- package/test/less-bom/css-guards.less +0 -103
- package/test/less-bom/debug/import/test.less +0 -25
- package/test/less-bom/debug/linenumbers.less +0 -33
- package/test/less-bom/detached-rulesets.less +0 -112
- package/test/less-bom/directives-bubling.less +0 -142
- package/test/less-bom/empty.less +0 -1
- package/test/less-bom/errors/add-mixed-units.less +0 -3
- package/test/less-bom/errors/add-mixed-units.txt +0 -4
- package/test/less-bom/errors/add-mixed-units2.less +0 -3
- package/test/less-bom/errors/add-mixed-units2.txt +0 -4
- package/test/less-bom/errors/at-rules-undefined-var.less +0 -4
- package/test/less-bom/errors/at-rules-undefined-var.txt +0 -4
- package/test/less-bom/errors/at-rules-unmatching-block.less +0 -4
- package/test/less-bom/errors/at-rules-unmatching-block.txt +0 -3
- package/test/less-bom/errors/bad-variable-declaration1.less +0 -1
- package/test/less-bom/errors/bad-variable-declaration1.txt +0 -2
- package/test/less-bom/errors/color-func-invalid-color.less +0 -3
- package/test/less-bom/errors/color-func-invalid-color.txt +0 -4
- package/test/less-bom/errors/css-guard-default-func.less +0 -4
- package/test/less-bom/errors/css-guard-default-func.txt +0 -4
- package/test/less-bom/errors/custom-property-unmatched-block-1.less +0 -6
- package/test/less-bom/errors/custom-property-unmatched-block-1.txt +0 -4
- package/test/less-bom/errors/custom-property-unmatched-block-2.less +0 -6
- package/test/less-bom/errors/custom-property-unmatched-block-2.txt +0 -4
- package/test/less-bom/errors/custom-property-unmatched-block-3.less +0 -6
- package/test/less-bom/errors/custom-property-unmatched-block-3.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-1.less +0 -6
- package/test/less-bom/errors/detached-ruleset-1.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-2.less +0 -6
- package/test/less-bom/errors/detached-ruleset-2.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-3.less +0 -4
- package/test/less-bom/errors/detached-ruleset-3.txt +0 -4
- package/test/less-bom/errors/detached-ruleset-5.less +0 -4
- package/test/less-bom/errors/detached-ruleset-5.txt +0 -3
- package/test/less-bom/errors/detached-ruleset-6.less +0 -5
- package/test/less-bom/errors/detached-ruleset-6.txt +0 -4
- package/test/less-bom/errors/divide-mixed-units.less +0 -3
- package/test/less-bom/errors/divide-mixed-units.txt +0 -4
- package/test/less-bom/errors/extend-no-selector.less +0 -3
- package/test/less-bom/errors/extend-no-selector.txt +0 -3
- package/test/less-bom/errors/extend-not-at-end.less +0 -3
- package/test/less-bom/errors/extend-not-at-end.txt +0 -3
- package/test/less-bom/errors/functions-1.less +0 -2
- package/test/less-bom/errors/functions-1.txt +0 -3
- package/test/less-bom/errors/functions-10-keyword.less +0 -2
- package/test/less-bom/errors/functions-10-keyword.txt +0 -3
- package/test/less-bom/errors/functions-11-operation.less +0 -2
- package/test/less-bom/errors/functions-11-operation.txt +0 -3
- package/test/less-bom/errors/functions-12-quoted.less +0 -2
- package/test/less-bom/errors/functions-12-quoted.txt +0 -3
- package/test/less-bom/errors/functions-13-selector.less +0 -2
- package/test/less-bom/errors/functions-13-selector.txt +0 -3
- package/test/less-bom/errors/functions-14-url.less +0 -2
- package/test/less-bom/errors/functions-14-url.txt +0 -3
- package/test/less-bom/errors/functions-15-value.less +0 -2
- package/test/less-bom/errors/functions-15-value.txt +0 -3
- package/test/less-bom/errors/functions-3-assignment.less +0 -2
- package/test/less-bom/errors/functions-3-assignment.txt +0 -3
- package/test/less-bom/errors/functions-4-call.less +0 -2
- package/test/less-bom/errors/functions-4-call.txt +0 -3
- package/test/less-bom/errors/functions-5-color-2.less +0 -1
- package/test/less-bom/errors/functions-5-color-2.txt +0 -2
- package/test/less-bom/errors/functions-5-color.less +0 -2
- package/test/less-bom/errors/functions-5-color.txt +0 -3
- package/test/less-bom/errors/functions-6-condition.less +0 -2
- package/test/less-bom/errors/functions-6-condition.txt +0 -3
- package/test/less-bom/errors/functions-7-dimension.less +0 -2
- package/test/less-bom/errors/functions-7-dimension.txt +0 -3
- package/test/less-bom/errors/functions-8-element.less +0 -2
- package/test/less-bom/errors/functions-8-element.txt +0 -3
- package/test/less-bom/errors/functions-9-expression.less +0 -2
- package/test/less-bom/errors/functions-9-expression.txt +0 -3
- package/test/less-bom/errors/import-malformed.less +0 -1
- package/test/less-bom/errors/import-malformed.txt +0 -3
- package/test/less-bom/errors/import-missing.less +0 -6
- package/test/less-bom/errors/import-missing.txt +0 -3
- package/test/less-bom/errors/import-no-semi.less +0 -1
- package/test/less-bom/errors/import-no-semi.txt +0 -2
- package/test/less-bom/errors/import-subfolder1.less +0 -1
- package/test/less-bom/errors/import-subfolder1.txt +0 -3
- package/test/less-bom/errors/import-subfolder2.less +0 -1
- package/test/less-bom/errors/import-subfolder2.txt +0 -4
- package/test/less-bom/errors/imports/import-subfolder1.less +0 -1
- package/test/less-bom/errors/imports/import-subfolder2.less +0 -1
- package/test/less-bom/errors/imports/import-test.less +0 -4
- package/test/less-bom/errors/imports/subfolder/mixin-not-defined.less +0 -1
- package/test/less-bom/errors/imports/subfolder/parse-error-curly-bracket.less +0 -1
- package/test/less-bom/errors/javascript-error.less +0 -3
- package/test/less-bom/errors/javascript-error.txt +0 -4
- package/test/less-bom/errors/javascript-undefined-var.less +0 -3
- package/test/less-bom/errors/javascript-undefined-var.txt +0 -4
- package/test/less-bom/errors/mixed-mixin-definition-args-1.less +0 -6
- package/test/less-bom/errors/mixed-mixin-definition-args-1.txt +0 -4
- package/test/less-bom/errors/mixed-mixin-definition-args-2.less +0 -6
- package/test/less-bom/errors/mixed-mixin-definition-args-2.txt +0 -4
- package/test/less-bom/errors/mixin-not-defined-2.less +0 -7
- package/test/less-bom/errors/mixin-not-defined-2.txt +0 -4
- package/test/less-bom/errors/mixin-not-defined.less +0 -11
- package/test/less-bom/errors/mixin-not-defined.txt +0 -3
- package/test/less-bom/errors/mixin-not-matched.less +0 -6
- package/test/less-bom/errors/mixin-not-matched.txt +0 -3
- package/test/less-bom/errors/mixin-not-matched2.less +0 -6
- package/test/less-bom/errors/mixin-not-matched2.txt +0 -3
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.less +0 -9
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.txt +0 -4
- package/test/less-bom/errors/mixins-guards-cond-expected.less +0 -5
- package/test/less-bom/errors/mixins-guards-cond-expected.txt +0 -3
- package/test/less-bom/errors/mixins-guards-default-func-1.less +0 -9
- package/test/less-bom/errors/mixins-guards-default-func-1.txt +0 -4
- package/test/less-bom/errors/mixins-guards-default-func-2.less +0 -9
- package/test/less-bom/errors/mixins-guards-default-func-2.txt +0 -4
- package/test/less-bom/errors/mixins-guards-default-func-3.less +0 -9
- package/test/less-bom/errors/mixins-guards-default-func-3.txt +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors.less +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors.txt +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.less +0 -4
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.txt +0 -4
- package/test/less-bom/errors/multiply-mixed-units.less +0 -7
- package/test/less-bom/errors/multiply-mixed-units.txt +0 -4
- package/test/less-bom/errors/namespacing-2.less +0 -7
- package/test/less-bom/errors/namespacing-2.txt +0 -4
- package/test/less-bom/errors/namespacing-3.less +0 -8
- package/test/less-bom/errors/namespacing-3.txt +0 -4
- package/test/less-bom/errors/namespacing-4.less +0 -7
- package/test/less-bom/errors/namespacing-4.txt +0 -4
- package/test/less-bom/errors/parens-error-1.less +0 -3
- package/test/less-bom/errors/parens-error-1.txt +0 -4
- package/test/less-bom/errors/parens-error-2.less +0 -3
- package/test/less-bom/errors/parens-error-2.txt +0 -4
- package/test/less-bom/errors/parens-error-3.less +0 -3
- package/test/less-bom/errors/parens-error-3.txt +0 -4
- package/test/less-bom/errors/parse-error-curly-bracket.less +0 -4
- package/test/less-bom/errors/parse-error-curly-bracket.txt +0 -4
- package/test/less-bom/errors/parse-error-media-no-block-1.less +0 -5
- package/test/less-bom/errors/parse-error-media-no-block-1.txt +0 -3
- package/test/less-bom/errors/parse-error-media-no-block-2.less +0 -1
- package/test/less-bom/errors/parse-error-media-no-block-2.txt +0 -2
- package/test/less-bom/errors/parse-error-media-no-block-3.less +0 -4
- package/test/less-bom/errors/parse-error-media-no-block-3.txt +0 -3
- package/test/less-bom/errors/parse-error-missing-bracket.less +0 -2
- package/test/less-bom/errors/parse-error-missing-bracket.txt +0 -3
- package/test/less-bom/errors/parse-error-missing-parens.less +0 -5
- package/test/less-bom/errors/parse-error-missing-parens.txt +0 -3
- package/test/less-bom/errors/parse-error-with-import.less +0 -13
- package/test/less-bom/errors/parse-error-with-import.txt +0 -4
- package/test/less-bom/errors/percentage-missing-space.less +0 -3
- package/test/less-bom/errors/percentage-missing-space.txt +0 -4
- package/test/less-bom/errors/percentage-non-number-argument.less +0 -3
- package/test/less-bom/errors/percentage-non-number-argument.txt +0 -4
- package/test/less-bom/errors/plugin/plugin-error-2.js +0 -5
- package/test/less-bom/errors/plugin/plugin-error-3.js +0 -5
- package/test/less-bom/errors/plugin/plugin-error.js +0 -1
- package/test/less-bom/errors/plugin-1.less +0 -1
- package/test/less-bom/errors/plugin-1.txt +0 -2
- package/test/less-bom/errors/plugin-2.less +0 -1
- package/test/less-bom/errors/plugin-2.txt +0 -5
- package/test/less-bom/errors/plugin-3.less +0 -1
- package/test/less-bom/errors/plugin-3.txt +0 -5
- package/test/less-bom/errors/property-asterisk-only-name.less +0 -3
- package/test/less-bom/errors/property-asterisk-only-name.txt +0 -4
- package/test/less-bom/errors/property-ie5-hack.less +0 -3
- package/test/less-bom/errors/property-ie5-hack.txt +0 -3
- package/test/less-bom/errors/property-in-root.less +0 -4
- package/test/less-bom/errors/property-in-root.txt +0 -4
- package/test/less-bom/errors/property-in-root2.less +0 -1
- package/test/less-bom/errors/property-in-root2.txt +0 -4
- package/test/less-bom/errors/property-in-root3.less +0 -4
- package/test/less-bom/errors/property-in-root3.txt +0 -3
- package/test/less-bom/errors/property-interp-not-defined.less +0 -1
- package/test/less-bom/errors/property-interp-not-defined.txt +0 -2
- package/test/less-bom/errors/recursive-variable.less +0 -1
- package/test/less-bom/errors/recursive-variable.txt +0 -2
- package/test/less-bom/errors/root-func-undefined-1.less +0 -1
- package/test/less-bom/errors/root-func-undefined-1.txt +0 -2
- package/test/less-bom/errors/root-func-undefined-2.less +0 -2
- package/test/less-bom/errors/root-func-undefined-2.txt +0 -3
- package/test/less-bom/errors/single-character.less +0 -1
- package/test/less-bom/errors/single-character.txt +0 -2
- package/test/less-bom/errors/svg-gradient1.less +0 -3
- package/test/less-bom/errors/svg-gradient1.txt +0 -4
- package/test/less-bom/errors/svg-gradient2.less +0 -3
- package/test/less-bom/errors/svg-gradient2.txt +0 -4
- package/test/less-bom/errors/svg-gradient3.less +0 -3
- package/test/less-bom/errors/svg-gradient3.txt +0 -4
- package/test/less-bom/errors/svg-gradient4.less +0 -4
- package/test/less-bom/errors/svg-gradient4.txt +0 -4
- package/test/less-bom/errors/svg-gradient5.less +0 -4
- package/test/less-bom/errors/svg-gradient5.txt +0 -4
- package/test/less-bom/errors/svg-gradient6.less +0 -4
- package/test/less-bom/errors/svg-gradient6.txt +0 -4
- package/test/less-bom/errors/unit-function.less +0 -3
- package/test/less-bom/errors/unit-function.txt +0 -4
- package/test/less-bom/extend-chaining.less +0 -91
- package/test/less-bom/extend-clearfix.less +0 -19
- package/test/less-bom/extend-exact.less +0 -46
- package/test/less-bom/extend-media.less +0 -24
- package/test/less-bom/extend-nest.less +0 -65
- package/test/less-bom/extend-selector.less +0 -110
- package/test/less-bom/extend.less +0 -81
- package/test/less-bom/extract-and-length.less +0 -146
- package/test/less-bom/filemanagerPlugin/colors.test +0 -1
- package/test/less-bom/filemanagerPlugin/filemanager.less +0 -4
- package/test/less-bom/functions-each.less +0 -131
- package/test/less-bom/functions.less +0 -279
- package/test/less-bom/globalVars/extended.json +0 -5
- package/test/less-bom/globalVars/extended.less +0 -10
- package/test/less-bom/globalVars/simple.json +0 -3
- package/test/less-bom/globalVars/simple.less +0 -3
- package/test/less-bom/ie-filters.less +0 -15
- package/test/less-bom/import/css-import.less +0 -1
- package/test/less-bom/import/deeper/deeper-2/url-import-2.less +0 -3
- package/test/less-bom/import/deeper/deeper-2/url-import.less +0 -1
- package/test/less-bom/import/deeper/import-once-test-a.less +0 -1
- package/test/less-bom/import/deeper/url-import.less +0 -1
- package/test/less-bom/import/import-and-relative-paths-test.less +0 -17
- package/test/less-bom/import/import-charset-test.less +0 -1
- package/test/less-bom/import/import-inline-invalid-css.less +0 -1
- package/test/less-bom/import/import-interpolation.less +0 -2
- package/test/less-bom/import/import-interpolation2.less +0 -5
- package/test/less-bom/import/import-once-test-c.less +0 -6
- package/test/less-bom/import/import-reference.less +0 -98
- package/test/less-bom/import/import-test-a.less +0 -5
- package/test/less-bom/import/import-test-b.less +0 -8
- package/test/less-bom/import/import-test-c.less +0 -6
- package/test/less-bom/import/import-test-d.css +0 -1
- package/test/less-bom/import/import-test-e.less +0 -2
- package/test/less-bom/import/import-test-f.less +0 -5
- package/test/less-bom/import/imports/font.less +0 -8
- package/test/less-bom/import/imports/logo.less +0 -6
- package/test/less-bom/import/interpolation-vars.less +0 -6
- package/test/less-bom/import/invalid-css.less +0 -1
- package/test/less-bom/import/urls.less +0 -1
- package/test/less-bom/import-inline.less +0 -3
- package/test/less-bom/import-interpolation.less +0 -8
- package/test/less-bom/import-module.less +0 -3
- package/test/less-bom/import-once.less +0 -6
- package/test/less-bom/import-reference-issues/appender-reference-1968.less +0 -6
- package/test/less-bom/import-reference-issues/global-scope-import.less +0 -13
- package/test/less-bom/import-reference-issues/global-scope-nested.less +0 -3
- package/test/less-bom/import-reference-issues/mixin-1968.less +0 -8
- package/test/less-bom/import-reference-issues/multiple-import-nested.less +0 -12
- package/test/less-bom/import-reference-issues/multiple-import.less +0 -10
- package/test/less-bom/import-reference-issues/simple-mixin.css +0 -3
- package/test/less-bom/import-reference-issues/simple-ruleset-2162.less +0 -3
- package/test/less-bom/import-reference-issues.less +0 -50
- package/test/less-bom/import-reference.less +0 -26
- package/test/less-bom/import.less +0 -29
- package/test/less-bom/include-path/include-path.less +0 -8
- package/test/less-bom/include-path-string/include-path-string.less +0 -3
- package/test/less-bom/javascript.less +0 -39
- package/test/less-bom/lazy-eval.less +0 -6
- package/test/less-bom/legacy/legacy.less +0 -21
- package/test/less-bom/math/parens-division/media-math.less +0 -9
- package/test/less-bom/math/parens-division/mixins-args.less +0 -264
- package/test/less-bom/math/parens-division/new-division.less +0 -17
- package/test/less-bom/math/parens-division/parens.less +0 -46
- package/test/less-bom/math/strict/css.less +0 -108
- package/test/less-bom/math/strict/media-math.less +0 -9
- package/test/less-bom/math/strict/mixins-args.less +0 -264
- package/test/less-bom/math/strict/parens.less +0 -46
- package/test/less-bom/math/strict-legacy/css.less +0 -108
- package/test/less-bom/math/strict-legacy/media-math.less +0 -9
- package/test/less-bom/math/strict-legacy/mixins-args.less +0 -263
- package/test/less-bom/math/strict-legacy/parens.less +0 -50
- package/test/less-bom/media.less +0 -241
- package/test/less-bom/merge.less +0 -81
- package/test/less-bom/mixins-closure.less +0 -26
- package/test/less-bom/mixins-guards-default-func.less +0 -195
- package/test/less-bom/mixins-guards.less +0 -358
- package/test/less-bom/mixins-important.less +0 -53
- package/test/less-bom/mixins-interpolated.less +0 -75
- package/test/less-bom/mixins-named-args.less +0 -36
- package/test/less-bom/mixins-nested.less +0 -22
- package/test/less-bom/mixins-pattern.less +0 -102
- package/test/less-bom/mixins.less +0 -145
- package/test/less-bom/modifyVars/extended.json +0 -5
- package/test/less-bom/modifyVars/extended.less +0 -11
- package/test/less-bom/namespacing/imports/a-better-bootstrap.less +0 -13
- package/test/less-bom/namespacing/imports/library.less +0 -14
- package/test/less-bom/namespacing/namespacing-1.less +0 -42
- package/test/less-bom/namespacing/namespacing-2.less +0 -27
- package/test/less-bom/namespacing/namespacing-3.less +0 -28
- package/test/less-bom/namespacing/namespacing-4.less +0 -33
- package/test/less-bom/namespacing/namespacing-5.less +0 -32
- package/test/less-bom/namespacing/namespacing-6.less +0 -26
- package/test/less-bom/namespacing/namespacing-7.less +0 -48
- package/test/less-bom/namespacing/namespacing-functions.less +0 -11
- package/test/less-bom/namespacing/namespacing-media.less +0 -26
- package/test/less-bom/namespacing/namespacing-operations.less +0 -15
- package/test/less-bom/nested-gradient-with-svg-gradient/mixin-consumer.less +0 -5
- package/test/less-bom/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +0 -15
- package/test/less-bom/no-js-errors/no-js-errors.less +0 -3
- package/test/less-bom/no-js-errors/no-js-errors.txt +0 -4
- package/test/less-bom/no-output.less +0 -2
- package/test/less-bom/no-strict-math/mixins-guards.less +0 -25
- package/test/less-bom/no-strict-math/no-sm-operations.less +0 -16
- package/test/less-bom/operations.less +0 -63
- package/test/less-bom/parse-interpolation.less +0 -53
- package/test/less-bom/permissive-parse.less +0 -50
- package/test/less-bom/plugin/plugin-collection.js +0 -9
- package/test/less-bom/plugin/plugin-global.js +0 -9
- package/test/less-bom/plugin/plugin-local.js +0 -14
- package/test/less-bom/plugin/plugin-preeval.js +0 -27
- package/test/less-bom/plugin/plugin-scope1.js +0 -3
- package/test/less-bom/plugin/plugin-scope2.js +0 -3
- package/test/less-bom/plugin/plugin-set-options-v2.js +0 -33
- package/test/less-bom/plugin/plugin-set-options-v3.js +0 -31
- package/test/less-bom/plugin/plugin-set-options.js +0 -32
- package/test/less-bom/plugin/plugin-simple.js +0 -7
- package/test/less-bom/plugin/plugin-transitive.js +0 -6
- package/test/less-bom/plugin/plugin-transitive.less +0 -5
- package/test/less-bom/plugin/plugin-tree-nodes.js +0 -82
- package/test/less-bom/plugin-module.less +0 -7
- package/test/less-bom/plugin-preeval.less +0 -15
- package/test/less-bom/plugin.less +0 -142
- package/test/less-bom/postProcessorPlugin/postProcessor.less +0 -4
- package/test/less-bom/preProcessorPlugin/preProcessor.less +0 -3
- package/test/less-bom/property-accessors.less +0 -67
- package/test/less-bom/property-name-interp.less +0 -56
- package/test/less-bom/rewrite-urls-all/folder/file.less +0 -8
- package/test/less-bom/rewrite-urls-all/rewrite-urls-all.less +0 -11
- package/test/less-bom/rewrite-urls-local/folder/file.less +0 -8
- package/test/less-bom/rewrite-urls-local/rewrite-urls-local.less +0 -11
- package/test/less-bom/root-registry/file.less +0 -1
- package/test/less-bom/root-registry/root.less +0 -3
- package/test/less-bom/rootpath-rewrite-urls-all/folder/file.less +0 -8
- package/test/less-bom/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.less +0 -11
- package/test/less-bom/rootpath-rewrite-urls-local/folder/file.less +0 -8
- package/test/less-bom/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.less +0 -11
- package/test/less-bom/rulesets.less +0 -30
- package/test/less-bom/scope.less +0 -104
- package/test/less-bom/selectors.less +0 -184
- package/test/less-bom/sourcemaps/basic.json +0 -3
- package/test/less-bom/sourcemaps/basic.less +0 -27
- package/test/less-bom/sourcemaps/custom-props.less +0 -8
- package/test/less-bom/sourcemaps/imported.css +0 -7
- package/test/less-bom/sourcemaps-empty/empty.less +0 -1
- package/test/less-bom/sourcemaps-empty/var-defs.less +0 -1
- package/test/less-bom/static-urls/urls.less +0 -33
- package/test/less-bom/strict-units/strict-units.less +0 -4
- package/test/less-bom/strings.less +0 -73
- package/test/less-bom/url-args/urls.less +0 -63
- package/test/less-bom/urls.less +0 -94
- package/test/less-bom/variables-in-at-rules.less +0 -20
- package/test/less-bom/variables.less +0 -127
- package/test/less-bom/visitorPlugin/visitor.less +0 -4
- package/test/less-bom/whitespace.less +0 -44
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import tree from '../tree';
|
|
2
|
+
import Visitor from './visitor';
|
|
3
|
+
import logger from '../logger';
|
|
4
|
+
import * as utils from '../utils';
|
|
5
5
|
|
|
6
6
|
/* jshint loopfunc:true */
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
class ExtendFinderVisitor {
|
|
9
|
+
constructor() {
|
|
10
|
+
this._visitor = new Visitor(this);
|
|
11
|
+
this.contexts = [];
|
|
12
|
+
this.allExtendsStack = [[]];
|
|
13
|
+
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
run: function (root) {
|
|
15
|
+
run(root) {
|
|
16
16
|
root = this._visitor.visit(root);
|
|
17
17
|
root.allExtends = this.allExtendsStack[0];
|
|
18
18
|
return root;
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
visitDeclaration(declNode, visitArgs) {
|
|
21
22
|
visitArgs.visitDeeper = false;
|
|
22
|
-
}
|
|
23
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
visitMixinDefinition(mixinDefinitionNode, visitArgs) {
|
|
24
26
|
visitArgs.visitDeeper = false;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
visitRuleset(rulesetNode, visitArgs) {
|
|
27
30
|
if (rulesetNode.root) {
|
|
28
31
|
return;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
let i;
|
|
35
|
+
let j;
|
|
36
|
+
let extend;
|
|
37
|
+
const allSelectorsExtendList = [];
|
|
38
|
+
let extendList;
|
|
32
39
|
|
|
33
40
|
// get &:extend(.a); rules which apply to all selectors in this ruleset
|
|
34
|
-
|
|
41
|
+
const rules = rulesetNode.rules;
|
|
42
|
+
|
|
43
|
+
const ruleCnt = rules ? rules.length : 0;
|
|
35
44
|
for (i = 0; i < ruleCnt; i++) {
|
|
36
45
|
if (rulesetNode.rules[i] instanceof tree.Extend) {
|
|
37
46
|
allSelectorsExtendList.push(rules[i]);
|
|
@@ -41,19 +50,17 @@ ExtendFinderVisitor.prototype = {
|
|
|
41
50
|
|
|
42
51
|
// now find every selector and apply the extends that apply to all extends
|
|
43
52
|
// and the ones which apply to an individual extend
|
|
44
|
-
|
|
53
|
+
const paths = rulesetNode.paths;
|
|
45
54
|
for (i = 0; i < paths.length; i++) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
const selectorPath = paths[i];
|
|
56
|
+
const selector = selectorPath[selectorPath.length - 1];
|
|
57
|
+
const selExtendList = selector.extendList;
|
|
49
58
|
|
|
50
59
|
extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList)
|
|
51
|
-
|
|
60
|
+
: allSelectorsExtendList;
|
|
52
61
|
|
|
53
62
|
if (extendList) {
|
|
54
|
-
extendList = extendList.map(
|
|
55
|
-
return allSelectorsExtend.clone();
|
|
56
|
-
});
|
|
63
|
+
extendList = extendList.map(allSelectorsExtend => allSelectorsExtend.clone());
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
for (j = 0; j < extendList.length; j++) {
|
|
@@ -67,62 +74,67 @@ ExtendFinderVisitor.prototype = {
|
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
this.contexts.push(rulesetNode.selectors);
|
|
70
|
-
}
|
|
71
|
-
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
visitRulesetOut(rulesetNode) {
|
|
72
80
|
if (!rulesetNode.root) {
|
|
73
81
|
this.contexts.length = this.contexts.length - 1;
|
|
74
82
|
}
|
|
75
|
-
}
|
|
76
|
-
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
visitMedia(mediaNode, visitArgs) {
|
|
77
86
|
mediaNode.allExtends = [];
|
|
78
87
|
this.allExtendsStack.push(mediaNode.allExtends);
|
|
79
|
-
}
|
|
80
|
-
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
visitMediaOut(mediaNode) {
|
|
81
91
|
this.allExtendsStack.length = this.allExtendsStack.length - 1;
|
|
82
|
-
}
|
|
83
|
-
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
visitAtRule(atRuleNode, visitArgs) {
|
|
84
95
|
atRuleNode.allExtends = [];
|
|
85
96
|
this.allExtendsStack.push(atRuleNode.allExtends);
|
|
86
|
-
}
|
|
87
|
-
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
visitAtRuleOut(atRuleNode) {
|
|
88
100
|
this.allExtendsStack.length = this.allExtendsStack.length - 1;
|
|
89
101
|
}
|
|
90
|
-
}
|
|
102
|
+
}
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
class ProcessExtendsVisitor {
|
|
105
|
+
constructor() {
|
|
106
|
+
this._visitor = new Visitor(this);
|
|
107
|
+
}
|
|
95
108
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var extendFinder = new ExtendFinderVisitor();
|
|
109
|
+
run(root) {
|
|
110
|
+
const extendFinder = new ExtendFinderVisitor();
|
|
99
111
|
this.extendIndices = {};
|
|
100
112
|
extendFinder.run(root);
|
|
101
113
|
if (!extendFinder.foundExtends) { return root; }
|
|
102
114
|
root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends));
|
|
103
115
|
this.allExtendsStack = [root.allExtends];
|
|
104
|
-
|
|
116
|
+
const newRoot = this._visitor.visit(root);
|
|
105
117
|
this.checkExtendsForNonMatched(root.allExtends);
|
|
106
118
|
return newRoot;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var selector = '_unknown_';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
checkExtendsForNonMatched(extendList) {
|
|
122
|
+
const indices = this.extendIndices;
|
|
123
|
+
extendList.filter(extend => !extend.hasFoundMatches && extend.parent_ids.length == 1).forEach(extend => {
|
|
124
|
+
let selector = '_unknown_';
|
|
114
125
|
try {
|
|
115
126
|
selector = extend.selector.toCSS({});
|
|
116
127
|
}
|
|
117
128
|
catch (_) {}
|
|
118
129
|
|
|
119
|
-
if (!indices[extend.index
|
|
120
|
-
indices[extend.index
|
|
121
|
-
logger.warn(
|
|
130
|
+
if (!indices[`${extend.index} ${selector}`]) {
|
|
131
|
+
indices[`${extend.index} ${selector}`] = true;
|
|
132
|
+
logger.warn(`extend '${selector}' has no matches`);
|
|
122
133
|
}
|
|
123
134
|
});
|
|
124
|
-
}
|
|
125
|
-
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
doExtendChaining(extendsList, extendsListTarget, iterationCount) {
|
|
126
138
|
//
|
|
127
139
|
// chaining is different from normal extension.. if we extend an extend then we are not just copying, altering
|
|
128
140
|
// and pasting the selector we would do normally, but we are also adding an extend with the same target selector
|
|
@@ -132,8 +144,17 @@ ProcessExtendsVisitor.prototype = {
|
|
|
132
144
|
// this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already
|
|
133
145
|
// processed if we look at each selector at a time, as is done in visitRuleset
|
|
134
146
|
|
|
135
|
-
|
|
136
|
-
|
|
147
|
+
let extendIndex;
|
|
148
|
+
|
|
149
|
+
let targetExtendIndex;
|
|
150
|
+
let matches;
|
|
151
|
+
const extendsToAdd = [];
|
|
152
|
+
let newSelector;
|
|
153
|
+
const extendVisitor = this;
|
|
154
|
+
let selectorPath;
|
|
155
|
+
let extend;
|
|
156
|
+
let targetExtend;
|
|
157
|
+
let newExtend;
|
|
137
158
|
|
|
138
159
|
iterationCount = iterationCount || 0;
|
|
139
160
|
|
|
@@ -160,8 +181,8 @@ ProcessExtendsVisitor.prototype = {
|
|
|
160
181
|
extend.hasFoundMatches = true;
|
|
161
182
|
|
|
162
183
|
// we found a match, so for each self selector..
|
|
163
|
-
extend.selfSelectors.forEach(
|
|
164
|
-
|
|
184
|
+
extend.selfSelectors.forEach(selfSelector => {
|
|
185
|
+
const info = targetExtend.visibilityInfo();
|
|
165
186
|
|
|
166
187
|
// process the extend as usual
|
|
167
188
|
newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible());
|
|
@@ -197,15 +218,14 @@ ProcessExtendsVisitor.prototype = {
|
|
|
197
218
|
// may no longer be needed.
|
|
198
219
|
this.extendChainCount++;
|
|
199
220
|
if (iterationCount > 100) {
|
|
200
|
-
|
|
201
|
-
|
|
221
|
+
let selectorOne = '{unable to calculate}';
|
|
222
|
+
let selectorTwo = '{unable to calculate}';
|
|
202
223
|
try {
|
|
203
224
|
selectorOne = extendsToAdd[0].selfSelectors[0].toCSS();
|
|
204
225
|
selectorTwo = extendsToAdd[0].selector.toCSS();
|
|
205
226
|
}
|
|
206
227
|
catch (e) {}
|
|
207
|
-
throw { message:
|
|
208
|
-
selectorOne + ':extend(' + selectorTwo + ')'};
|
|
228
|
+
throw { message: `extend circular reference detected. One of the circular extends is currently:${selectorOne}:extend(${selectorTwo})`};
|
|
209
229
|
}
|
|
210
230
|
|
|
211
231
|
// now process the new extends on the existing rules so that we can handle a extending b extending c extending
|
|
@@ -214,22 +234,31 @@ ProcessExtendsVisitor.prototype = {
|
|
|
214
234
|
} else {
|
|
215
235
|
return extendsToAdd;
|
|
216
236
|
}
|
|
217
|
-
}
|
|
218
|
-
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
visitDeclaration(ruleNode, visitArgs) {
|
|
219
240
|
visitArgs.visitDeeper = false;
|
|
220
|
-
}
|
|
221
|
-
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
visitMixinDefinition(mixinDefinitionNode, visitArgs) {
|
|
222
244
|
visitArgs.visitDeeper = false;
|
|
223
|
-
}
|
|
224
|
-
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
visitSelector(selectorNode, visitArgs) {
|
|
225
248
|
visitArgs.visitDeeper = false;
|
|
226
|
-
}
|
|
227
|
-
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
visitRuleset(rulesetNode, visitArgs) {
|
|
228
252
|
if (rulesetNode.root) {
|
|
229
253
|
return;
|
|
230
254
|
}
|
|
231
|
-
|
|
232
|
-
|
|
255
|
+
let matches;
|
|
256
|
+
let pathIndex;
|
|
257
|
+
let extendIndex;
|
|
258
|
+
const allExtends = this.allExtendsStack[this.allExtendsStack.length - 1];
|
|
259
|
+
const selectorsToAdd = [];
|
|
260
|
+
const extendVisitor = this;
|
|
261
|
+
let selectorPath;
|
|
233
262
|
|
|
234
263
|
// look at each selector path in the ruleset, find any extend matches and then copy, find and replace
|
|
235
264
|
|
|
@@ -239,7 +268,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
239
268
|
|
|
240
269
|
// extending extends happens initially, before the main pass
|
|
241
270
|
if (rulesetNode.extendOnEveryPath) { continue; }
|
|
242
|
-
|
|
271
|
+
const extendList = selectorPath[selectorPath.length - 1].extendList;
|
|
243
272
|
if (extendList && extendList.length) { continue; }
|
|
244
273
|
|
|
245
274
|
matches = this.findMatch(allExtends[extendIndex], selectorPath);
|
|
@@ -247,8 +276,8 @@ ProcessExtendsVisitor.prototype = {
|
|
|
247
276
|
if (matches.length) {
|
|
248
277
|
allExtends[extendIndex].hasFoundMatches = true;
|
|
249
278
|
|
|
250
|
-
allExtends[extendIndex].selfSelectors.forEach(
|
|
251
|
-
|
|
279
|
+
allExtends[extendIndex].selfSelectors.forEach(selfSelector => {
|
|
280
|
+
let extendedSelectors;
|
|
252
281
|
extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible());
|
|
253
282
|
selectorsToAdd.push(extendedSelectors);
|
|
254
283
|
});
|
|
@@ -256,17 +285,25 @@ ProcessExtendsVisitor.prototype = {
|
|
|
256
285
|
}
|
|
257
286
|
}
|
|
258
287
|
rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd);
|
|
259
|
-
}
|
|
260
|
-
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
findMatch(extend, haystackSelectorPath) {
|
|
261
291
|
//
|
|
262
292
|
// look through the haystack selector path to try and find the needle - extend.selector
|
|
263
293
|
// returns an array of selector matches that can then be replaced
|
|
264
294
|
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
295
|
+
let haystackSelectorIndex;
|
|
296
|
+
|
|
297
|
+
let hackstackSelector;
|
|
298
|
+
let hackstackElementIndex;
|
|
299
|
+
let haystackElement;
|
|
300
|
+
let targetCombinator;
|
|
301
|
+
let i;
|
|
302
|
+
const extendVisitor = this;
|
|
303
|
+
const needleElements = extend.selector.elements;
|
|
304
|
+
const potentialMatches = [];
|
|
305
|
+
let potentialMatch;
|
|
306
|
+
const matches = [];
|
|
270
307
|
|
|
271
308
|
// loop through the haystack elements
|
|
272
309
|
for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) {
|
|
@@ -327,8 +364,9 @@ ProcessExtendsVisitor.prototype = {
|
|
|
327
364
|
}
|
|
328
365
|
}
|
|
329
366
|
return matches;
|
|
330
|
-
}
|
|
331
|
-
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
isElementValuesEqual(elementValue1, elementValue2) {
|
|
332
370
|
if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') {
|
|
333
371
|
return elementValue1 === elementValue2;
|
|
334
372
|
}
|
|
@@ -352,7 +390,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
352
390
|
if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {
|
|
353
391
|
return false;
|
|
354
392
|
}
|
|
355
|
-
for (
|
|
393
|
+
for (let i = 0; i < elementValue1.elements.length; i++) {
|
|
356
394
|
if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {
|
|
357
395
|
if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {
|
|
358
396
|
return false;
|
|
@@ -365,19 +403,20 @@ ProcessExtendsVisitor.prototype = {
|
|
|
365
403
|
return true;
|
|
366
404
|
}
|
|
367
405
|
return false;
|
|
368
|
-
}
|
|
369
|
-
extendSelector:function (matches, selectorPath, replacementSelector, isVisible) {
|
|
406
|
+
}
|
|
370
407
|
|
|
408
|
+
extendSelector(matches, selectorPath, replacementSelector, isVisible) {
|
|
371
409
|
// for a set of matches, replace each match with the replacement selector
|
|
372
410
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
411
|
+
let currentSelectorPathIndex = 0;
|
|
412
|
+
|
|
413
|
+
let currentSelectorPathElementIndex = 0;
|
|
414
|
+
let path = [];
|
|
415
|
+
let matchIndex;
|
|
416
|
+
let selector;
|
|
417
|
+
let firstElement;
|
|
418
|
+
let match;
|
|
419
|
+
let newElements;
|
|
381
420
|
|
|
382
421
|
for (matchIndex = 0; matchIndex < matches.length; matchIndex++) {
|
|
383
422
|
match = matches[matchIndex];
|
|
@@ -427,9 +466,9 @@ ProcessExtendsVisitor.prototype = {
|
|
|
427
466
|
}
|
|
428
467
|
|
|
429
468
|
path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length));
|
|
430
|
-
path = path.map(
|
|
469
|
+
path = path.map(currentValue => {
|
|
431
470
|
// we can re-use elements here, because the visibility property matters only for selectors
|
|
432
|
-
|
|
471
|
+
const derived = currentValue.createDerived(currentValue.elements);
|
|
433
472
|
if (isVisible) {
|
|
434
473
|
derived.ensureVisibility();
|
|
435
474
|
} else {
|
|
@@ -438,25 +477,29 @@ ProcessExtendsVisitor.prototype = {
|
|
|
438
477
|
return derived;
|
|
439
478
|
});
|
|
440
479
|
return path;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
visitMedia(mediaNode, visitArgs) {
|
|
483
|
+
let newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
|
|
444
484
|
newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));
|
|
445
485
|
this.allExtendsStack.push(newAllExtends);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
visitMediaOut(mediaNode) {
|
|
489
|
+
const lastIndex = this.allExtendsStack.length - 1;
|
|
449
490
|
this.allExtendsStack.length = lastIndex;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
visitAtRule(atRuleNode, visitArgs) {
|
|
494
|
+
let newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
|
|
453
495
|
newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends));
|
|
454
496
|
this.allExtendsStack.push(newAllExtends);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
visitAtRuleOut(atRuleNode) {
|
|
500
|
+
const lastIndex = this.allExtendsStack.length - 1;
|
|
458
501
|
this.allExtendsStack.length = lastIndex;
|
|
459
502
|
}
|
|
460
|
-
}
|
|
503
|
+
}
|
|
461
504
|
|
|
462
|
-
|
|
505
|
+
export default ProcessExtendsVisitor;
|
|
@@ -1,54 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
class ImportSequencer {
|
|
2
|
+
constructor(onSequencerEmpty) {
|
|
3
|
+
this.imports = [];
|
|
4
|
+
this.variableImports = [];
|
|
5
|
+
this._onSequencerEmpty = onSequencerEmpty;
|
|
6
|
+
this._currentDepth = 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
addImport(callback) {
|
|
10
|
+
const importSequencer = this;
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
importItem = {
|
|
11
|
-
callback: callback,
|
|
12
|
+
const importItem = {
|
|
13
|
+
callback,
|
|
12
14
|
args: null,
|
|
13
15
|
isReady: false
|
|
14
16
|
};
|
|
15
|
-
this.imports.push(importItem);
|
|
16
|
-
return function() {
|
|
17
|
-
importItem.args = Array.prototype.slice.call(arguments, 0);
|
|
18
|
-
importItem.isReady = true;
|
|
19
|
-
importSequencer.tryRun();
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
this.imports.push(importItem);
|
|
19
|
+
return function(...args) {
|
|
20
|
+
importItem.args = Array.prototype.slice.call(args, 0);
|
|
21
|
+
importItem.isReady = true;
|
|
22
|
+
importSequencer.tryRun();
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
addVariableImport(callback) {
|
|
27
|
+
this.variableImports.push(callback);
|
|
28
|
+
}
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
tryRun() {
|
|
31
|
+
this._currentDepth++;
|
|
32
|
+
try {
|
|
33
|
+
while (true) {
|
|
34
|
+
while (this.imports.length > 0) {
|
|
35
|
+
const importItem = this.imports[0];
|
|
36
|
+
if (!importItem.isReady) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.imports = this.imports.slice(1);
|
|
40
|
+
importItem.callback.apply(null, importItem.args);
|
|
35
41
|
}
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
if (this.variableImports.length === 0) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
const variableImport = this.variableImports[0];
|
|
46
|
+
this.variableImports = this.variableImports.slice(1);
|
|
47
|
+
variableImport();
|
|
41
48
|
}
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
|
|
49
|
+
} finally {
|
|
50
|
+
this._currentDepth--;
|
|
51
|
+
}
|
|
52
|
+
if (this._currentDepth === 0 && this._onSequencerEmpty) {
|
|
53
|
+
this._onSequencerEmpty();
|
|
45
54
|
}
|
|
46
|
-
} finally {
|
|
47
|
-
this._currentDepth--;
|
|
48
|
-
}
|
|
49
|
-
if (this._currentDepth === 0 && this._onSequencerEmpty) {
|
|
50
|
-
this._onSequencerEmpty();
|
|
51
55
|
}
|
|
52
|
-
}
|
|
56
|
+
}
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
export default ImportSequencer;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import contexts from '../contexts';
|
|
2
|
+
import Visitor from './visitor';
|
|
3
|
+
import ImportSequencer from './import-sequencer';
|
|
4
|
+
import * as utils from '../utils';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const ImportVisitor = function(importer, finish) {
|
|
7
7
|
|
|
8
8
|
this._visitor = new Visitor(this);
|
|
9
9
|
this._importer = importer;
|
|
@@ -36,12 +36,12 @@ ImportVisitor.prototype = {
|
|
|
36
36
|
this._finish(this.error);
|
|
37
37
|
},
|
|
38
38
|
visitImport: function (importNode, visitArgs) {
|
|
39
|
-
|
|
39
|
+
const inlineCSS = importNode.options.inline;
|
|
40
40
|
|
|
41
41
|
if (!importNode.css || inlineCSS) {
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const context = new contexts.Eval(this.context, utils.copyArray(this.context.frames));
|
|
44
|
+
const importParent = context.frames[0];
|
|
45
45
|
|
|
46
46
|
this.importCount++;
|
|
47
47
|
if (importNode.isVariableImport()) {
|
|
@@ -53,8 +53,8 @@ ImportVisitor.prototype = {
|
|
|
53
53
|
visitArgs.visitDeeper = false;
|
|
54
54
|
},
|
|
55
55
|
processImportNode: function(importNode, context, importParent) {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
let evaldImportNode;
|
|
57
|
+
const inlineCSS = importNode.options.inline;
|
|
58
58
|
|
|
59
59
|
try {
|
|
60
60
|
evaldImportNode = importNode.evalForImport(context);
|
|
@@ -67,23 +67,22 @@ ImportVisitor.prototype = {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {
|
|
70
|
-
|
|
71
70
|
if (evaldImportNode.options.multiple) {
|
|
72
71
|
context.importMultiple = true;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
// try appending if we haven't determined if it is css or not
|
|
76
|
-
|
|
75
|
+
const tryAppendLessExtension = evaldImportNode.css === undefined;
|
|
77
76
|
|
|
78
|
-
for (
|
|
77
|
+
for (let i = 0; i < importParent.rules.length; i++) {
|
|
79
78
|
if (importParent.rules[i] === importNode) {
|
|
80
79
|
importParent.rules[i] = evaldImportNode;
|
|
81
80
|
break;
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const onImported = this.onImported.bind(this, evaldImportNode, context);
|
|
85
|
+
const sequencedOnImported = this._sequencer.addImport(onImported);
|
|
87
86
|
|
|
88
87
|
this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(),
|
|
89
88
|
evaldImportNode.options, sequencedOnImported);
|
|
@@ -102,17 +101,17 @@ ImportVisitor.prototype = {
|
|
|
102
101
|
this.error = e;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
const importVisitor = this;
|
|
105
|
+
const inlineCSS = importNode.options.inline;
|
|
106
|
+
const isPlugin = importNode.options.isPlugin;
|
|
107
|
+
const isOptional = importNode.options.optional;
|
|
108
|
+
const duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
|
|
110
109
|
|
|
111
110
|
if (!context.importMultiple) {
|
|
112
111
|
if (duplicateImport) {
|
|
113
112
|
importNode.skip = true;
|
|
114
113
|
} else {
|
|
115
|
-
importNode.skip =
|
|
114
|
+
importNode.skip = () => {
|
|
116
115
|
if (fullPath in importVisitor.onceFileDetectionMap) {
|
|
117
116
|
return true;
|
|
118
117
|
}
|
|
@@ -133,7 +132,7 @@ ImportVisitor.prototype = {
|
|
|
133
132
|
if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) {
|
|
134
133
|
importVisitor.recursionDetector[fullPath] = true;
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
const oldContext = this.context;
|
|
137
136
|
this.context = context;
|
|
138
137
|
try {
|
|
139
138
|
this._visitor.visit(root);
|
|
@@ -187,4 +186,4 @@ ImportVisitor.prototype = {
|
|
|
187
186
|
this.context.frames.shift();
|
|
188
187
|
}
|
|
189
188
|
};
|
|
190
|
-
|
|
189
|
+
export default ImportVisitor;
|