From a722237c1f6baba9bea82bce3e275b9e51311a00 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 6 Jul 2020 20:24:29 -0700 Subject: [PATCH] Remove lib folder from git (#3531) * Remove lib from repo * Add lib folder to .gitignore * Remove src from publish --- packages/less/.gitignore | 1 + packages/less/.npmignore | 3 +- packages/less/Gruntfile.js | 6 +- .../lib/less-browser/add-default-options.js | 45 - .../less-browser/add-default-options.js.map | 1 - packages/less/lib/less-browser/bootstrap.js | 64 - .../less/lib/less-browser/bootstrap.js.map | 1 - packages/less/lib/less-browser/browser.js | 80 - packages/less/lib/less-browser/browser.js.map | 1 - packages/less/lib/less-browser/cache.js | 45 - packages/less/lib/less-browser/cache.js.map | 1 - .../less/lib/less-browser/error-reporting.js | 183 -- .../lib/less-browser/error-reporting.js.map | 1 - .../less/lib/less-browser/file-manager.js | 122 - .../less/lib/less-browser/file-manager.js.map | 1 - packages/less/lib/less-browser/image-size.js | 30 - .../less/lib/less-browser/image-size.js.map | 1 - packages/less/lib/less-browser/index.js | 256 -- packages/less/lib/less-browser/index.js.map | 1 - .../less/lib/less-browser/log-listener.js | 43 - .../less/lib/less-browser/log-listener.js.map | 1 - .../less/lib/less-browser/plugin-loader.js | 42 - .../lib/less-browser/plugin-loader.js.map | 1 - packages/less/lib/less-browser/utils.js | 29 - packages/less/lib/less-browser/utils.js.map | 1 - packages/less/lib/less-node/environment.js | 19 - .../less/lib/less-node/environment.js.map | 1 - packages/less/lib/less-node/file-manager.js | 158 -- .../less/lib/less-node/file-manager.js.map | 1 - packages/less/lib/less-node/fs.js | 11 - packages/less/lib/less-node/fs.js.map | 1 - packages/less/lib/less-node/image-size.js | 54 - packages/less/lib/less-node/image-size.js.map | 1 - packages/less/lib/less-node/index.js | 28 - packages/less/lib/less-node/index.js.map | 1 - packages/less/lib/less-node/lessc-helper.js | 92 - .../less/lib/less-node/lessc-helper.js.map | 1 - packages/less/lib/less-node/plugin-loader.js | 73 - .../less/lib/less-node/plugin-loader.js.map | 1 - .../less/lib/less-node/url-file-manager.js | 71 - .../lib/less-node/url-file-manager.js.map | 1 - packages/less/lib/less/constants.js | 15 - packages/less/lib/less/constants.js.map | 1 - packages/less/lib/less/contexts.js | 171 -- packages/less/lib/less/contexts.js.map | 1 - packages/less/lib/less/data/colors.js | 153 -- packages/less/lib/less/data/colors.js.map | 1 - packages/less/lib/less/data/index.js | 9 - packages/less/lib/less/data/index.js.map | 1 - .../less/lib/less/data/unit-conversions.js | 24 - .../lib/less/data/unit-conversions.js.map | 1 - packages/less/lib/less/default-options.js | 57 - packages/less/lib/less/default-options.js.map | 1 - .../less/environment/abstract-file-manager.js | 122 - .../environment/abstract-file-manager.js.map | 1 - .../environment/abstract-plugin-loader.js | 168 -- .../environment/abstract-plugin-loader.js.map | 1 - .../lib/less/environment/environment-api.js | 28 - .../less/environment/environment-api.js.map | 1 - .../less/lib/less/environment/environment.js | 57 - .../lib/less/environment/environment.js.map | 1 - .../lib/less/environment/file-manager-api.js | 106 - .../less/environment/file-manager-api.js.map | 1 - packages/less/lib/less/functions/boolean.js | 16 - .../less/lib/less/functions/boolean.js.map | 1 - .../less/lib/less/functions/color-blending.js | 78 - .../lib/less/functions/color-blending.js.map | 1 - packages/less/lib/less/functions/color.js | 404 --- packages/less/lib/less/functions/color.js.map | 1 - packages/less/lib/less/functions/data-uri.js | 86 - .../less/lib/less/functions/data-uri.js.map | 1 - packages/less/lib/less/functions/default.js | 29 - .../less/lib/less/functions/default.js.map | 1 - .../lib/less/functions/function-caller.js | 51 - .../lib/less/functions/function-caller.js.map | 1 - .../lib/less/functions/function-registry.js | 36 - .../less/functions/function-registry.js.map | 1 - packages/less/lib/less/functions/index.js | 35 - packages/less/lib/less/functions/index.js.map | 1 - packages/less/lib/less/functions/list.js | 128 - packages/less/lib/less/functions/list.js.map | 1 - .../less/lib/less/functions/math-helper.js | 20 - .../lib/less/functions/math-helper.js.map | 1 - packages/less/lib/less/functions/math.js | 30 - packages/less/lib/less/functions/math.js.map | 1 - packages/less/lib/less/functions/number.js | 98 - .../less/lib/less/functions/number.js.map | 1 - packages/less/lib/less/functions/string.js | 42 - .../less/lib/less/functions/string.js.map | 1 - packages/less/lib/less/functions/svg.js | 88 - packages/less/lib/less/functions/svg.js.map | 1 - packages/less/lib/less/functions/types.js | 75 - packages/less/lib/less/functions/types.js.map | 1 - packages/less/lib/less/import-manager.js | 184 -- packages/less/lib/less/import-manager.js.map | 1 - packages/less/lib/less/index.js | 122 - packages/less/lib/less/index.js.map | 1 - packages/less/lib/less/less-error.js | 162 -- packages/less/lib/less/less-error.js.map | 1 - packages/less/lib/less/logger.js | 37 - packages/less/lib/less/logger.js.map | 1 - packages/less/lib/less/parse-tree.js | 65 - packages/less/lib/less/parse-tree.js.map | 1 - packages/less/lib/less/parse.js | 109 - packages/less/lib/less/parse.js.map | 1 - packages/less/lib/less/parser/chunker.js | 147 -- packages/less/lib/less/parser/chunker.js.map | 1 - packages/less/lib/less/parser/parser-input.js | 355 --- .../less/lib/less/parser/parser-input.js.map | 1 - packages/less/lib/less/parser/parser.js | 2262 ----------------- packages/less/lib/less/parser/parser.js.map | 1 - packages/less/lib/less/plugin-manager.js | 158 -- packages/less/lib/less/plugin-manager.js.map | 1 - packages/less/lib/less/render.js | 65 - packages/less/lib/less/render.js.map | 1 - packages/less/lib/less/source-map-builder.js | 72 - .../less/lib/less/source-map-builder.js.map | 1 - packages/less/lib/less/source-map-output.js | 136 - .../less/lib/less/source-map-output.js.map | 1 - packages/less/lib/less/transform-tree.js | 93 - packages/less/lib/less/transform-tree.js.map | 1 - packages/less/lib/less/tree/anonymous.js | 52 - packages/less/lib/less/tree/anonymous.js.map | 1 - packages/less/lib/less/tree/assignment.js | 50 - packages/less/lib/less/tree/assignment.js.map | 1 - packages/less/lib/less/tree/atrule.js | 164 -- packages/less/lib/less/tree/atrule.js.map | 1 - packages/less/lib/less/tree/attribute.js | 47 - packages/less/lib/less/tree/attribute.js.map | 1 - packages/less/lib/less/tree/call.js | 114 - packages/less/lib/less/tree/call.js.map | 1 - packages/less/lib/less/tree/color.js | 261 -- packages/less/lib/less/tree/color.js.map | 1 - packages/less/lib/less/tree/combinator.js | 47 - packages/less/lib/less/tree/combinator.js.map | 1 - packages/less/lib/less/tree/comment.js | 46 - packages/less/lib/less/tree/comment.js.map | 1 - packages/less/lib/less/tree/condition.js | 59 - packages/less/lib/less/tree/condition.js.map | 1 - packages/less/lib/less/tree/debug-info.js | 37 - packages/less/lib/less/tree/debug-info.js.map | 1 - packages/less/lib/less/tree/declaration.js | 136 - .../less/lib/less/tree/declaration.js.map | 1 - .../less/lib/less/tree/detached-ruleset.js | 65 - .../lib/less/tree/detached-ruleset.js.map | 1 - packages/less/lib/less/tree/dimension.js | 177 -- packages/less/lib/less/tree/dimension.js.map | 1 - packages/less/lib/less/tree/element.js | 82 - packages/less/lib/less/tree/element.js.map | 1 - packages/less/lib/less/tree/expression.js | 108 - packages/less/lib/less/tree/expression.js.map | 1 - packages/less/lib/less/tree/extend.js | 77 - packages/less/lib/less/tree/extend.js.map | 1 - packages/less/lib/less/tree/import.js | 209 -- packages/less/lib/less/tree/import.js.map | 1 - packages/less/lib/less/tree/index.js | 57 - packages/less/lib/less/tree/index.js.map | 1 - packages/less/lib/less/tree/javascript.js | 53 - packages/less/lib/less/tree/javascript.js.map | 1 - packages/less/lib/less/tree/js-eval-node.js | 75 - .../less/lib/less/tree/js-eval-node.js.map | 1 - packages/less/lib/less/tree/keyword.js | 39 - packages/less/lib/less/tree/keyword.js.map | 1 - packages/less/lib/less/tree/media.js | 170 -- packages/less/lib/less/tree/media.js.map | 1 - packages/less/lib/less/tree/mixin-call.js | 212 -- packages/less/lib/less/tree/mixin-call.js.map | 1 - .../less/lib/less/tree/mixin-definition.js | 251 -- .../lib/less/tree/mixin-definition.js.map | 1 - .../less/lib/less/tree/namespace-value.js | 94 - .../less/lib/less/tree/namespace-value.js.map | 1 - packages/less/lib/less/tree/negative.js | 43 - packages/less/lib/less/tree/negative.js.map | 1 - packages/less/lib/less/tree/node.js | 160 -- packages/less/lib/less/tree/node.js.map | 1 - packages/less/lib/less/tree/operation.js | 95 - packages/less/lib/less/tree/operation.js.map | 1 - packages/less/lib/less/tree/paren.js | 39 - packages/less/lib/less/tree/paren.js.map | 1 - packages/less/lib/less/tree/property.js | 80 - packages/less/lib/less/tree/property.js.map | 1 - packages/less/lib/less/tree/quoted.js | 84 - packages/less/lib/less/tree/quoted.js.map | 1 - packages/less/lib/less/tree/ruleset.js | 804 ------ packages/less/lib/less/tree/ruleset.js.map | 1 - packages/less/lib/less/tree/selector.js | 144 -- packages/less/lib/less/tree/selector.js.map | 1 - .../less/lib/less/tree/unicode-descriptor.js | 31 - .../lib/less/tree/unicode-descriptor.js.map | 1 - packages/less/lib/less/tree/unit.js | 159 -- packages/less/lib/less/tree/unit.js.map | 1 - packages/less/lib/less/tree/url.js | 78 - packages/less/lib/less/tree/url.js.map | 1 - packages/less/lib/less/tree/value.js | 61 - packages/less/lib/less/tree/value.js.map | 1 - packages/less/lib/less/tree/variable-call.js | 62 - .../less/lib/less/tree/variable-call.js.map | 1 - packages/less/lib/less/tree/variable.js | 79 - packages/less/lib/less/tree/variable.js.map | 1 - packages/less/lib/less/utils.js | 153 -- packages/less/lib/less/utils.js.map | 1 - .../less/lib/less/visitors/extend-visitor.js | 462 ---- .../lib/less/visitors/extend-visitor.js.map | 1 - .../lib/less/visitors/import-sequencer.js | 61 - .../lib/less/visitors/import-sequencer.js.map | 1 - .../less/lib/less/visitors/import-visitor.js | 202 -- .../lib/less/visitors/import-visitor.js.map | 1 - packages/less/lib/less/visitors/index.js | 20 - packages/less/lib/less/visitors/index.js.map | 1 - .../less/visitors/join-selector-visitor.js | 57 - .../visitors/join-selector-visitor.js.map | 1 - .../visitors/set-tree-visibility-visitor.js | 43 - .../set-tree-visibility-visitor.js.map | 1 - .../less/lib/less/visitors/to-css-visitor.js | 321 --- .../lib/less/visitors/to-css-visitor.js.map | 1 - packages/less/lib/less/visitors/visitor.js | 158 -- .../less/lib/less/visitors/visitor.js.map | 1 - packages/less/package.json | 3 +- 218 files changed, 10 insertions(+), 13726 deletions(-) delete mode 100644 packages/less/lib/less-browser/add-default-options.js delete mode 100644 packages/less/lib/less-browser/add-default-options.js.map delete mode 100644 packages/less/lib/less-browser/bootstrap.js delete mode 100644 packages/less/lib/less-browser/bootstrap.js.map delete mode 100644 packages/less/lib/less-browser/browser.js delete mode 100644 packages/less/lib/less-browser/browser.js.map delete mode 100644 packages/less/lib/less-browser/cache.js delete mode 100644 packages/less/lib/less-browser/cache.js.map delete mode 100644 packages/less/lib/less-browser/error-reporting.js delete mode 100644 packages/less/lib/less-browser/error-reporting.js.map delete mode 100644 packages/less/lib/less-browser/file-manager.js delete mode 100644 packages/less/lib/less-browser/file-manager.js.map delete mode 100644 packages/less/lib/less-browser/image-size.js delete mode 100644 packages/less/lib/less-browser/image-size.js.map delete mode 100644 packages/less/lib/less-browser/index.js delete mode 100644 packages/less/lib/less-browser/index.js.map delete mode 100644 packages/less/lib/less-browser/log-listener.js delete mode 100644 packages/less/lib/less-browser/log-listener.js.map delete mode 100644 packages/less/lib/less-browser/plugin-loader.js delete mode 100644 packages/less/lib/less-browser/plugin-loader.js.map delete mode 100644 packages/less/lib/less-browser/utils.js delete mode 100644 packages/less/lib/less-browser/utils.js.map delete mode 100644 packages/less/lib/less-node/environment.js delete mode 100644 packages/less/lib/less-node/environment.js.map delete mode 100644 packages/less/lib/less-node/file-manager.js delete mode 100644 packages/less/lib/less-node/file-manager.js.map delete mode 100644 packages/less/lib/less-node/fs.js delete mode 100644 packages/less/lib/less-node/fs.js.map delete mode 100644 packages/less/lib/less-node/image-size.js delete mode 100644 packages/less/lib/less-node/image-size.js.map delete mode 100644 packages/less/lib/less-node/index.js delete mode 100644 packages/less/lib/less-node/index.js.map delete mode 100644 packages/less/lib/less-node/lessc-helper.js delete mode 100644 packages/less/lib/less-node/lessc-helper.js.map delete mode 100644 packages/less/lib/less-node/plugin-loader.js delete mode 100644 packages/less/lib/less-node/plugin-loader.js.map delete mode 100644 packages/less/lib/less-node/url-file-manager.js delete mode 100644 packages/less/lib/less-node/url-file-manager.js.map delete mode 100644 packages/less/lib/less/constants.js delete mode 100644 packages/less/lib/less/constants.js.map delete mode 100644 packages/less/lib/less/contexts.js delete mode 100644 packages/less/lib/less/contexts.js.map delete mode 100644 packages/less/lib/less/data/colors.js delete mode 100644 packages/less/lib/less/data/colors.js.map delete mode 100644 packages/less/lib/less/data/index.js delete mode 100644 packages/less/lib/less/data/index.js.map delete mode 100644 packages/less/lib/less/data/unit-conversions.js delete mode 100644 packages/less/lib/less/data/unit-conversions.js.map delete mode 100644 packages/less/lib/less/default-options.js delete mode 100644 packages/less/lib/less/default-options.js.map delete mode 100644 packages/less/lib/less/environment/abstract-file-manager.js delete mode 100644 packages/less/lib/less/environment/abstract-file-manager.js.map delete mode 100644 packages/less/lib/less/environment/abstract-plugin-loader.js delete mode 100644 packages/less/lib/less/environment/abstract-plugin-loader.js.map delete mode 100644 packages/less/lib/less/environment/environment-api.js delete mode 100644 packages/less/lib/less/environment/environment-api.js.map delete mode 100644 packages/less/lib/less/environment/environment.js delete mode 100644 packages/less/lib/less/environment/environment.js.map delete mode 100644 packages/less/lib/less/environment/file-manager-api.js delete mode 100644 packages/less/lib/less/environment/file-manager-api.js.map delete mode 100644 packages/less/lib/less/functions/boolean.js delete mode 100644 packages/less/lib/less/functions/boolean.js.map delete mode 100644 packages/less/lib/less/functions/color-blending.js delete mode 100644 packages/less/lib/less/functions/color-blending.js.map delete mode 100644 packages/less/lib/less/functions/color.js delete mode 100644 packages/less/lib/less/functions/color.js.map delete mode 100644 packages/less/lib/less/functions/data-uri.js delete mode 100644 packages/less/lib/less/functions/data-uri.js.map delete mode 100644 packages/less/lib/less/functions/default.js delete mode 100644 packages/less/lib/less/functions/default.js.map delete mode 100644 packages/less/lib/less/functions/function-caller.js delete mode 100644 packages/less/lib/less/functions/function-caller.js.map delete mode 100644 packages/less/lib/less/functions/function-registry.js delete mode 100644 packages/less/lib/less/functions/function-registry.js.map delete mode 100644 packages/less/lib/less/functions/index.js delete mode 100644 packages/less/lib/less/functions/index.js.map delete mode 100644 packages/less/lib/less/functions/list.js delete mode 100644 packages/less/lib/less/functions/list.js.map delete mode 100644 packages/less/lib/less/functions/math-helper.js delete mode 100644 packages/less/lib/less/functions/math-helper.js.map delete mode 100644 packages/less/lib/less/functions/math.js delete mode 100644 packages/less/lib/less/functions/math.js.map delete mode 100644 packages/less/lib/less/functions/number.js delete mode 100644 packages/less/lib/less/functions/number.js.map delete mode 100644 packages/less/lib/less/functions/string.js delete mode 100644 packages/less/lib/less/functions/string.js.map delete mode 100644 packages/less/lib/less/functions/svg.js delete mode 100644 packages/less/lib/less/functions/svg.js.map delete mode 100644 packages/less/lib/less/functions/types.js delete mode 100644 packages/less/lib/less/functions/types.js.map delete mode 100644 packages/less/lib/less/import-manager.js delete mode 100644 packages/less/lib/less/import-manager.js.map delete mode 100644 packages/less/lib/less/index.js delete mode 100644 packages/less/lib/less/index.js.map delete mode 100644 packages/less/lib/less/less-error.js delete mode 100644 packages/less/lib/less/less-error.js.map delete mode 100644 packages/less/lib/less/logger.js delete mode 100644 packages/less/lib/less/logger.js.map delete mode 100644 packages/less/lib/less/parse-tree.js delete mode 100644 packages/less/lib/less/parse-tree.js.map delete mode 100644 packages/less/lib/less/parse.js delete mode 100644 packages/less/lib/less/parse.js.map delete mode 100644 packages/less/lib/less/parser/chunker.js delete mode 100644 packages/less/lib/less/parser/chunker.js.map delete mode 100644 packages/less/lib/less/parser/parser-input.js delete mode 100644 packages/less/lib/less/parser/parser-input.js.map delete mode 100644 packages/less/lib/less/parser/parser.js delete mode 100644 packages/less/lib/less/parser/parser.js.map delete mode 100644 packages/less/lib/less/plugin-manager.js delete mode 100644 packages/less/lib/less/plugin-manager.js.map delete mode 100644 packages/less/lib/less/render.js delete mode 100644 packages/less/lib/less/render.js.map delete mode 100644 packages/less/lib/less/source-map-builder.js delete mode 100644 packages/less/lib/less/source-map-builder.js.map delete mode 100644 packages/less/lib/less/source-map-output.js delete mode 100644 packages/less/lib/less/source-map-output.js.map delete mode 100644 packages/less/lib/less/transform-tree.js delete mode 100644 packages/less/lib/less/transform-tree.js.map delete mode 100644 packages/less/lib/less/tree/anonymous.js delete mode 100644 packages/less/lib/less/tree/anonymous.js.map delete mode 100644 packages/less/lib/less/tree/assignment.js delete mode 100644 packages/less/lib/less/tree/assignment.js.map delete mode 100644 packages/less/lib/less/tree/atrule.js delete mode 100644 packages/less/lib/less/tree/atrule.js.map delete mode 100644 packages/less/lib/less/tree/attribute.js delete mode 100644 packages/less/lib/less/tree/attribute.js.map delete mode 100644 packages/less/lib/less/tree/call.js delete mode 100644 packages/less/lib/less/tree/call.js.map delete mode 100644 packages/less/lib/less/tree/color.js delete mode 100644 packages/less/lib/less/tree/color.js.map delete mode 100644 packages/less/lib/less/tree/combinator.js delete mode 100644 packages/less/lib/less/tree/combinator.js.map delete mode 100644 packages/less/lib/less/tree/comment.js delete mode 100644 packages/less/lib/less/tree/comment.js.map delete mode 100644 packages/less/lib/less/tree/condition.js delete mode 100644 packages/less/lib/less/tree/condition.js.map delete mode 100644 packages/less/lib/less/tree/debug-info.js delete mode 100644 packages/less/lib/less/tree/debug-info.js.map delete mode 100644 packages/less/lib/less/tree/declaration.js delete mode 100644 packages/less/lib/less/tree/declaration.js.map delete mode 100644 packages/less/lib/less/tree/detached-ruleset.js delete mode 100644 packages/less/lib/less/tree/detached-ruleset.js.map delete mode 100644 packages/less/lib/less/tree/dimension.js delete mode 100644 packages/less/lib/less/tree/dimension.js.map delete mode 100644 packages/less/lib/less/tree/element.js delete mode 100644 packages/less/lib/less/tree/element.js.map delete mode 100644 packages/less/lib/less/tree/expression.js delete mode 100644 packages/less/lib/less/tree/expression.js.map delete mode 100644 packages/less/lib/less/tree/extend.js delete mode 100644 packages/less/lib/less/tree/extend.js.map delete mode 100644 packages/less/lib/less/tree/import.js delete mode 100644 packages/less/lib/less/tree/import.js.map delete mode 100644 packages/less/lib/less/tree/index.js delete mode 100644 packages/less/lib/less/tree/index.js.map delete mode 100644 packages/less/lib/less/tree/javascript.js delete mode 100644 packages/less/lib/less/tree/javascript.js.map delete mode 100644 packages/less/lib/less/tree/js-eval-node.js delete mode 100644 packages/less/lib/less/tree/js-eval-node.js.map delete mode 100644 packages/less/lib/less/tree/keyword.js delete mode 100644 packages/less/lib/less/tree/keyword.js.map delete mode 100644 packages/less/lib/less/tree/media.js delete mode 100644 packages/less/lib/less/tree/media.js.map delete mode 100644 packages/less/lib/less/tree/mixin-call.js delete mode 100644 packages/less/lib/less/tree/mixin-call.js.map delete mode 100644 packages/less/lib/less/tree/mixin-definition.js delete mode 100644 packages/less/lib/less/tree/mixin-definition.js.map delete mode 100644 packages/less/lib/less/tree/namespace-value.js delete mode 100644 packages/less/lib/less/tree/namespace-value.js.map delete mode 100644 packages/less/lib/less/tree/negative.js delete mode 100644 packages/less/lib/less/tree/negative.js.map delete mode 100644 packages/less/lib/less/tree/node.js delete mode 100644 packages/less/lib/less/tree/node.js.map delete mode 100644 packages/less/lib/less/tree/operation.js delete mode 100644 packages/less/lib/less/tree/operation.js.map delete mode 100644 packages/less/lib/less/tree/paren.js delete mode 100644 packages/less/lib/less/tree/paren.js.map delete mode 100644 packages/less/lib/less/tree/property.js delete mode 100644 packages/less/lib/less/tree/property.js.map delete mode 100644 packages/less/lib/less/tree/quoted.js delete mode 100644 packages/less/lib/less/tree/quoted.js.map delete mode 100644 packages/less/lib/less/tree/ruleset.js delete mode 100644 packages/less/lib/less/tree/ruleset.js.map delete mode 100644 packages/less/lib/less/tree/selector.js delete mode 100644 packages/less/lib/less/tree/selector.js.map delete mode 100644 packages/less/lib/less/tree/unicode-descriptor.js delete mode 100644 packages/less/lib/less/tree/unicode-descriptor.js.map delete mode 100644 packages/less/lib/less/tree/unit.js delete mode 100644 packages/less/lib/less/tree/unit.js.map delete mode 100644 packages/less/lib/less/tree/url.js delete mode 100644 packages/less/lib/less/tree/url.js.map delete mode 100644 packages/less/lib/less/tree/value.js delete mode 100644 packages/less/lib/less/tree/value.js.map delete mode 100644 packages/less/lib/less/tree/variable-call.js delete mode 100644 packages/less/lib/less/tree/variable-call.js.map delete mode 100644 packages/less/lib/less/tree/variable.js delete mode 100644 packages/less/lib/less/tree/variable.js.map delete mode 100644 packages/less/lib/less/utils.js delete mode 100644 packages/less/lib/less/utils.js.map delete mode 100644 packages/less/lib/less/visitors/extend-visitor.js delete mode 100644 packages/less/lib/less/visitors/extend-visitor.js.map delete mode 100644 packages/less/lib/less/visitors/import-sequencer.js delete mode 100644 packages/less/lib/less/visitors/import-sequencer.js.map delete mode 100644 packages/less/lib/less/visitors/import-visitor.js delete mode 100644 packages/less/lib/less/visitors/import-visitor.js.map delete mode 100644 packages/less/lib/less/visitors/index.js delete mode 100644 packages/less/lib/less/visitors/index.js.map delete mode 100644 packages/less/lib/less/visitors/join-selector-visitor.js delete mode 100644 packages/less/lib/less/visitors/join-selector-visitor.js.map delete mode 100644 packages/less/lib/less/visitors/set-tree-visibility-visitor.js delete mode 100644 packages/less/lib/less/visitors/set-tree-visibility-visitor.js.map delete mode 100644 packages/less/lib/less/visitors/to-css-visitor.js delete mode 100644 packages/less/lib/less/visitors/to-css-visitor.js.map delete mode 100644 packages/less/lib/less/visitors/visitor.js delete mode 100644 packages/less/lib/less/visitors/visitor.js.map diff --git a/packages/less/.gitignore b/packages/less/.gitignore index 28568df4d..831c902ed 100644 --- a/packages/less/.gitignore +++ b/packages/less/.gitignore @@ -1,5 +1,6 @@ # project-specific tmp +lib test/browser/less.min.js test/browser/less.min.js.map test/sourcemaps/**/*.map diff --git a/packages/less/.npmignore b/packages/less/.npmignore index c095c2a2e..59a8a15eb 100644 --- a/packages/less/.npmignore +++ b/packages/less/.npmignore @@ -1,10 +1,11 @@ .git .gitattributes .travis.yml +.grunt/ appveyor.yml build/ -.grunt/ benchmark/ +src/ test/ test/less-bom/ # re-include test files as they can be useful for plugins that do testing diff --git a/packages/less/Gruntfile.js b/packages/less/Gruntfile.js index 0b60b11c3..061ccda86 100644 --- a/packages/less/Gruntfile.js +++ b/packages/less/Gruntfile.js @@ -207,8 +207,12 @@ module.exports = function(grunt) { }, build: { command: [ + /** Browser runtime */ scriptRuntime + " build/rollup.js --dist", - "npm run copy:root" + /** Copy to repo root */ + "npm run copy:root", + /** Node.js runtime */ + "npm run build" ].join(" && ") }, testbuild: { diff --git a/packages/less/lib/less-browser/add-default-options.js b/packages/less/lib/less-browser/add-default-options.js deleted file mode 100644 index 5cf1ef64a..000000000 --- a/packages/less/lib/less-browser/add-default-options.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var utils_1 = require("./utils"); -var browser_1 = __importDefault(require("./browser")); -exports.default = (function (window, options) { - // use options from the current script tag data attribues - utils_1.addDataAttr(options, browser_1.default.currentScript(window)); - if (options.isFileProtocol === undefined) { - options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol); - } - // Load styles asynchronously (default: false) - // - // This is set to `false` by default, so that the body - // doesn't start loading before the stylesheets are parsed. - // Setting this to `true` can result in flickering. - // - options.async = options.async || false; - options.fileAsync = options.fileAsync || false; - // Interval between watch polls - options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500); - options.env = options.env || (window.location.hostname == '127.0.0.1' || - window.location.hostname == '0.0.0.0' || - window.location.hostname == 'localhost' || - (window.location.port && - window.location.port.length > 0) || - options.isFileProtocol ? 'development' - : 'production'); - var dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash); - if (dumpLineNumbers) { - options.dumpLineNumbers = dumpLineNumbers[1]; - } - if (options.useFileCache === undefined) { - options.useFileCache = true; - } - if (options.onReady === undefined) { - options.onReady = true; - } - if (options.relativeUrls) { - options.rewriteUrls = 'all'; - } -}); -//# sourceMappingURL=add-default-options.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/add-default-options.js.map b/packages/less/lib/less-browser/add-default-options.js.map deleted file mode 100644 index 1cafa8a33..000000000 --- a/packages/less/lib/less-browser/add-default-options.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"add-default-options.js","sourceRoot":"","sources":["../../src/less-browser/add-default-options.js"],"names":[],"mappings":";;;;;AAAA,iCAAoC;AACpC,sDAAgC;AAEhC,mBAAe,UAAC,MAAM,EAAE,OAAO;IAE3B,yDAAyD;IACzD,mBAAW,CAAC,OAAO,EAAE,iBAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpD,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE;QACtC,OAAO,CAAC,cAAc,GAAG,wDAAwD,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACpH;IAED,8CAA8C;IAC9C,EAAE;IACF,sDAAsD;IACtD,2DAA2D;IAC3D,mDAAmD;IACnD,EAAE;IACF,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;IACvC,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IAE/C,+BAA+B;IAC/B,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEtE,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,WAAW;QACjE,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,SAAS;QACrC,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,WAAW;QACvC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI;YACjB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACpC,OAAO,CAAC,cAAc,CAAmB,CAAC,CAAC,aAAa;QACxD,CAAC,CAAC,YAAY,CAAC,CAAC;IAEpB,IAAM,eAAe,GAAG,4CAA4C,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChG,IAAI,eAAe,EAAE;QACjB,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;KAChD;IAED,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE;QACpC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;KAC/B;IAED,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;QAC/B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;KAC1B;IAED,IAAI,OAAO,CAAC,YAAY,EAAE;QACtB,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;KAC/B;AACL,CAAC,EAAC","sourcesContent":["import {addDataAttr} from './utils';\nimport browser from './browser';\n\nexport default (window, options) => {\n\n // use options from the current script tag data attribues\n addDataAttr(options, browser.currentScript(window));\n\n if (options.isFileProtocol === undefined) {\n options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol);\n }\n\n // Load styles asynchronously (default: false)\n //\n // This is set to `false` by default, so that the body\n // doesn't start loading before the stylesheets are parsed.\n // Setting this to `true` can result in flickering.\n //\n options.async = options.async || false;\n options.fileAsync = options.fileAsync || false;\n\n // Interval between watch polls\n options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500);\n\n options.env = options.env || (window.location.hostname == '127.0.0.1' ||\n window.location.hostname == '0.0.0.0' ||\n window.location.hostname == 'localhost' ||\n (window.location.port &&\n window.location.port.length > 0) ||\n options.isFileProtocol ? 'development'\n : 'production');\n\n const dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash);\n if (dumpLineNumbers) {\n options.dumpLineNumbers = dumpLineNumbers[1];\n }\n\n if (options.useFileCache === undefined) {\n options.useFileCache = true;\n }\n\n if (options.onReady === undefined) {\n options.onReady = true;\n }\n\n if (options.relativeUrls) {\n options.rewriteUrls = 'all';\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/bootstrap.js b/packages/less/lib/less-browser/bootstrap.js deleted file mode 100644 index 700dde9de..000000000 --- a/packages/less/lib/less-browser/bootstrap.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; -/** - * Kicks off less and compiles any stylesheets - * used in the browser distributed version of less - * to kick-start less using the browser api - */ -/* global window, document */ -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var default_options_1 = __importDefault(require("../less/default-options")); -var add_default_options_1 = __importDefault(require("./add-default-options")); -var index_1 = __importDefault(require("./index")); -var options = default_options_1.default(); -if (window.less) { - for (var key in window.less) { - if (window.less.hasOwnProperty(key)) { - options[key] = window.less[key]; - } - } -} -add_default_options_1.default(window, options); -options.plugins = options.plugins || []; -if (window.LESS_PLUGINS) { - options.plugins = options.plugins.concat(window.LESS_PLUGINS); -} -var less = index_1.default(window, options); -exports.default = less; -window.less = less; -var css; -var head; -var style; -// Always restore page visibility -function resolveOrReject(data) { - if (data.filename) { - console.warn(data); - } - if (!options.async) { - head.removeChild(style); - } -} -if (options.onReady) { - if (/!watch/.test(window.location.hash)) { - less.watch(); - } - // Simulate synchronous stylesheet loading by hiding page rendering - if (!options.async) { - css = 'body { display: none !important }'; - head = document.head || document.getElementsByTagName('head')[0]; - style = document.createElement('style'); - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = css; - } - else { - style.appendChild(document.createTextNode(css)); - } - head.appendChild(style); - } - less.registerStylesheetsImmediately(); - less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); -} -//# sourceMappingURL=bootstrap.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/bootstrap.js.map b/packages/less/lib/less-browser/bootstrap.js.map deleted file mode 100644 index ff1af1f1e..000000000 --- a/packages/less/lib/less-browser/bootstrap.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/less-browser/bootstrap.js"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,6BAA6B;;;;;AAE7B,4EAAqD;AACrD,8EAAsD;AACtD,kDAA2B;AAE3B,IAAM,OAAO,GAAG,yBAAc,EAAE,CAAC;AAEjC,IAAI,MAAM,CAAC,IAAI,EAAE;IACb,KAAK,IAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE;QAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnC;KACJ;CACJ;AACD,6BAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;AAExC,IAAI,MAAM,CAAC,YAAY,EAAE;IACrB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;CACjE;AAED,IAAM,IAAI,GAAG,eAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACnC,kBAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;AAEnB,IAAI,GAAG,CAAC;AACR,IAAI,IAAI,CAAC;AACT,IAAI,KAAK,CAAC;AAEV,iCAAiC;AACjC,SAAS,eAAe,CAAC,IAAI;IACzB,IAAI,IAAI,CAAC,QAAQ,EAAE;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACtB;IACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAChB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC3B;AACL,CAAC;AAED,IAAI,OAAO,CAAC,OAAO,EAAE;IACjB,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACrC,IAAI,CAAC,KAAK,EAAE,CAAC;KAChB;IACD,mEAAmE;IACnE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAChB,GAAG,GAAG,mCAAmC,CAAC;QAC1C,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAExC,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;QACxB,IAAI,KAAK,CAAC,UAAU,EAAE;YAClB,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;SAClC;aAAM;YACH,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC3B;IACD,IAAI,CAAC,8BAA8B,EAAE,CAAC;IACtC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;CAC3G","sourcesContent":["/**\n * Kicks off less and compiles any stylesheets\n * used in the browser distributed version of less\n * to kick-start less using the browser api\n */\n/* global window, document */\n\nimport defaultOptions from '../less/default-options';\nimport addDefaultOptions from './add-default-options';\nimport root from './index';\n\nconst options = defaultOptions();\n\nif (window.less) {\n for (const key in window.less) {\n if (window.less.hasOwnProperty(key)) {\n options[key] = window.less[key];\n }\n }\n}\naddDefaultOptions(window, options);\n\noptions.plugins = options.plugins || [];\n\nif (window.LESS_PLUGINS) {\n options.plugins = options.plugins.concat(window.LESS_PLUGINS);\n}\n\nconst less = root(window, options);\nexport default less;\n\nwindow.less = less;\n\nlet css;\nlet head;\nlet style;\n\n// Always restore page visibility\nfunction resolveOrReject(data) {\n if (data.filename) {\n console.warn(data);\n }\n if (!options.async) {\n head.removeChild(style);\n }\n}\n\nif (options.onReady) {\n if (/!watch/.test(window.location.hash)) {\n less.watch();\n }\n // Simulate synchronous stylesheet loading by hiding page rendering\n if (!options.async) {\n css = 'body { display: none !important }';\n head = document.head || document.getElementsByTagName('head')[0];\n style = document.createElement('style');\n\n style.type = 'text/css';\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n\n head.appendChild(style);\n }\n less.registerStylesheetsImmediately();\n less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject);\n}\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/browser.js b/packages/less/lib/less-browser/browser.js deleted file mode 100644 index 907db7783..000000000 --- a/packages/less/lib/less-browser/browser.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var utils = __importStar(require("./utils")); -exports.default = { - createCSS: function (document, styles, sheet) { - // Strip the query-string - var href = sheet.href || ''; - // If there is no title set, use the filename, minus the extension - var id = "less:" + (sheet.title || utils.extractId(href)); - // If this has already been inserted into the DOM, we may need to replace it - var oldStyleNode = document.getElementById(id); - var keepOldStyleNode = false; - // Create a new stylesheet node for insertion or (if necessary) replacement - var styleNode = document.createElement('style'); - styleNode.setAttribute('type', 'text/css'); - if (sheet.media) { - styleNode.setAttribute('media', sheet.media); - } - styleNode.id = id; - if (!styleNode.styleSheet) { - styleNode.appendChild(document.createTextNode(styles)); - // If new contents match contents of oldStyleNode, don't replace oldStyleNode - keepOldStyleNode = (oldStyleNode !== null && oldStyleNode.childNodes.length > 0 && styleNode.childNodes.length > 0 && - oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue); - } - var head = document.getElementsByTagName('head')[0]; - // If there is no oldStyleNode, just append; otherwise, only append if we need - // to replace oldStyleNode with an updated stylesheet - if (oldStyleNode === null || keepOldStyleNode === false) { - var nextEl = sheet && sheet.nextSibling || null; - if (nextEl) { - nextEl.parentNode.insertBefore(styleNode, nextEl); - } - else { - head.appendChild(styleNode); - } - } - if (oldStyleNode && keepOldStyleNode === false) { - oldStyleNode.parentNode.removeChild(oldStyleNode); - } - // For IE. - // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash. - // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head - if (styleNode.styleSheet) { - try { - styleNode.styleSheet.cssText = styles; - } - catch (e) { - throw new Error('Couldn\'t reassign styleSheet.cssText.'); - } - } - }, - currentScript: function (window) { - var document = window.document; - return document.currentScript || (function () { - var scripts = document.getElementsByTagName('script'); - return scripts[scripts.length - 1]; - })(); - } -}; -//# sourceMappingURL=browser.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/browser.js.map b/packages/less/lib/less-browser/browser.js.map deleted file mode 100644 index 05e3f046e..000000000 --- a/packages/less/lib/less-browser/browser.js.map +++ /dev/null @@ -1 +0,0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AC,CAAC,CAAC,CAAC;QAEtD,8EAA8E;QAC9E,qDAAqD;QACrD,IAAI,YAAY,KAAK,IAAI,IAAI,gBAAgB,KAAK,KAAK,EAAE;YACrD,IAAM,MAAM,GAAG,KAAK,IAAI,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC;YAClD,IAAI,MAAM,EAAE;gBACR,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;aACrD;iBAAM;gBACH,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;aAC/B;SACJ;QACD,IAAI,YAAY,IAAI,gBAAgB,KAAK,KAAK,EAAE;YAC5C,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;SACrD;QAED,UAAU;QACV,sGAAsG;QACtG,mJAAmJ;QACnJ,IAAI,SAAS,CAAC,UAAU,EAAE;YACtB,IAAI;gBACA,SAAS,CAAC,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC;aACzC;YAAC,OAAO,CAAC,EAAE;gBACR,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;aAC7D;SACJ;IACL,CAAC;IACD,aAAa,EAAE,UAAS,MAAM;QAC1B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjC,OAAO,QAAQ,CAAC,aAAa,IAAI,CAAC;YAC9B,IAAM,OAAO,GAAG,QAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YACxD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;CACJ,CAAC","sourcesContent":["import * as utils from './utils';\n\nexport default {\n createCSS: function (document, styles, sheet) {\n // Strip the query-string\n const href = sheet.href || '';\n\n // If there is no title set, use the filename, minus the extension\n const id = `less:${sheet.title || utils.extractId(href)}`;\n\n // If this has already been inserted into the DOM, we may need to replace it\n const oldStyleNode = document.getElementById(id);\n let keepOldStyleNode = false;\n\n // Create a new stylesheet node for insertion or (if necessary) replacement\n const styleNode = document.createElement('style');\n styleNode.setAttribute('type', 'text/css');\n if (sheet.media) {\n styleNode.setAttribute('media', sheet.media);\n }\n styleNode.id = id;\n\n if (!styleNode.styleSheet) {\n styleNode.appendChild(document.createTextNode(styles));\n\n // If new contents match contents of oldStyleNode, don't replace oldStyleNode\n keepOldStyleNode = (oldStyleNode !== null && oldStyleNode.childNodes.length > 0 && styleNode.childNodes.length > 0 &&\n oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue);\n }\n\n const head = document.getElementsByTagName('head')[0];\n\n // If there is no oldStyleNode, just append; otherwise, only append if we need\n // to replace oldStyleNode with an updated stylesheet\n if (oldStyleNode === null || keepOldStyleNode === false) {\n const nextEl = sheet && sheet.nextSibling || null;\n if (nextEl) {\n nextEl.parentNode.insertBefore(styleNode, nextEl);\n } else {\n head.appendChild(styleNode);\n }\n }\n if (oldStyleNode && keepOldStyleNode === false) {\n oldStyleNode.parentNode.removeChild(oldStyleNode);\n }\n\n // For IE.\n // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash.\n // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head\n if (styleNode.styleSheet) {\n try {\n styleNode.styleSheet.cssText = styles;\n } catch (e) {\n throw new Error('Couldn\\'t reassign styleSheet.cssText.');\n }\n }\n },\n currentScript: function(window) {\n const document = window.document;\n return document.currentScript || (() => {\n const scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n })();\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/cache.js b/packages/less/lib/less-browser/cache.js deleted file mode 100644 index d849199ab..000000000 --- a/packages/less/lib/less-browser/cache.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -// Cache system is a bit outdated and could do with work -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = (function (window, options, logger) { - var cache = null; - if (options.env !== 'development') { - try { - cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage; - } - catch (_) { } - } - return { - setCSS: function (path, lastModified, modifyVars, styles) { - if (cache) { - logger.info("saving " + path + " to cache."); - try { - cache.setItem(path, styles); - cache.setItem(path + ":timestamp", lastModified); - if (modifyVars) { - cache.setItem(path + ":vars", JSON.stringify(modifyVars)); - } - } - catch (e) { - // TODO - could do with adding more robust error handling - logger.error("failed to save \"" + path + "\" to local storage for caching."); - } - } - }, - getCSS: function (path, webInfo, modifyVars) { - var css = cache && cache.getItem(path); - var timestamp = cache && cache.getItem(path + ":timestamp"); - var vars = cache && cache.getItem(path + ":vars"); - modifyVars = modifyVars || {}; - vars = vars || "{}"; // if not set, treat as the JSON representation of an empty object - if (timestamp && webInfo.lastModified && - (new Date(webInfo.lastModified).valueOf() === - new Date(timestamp).valueOf()) && - JSON.stringify(modifyVars) === vars) { - // Use local copy - return css; - } - } - }; -}); -//# sourceMappingURL=cache.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/cache.js.map b/packages/less/lib/less-browser/cache.js.map deleted file mode 100644 index 5a439dbb4..000000000 --- a/packages/less/lib/less-browser/cache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/less-browser/cache.js"],"names":[],"mappings":";AAAA,wDAAwD;;AAExD,mBAAe,UAAC,MAAM,EAAE,OAAO,EAAE,MAAM;IACnC,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,IAAI,OAAO,CAAC,GAAG,KAAK,aAAa,EAAE;QAC/B,IAAI;YACA,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;SACrF;QAAC,OAAO,CAAC,EAAE,GAAE;KACjB;IACD,OAAO;QACH,MAAM,EAAE,UAAS,IAAI,EAAE,YAAY,EAAE,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AAC,EAAC","sourcesContent":["// Cache system is a bit outdated and could do with work\n\nexport default (window, options, logger) => {\n let cache = null;\n if (options.env !== 'development') {\n try {\n cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage;\n } catch (_) {}\n }\n return {\n setCSS: function(path, lastModified, modifyVars, styles) {\n if (cache) {\n logger.info(`saving ${path} to cache.`);\n try {\n cache.setItem(path, styles);\n cache.setItem(`${path}:timestamp`, lastModified);\n if (modifyVars) {\n cache.setItem(`${path}:vars`, JSON.stringify(modifyVars));\n }\n } catch (e) {\n // TODO - could do with adding more robust error handling\n logger.error(`failed to save \"${path}\" to local storage for caching.`);\n }\n }\n },\n getCSS: function(path, webInfo, modifyVars) {\n const css = cache && cache.getItem(path);\n const timestamp = cache && cache.getItem(`${path}:timestamp`);\n let vars = cache && cache.getItem(`${path}:vars`);\n\n modifyVars = modifyVars || {};\n vars = vars || \"{}\"; // if not set, treat as the JSON representation of an empty object\n\n if (timestamp && webInfo.lastModified &&\n (new Date(webInfo.lastModified).valueOf() ===\n new Date(timestamp).valueOf()) &&\n JSON.stringify(modifyVars) === vars) {\n // Use local copy\n return css;\n }\n }\n };\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/error-reporting.js b/packages/less/lib/less-browser/error-reporting.js deleted file mode 100644 index 1e4d6b62c..000000000 --- a/packages/less/lib/less-browser/error-reporting.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var utils = __importStar(require("./utils")); -var browser_1 = __importDefault(require("./browser")); -exports.default = (function (window, less, options) { - function errorHTML(e, rootHref) { - var id = "less-error-message:" + utils.extractId(rootHref || ''); - var template = '
  • {content}
  • '; - var elem = window.document.createElement('div'); - var timer; - var content; - var errors = []; - var filename = e.filename || rootHref; - var filenameNoPath = filename.match(/([^\/]+(\?.*)?)$/)[1]; - elem.id = id; - elem.className = 'less-error-message'; - content = "

    " + (e.type || 'Syntax') + "Error: " + (e.message || 'There is an error in your .less file') + - ("

    in " + filenameNoPath + " "); - var errorline = function (e, i, classname) { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += "on line " + e.line + ", column " + (e.column + 1) + ":

    "; - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += "
    Stack Trace
    " + e.stack.split('\n').slice(1).join('
    '); - } - elem.innerHTML = content; - // CSS for error messages - browser_1.default.createCSS(window.document, [ - '.less-error-message ul, .less-error-message li {', - 'list-style-type: none;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'margin: 0;', - '}', - '.less-error-message label {', - 'font-size: 12px;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'color: #cc7777;', - '}', - '.less-error-message pre {', - 'color: #dd6666;', - 'padding: 4px 0;', - 'margin: 0;', - 'display: inline-block;', - '}', - '.less-error-message pre.line {', - 'color: #ff0000;', - '}', - '.less-error-message h3 {', - 'font-size: 20px;', - 'font-weight: bold;', - 'padding: 15px 0 5px 0;', - 'margin: 0;', - '}', - '.less-error-message a {', - 'color: #10a', - '}', - '.less-error-message .error {', - 'color: red;', - 'font-weight: bold;', - 'padding-bottom: 2px;', - 'border-bottom: 1px dashed red;', - '}' - ].join('\n'), { title: 'error-message' }); - elem.style.cssText = [ - 'font-family: Arial, sans-serif', - 'border: 1px solid #e00', - 'background-color: #eee', - 'border-radius: 5px', - '-webkit-border-radius: 5px', - '-moz-border-radius: 5px', - 'color: #e00', - 'padding: 15px', - 'margin-bottom: 15px' - ].join(';'); - if (options.env === 'development') { - timer = setInterval(function () { - var document = window.document; - var body = document.body; - if (body) { - if (document.getElementById(id)) { - body.replaceChild(elem, document.getElementById(id)); - } - else { - body.insertBefore(elem, body.firstChild); - } - clearInterval(timer); - } - }, 10); - } - } - function removeErrorHTML(path) { - var node = window.document.getElementById("less-error-message:" + utils.extractId(path)); - if (node) { - node.parentNode.removeChild(node); - } - } - function removeErrorConsole(path) { - // no action - } - function removeError(path) { - if (!options.errorReporting || options.errorReporting === 'html') { - removeErrorHTML(path); - } - else if (options.errorReporting === 'console') { - removeErrorConsole(path); - } - else if (typeof options.errorReporting === 'function') { - options.errorReporting('remove', path); - } - } - function errorConsole(e, rootHref) { - var template = '{line} {content}'; - var filename = e.filename || rootHref; - var errors = []; - var content = (e.type || 'Syntax') + "Error: " + (e.message || 'There is an error in your .less file') + " in " + filename; - var errorline = function (e, i, classname) { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += " on line " + e.line + ", column " + (e.column + 1) + ":\n" + errors.join('\n'); - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += "\nStack Trace\n" + e.stack; - } - less.logger.error(content); - } - function error(e, rootHref) { - if (!options.errorReporting || options.errorReporting === 'html') { - errorHTML(e, rootHref); - } - else if (options.errorReporting === 'console') { - errorConsole(e, rootHref); - } - else if (typeof options.errorReporting === 'function') { - options.errorReporting('add', e, rootHref); - } - } - return { - add: error, - remove: removeError - }; -}); -//# sourceMappingURL=error-reporting.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/error-reporting.js.map b/packages/less/lib/less-browser/error-reporting.js.map deleted file mode 100644 index 9b96cd1e6..000000000 --- a/packages/less/lib/less-browser/error-reporting.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error-reporting.js","sourceRoot":"","sources":["../../src/less-browser/error-reporting.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiC;AACjC,sDAAgC;AAEhC,mBAAe,UAAC,MAAM,EAAE,IAAI,EAAE,OAAO;IAEjC,SAAS,SAAS,CAAC,CAAC,EAAE,QAAQ;QAC1B,IAAM,EAAE,GAAG,wBAAsB,KAAK,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAG,CAAC;QACnE,IAAM,QAAQ,GAAG,oEAAoE,CAAC;QACtF,IAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,KAAK,CAAC;QACV,IAAI,OAAO,CAAC;QACZ,IAAM,MAAM,GAAG,EAAE,CAAC;QAClB,IAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC;QACxC,IAAM,cAAc,GAAG,QAAQ,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE7D,IAAI,CAAC,EAAE,GAAU,EAAE,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,oBAAoB,CAAC;QAEtC,OAAO,GAAG,UAAO,CAAC,CAAC,IAAI,IAAI,QAAQ,iBAAU,CAAC,CAAC,OAAO,IAAI,sCAAsC,CAAE;aAC9F,0BAAuB,QAAQ,WAAK,cAAc,UAAO,CAAA,CAAC;QAE9D,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,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;SAC9C;IACL,CAAC;IAED,OAAO;QACH,GAAG,EAAE,KAAK;QACV,MAAM,EAAE,WAAW;KACtB,CAAC;AACN,CAAC,EAAC","sourcesContent":["import * as utils from './utils';\nimport browser from './browser';\n\nexport default (window, less, options) => {\n\n function errorHTML(e, rootHref) {\n const id = `less-error-message:${utils.extractId(rootHref || '')}`;\n const template = '
  • {content}
  • ';\n const elem = window.document.createElement('div');\n let timer;\n let content;\n const errors = [];\n const filename = e.filename || rootHref;\n const filenameNoPath = filename.match(/([^\\/]+(\\?.*)?)$/)[1];\n\n elem.id = id;\n elem.className = 'less-error-message';\n\n content = `

    ${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'}` + \n `

    in ${filenameNoPath} `;\n\n const errorline = (e, i, classname) => {\n if (e.extract[i] !== undefined) {\n errors.push(template.replace(/\\{line\\}/, (parseInt(e.line, 10) || 0) + (i - 1))\n .replace(/\\{class\\}/, classname)\n .replace(/\\{content\\}/, e.extract[i]));\n }\n };\n\n if (e.line) {\n errorline(e, 0, '');\n errorline(e, 1, 'line');\n errorline(e, 2, '');\n content += `on line ${e.line}, column ${e.column + 1}:

    `;\n }\n if (e.stack && (e.extract || options.logLevel >= 4)) {\n content += `
    Stack Trace
    ${e.stack.split('\\n').slice(1).join('
    ')}`;\n }\n elem.innerHTML = content;\n\n // CSS for error messages\n browser.createCSS(window.document, [\n '.less-error-message ul, .less-error-message li {',\n 'list-style-type: none;',\n 'margin-right: 15px;',\n 'padding: 4px 0;',\n 'margin: 0;',\n '}',\n '.less-error-message label {',\n 'font-size: 12px;',\n 'margin-right: 15px;',\n 'padding: 4px 0;',\n 'color: #cc7777;',\n '}',\n '.less-error-message pre {',\n 'color: #dd6666;',\n 'padding: 4px 0;',\n 'margin: 0;',\n 'display: inline-block;',\n '}',\n '.less-error-message pre.line {',\n 'color: #ff0000;',\n '}',\n '.less-error-message h3 {',\n 'font-size: 20px;',\n 'font-weight: bold;',\n 'padding: 15px 0 5px 0;',\n 'margin: 0;',\n '}',\n '.less-error-message a {',\n 'color: #10a',\n '}',\n '.less-error-message .error {',\n 'color: red;',\n 'font-weight: bold;',\n 'padding-bottom: 2px;',\n 'border-bottom: 1px dashed red;',\n '}'\n ].join('\\n'), { title: 'error-message' });\n\n elem.style.cssText = [\n 'font-family: Arial, sans-serif',\n 'border: 1px solid #e00',\n 'background-color: #eee',\n 'border-radius: 5px',\n '-webkit-border-radius: 5px',\n '-moz-border-radius: 5px',\n 'color: #e00',\n 'padding: 15px',\n 'margin-bottom: 15px'\n ].join(';');\n\n if (options.env === 'development') {\n timer = setInterval(() => {\n const document = window.document;\n const body = document.body;\n if (body) {\n if (document.getElementById(id)) {\n body.replaceChild(elem, document.getElementById(id));\n } else {\n body.insertBefore(elem, body.firstChild);\n }\n clearInterval(timer);\n }\n }, 10);\n }\n }\n\n function removeErrorHTML(path) {\n const node = window.document.getElementById(`less-error-message:${utils.extractId(path)}`);\n if (node) {\n node.parentNode.removeChild(node);\n }\n }\n\n function removeErrorConsole(path) {\n // no action\n }\n\n function removeError(path) {\n if (!options.errorReporting || options.errorReporting === 'html') {\n removeErrorHTML(path);\n } else if (options.errorReporting === 'console') {\n removeErrorConsole(path);\n } else if (typeof options.errorReporting === 'function') {\n options.errorReporting('remove', path);\n }\n }\n\n function errorConsole(e, rootHref) {\n const template = '{line} {content}';\n const filename = e.filename || rootHref;\n const errors = [];\n let content = `${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'} in ${filename}`;\n\n const errorline = (e, i, classname) => {\n if (e.extract[i] !== undefined) {\n errors.push(template.replace(/\\{line\\}/, (parseInt(e.line, 10) || 0) + (i - 1))\n .replace(/\\{class\\}/, classname)\n .replace(/\\{content\\}/, e.extract[i]));\n }\n };\n\n if (e.line) {\n errorline(e, 0, '');\n errorline(e, 1, 'line');\n errorline(e, 2, '');\n content += ` on line ${e.line}, column ${e.column + 1}:\\n${errors.join('\\n')}`;\n }\n if (e.stack && (e.extract || options.logLevel >= 4)) {\n content += `\\nStack Trace\\n${e.stack}`;\n }\n less.logger.error(content);\n }\n\n function error(e, rootHref) {\n if (!options.errorReporting || options.errorReporting === 'html') {\n errorHTML(e, rootHref);\n } else if (options.errorReporting === 'console') {\n errorConsole(e, rootHref);\n } else if (typeof options.errorReporting === 'function') {\n options.errorReporting('add', e, rootHref);\n }\n }\n\n return {\n add: error,\n remove: removeError\n };\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/file-manager.js b/packages/less/lib/less-browser/file-manager.js deleted file mode 100644 index 75da91c8b..000000000 --- a/packages/less/lib/less-browser/file-manager.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -/* global window, XMLHttpRequest */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var abstract_file_manager_js_1 = __importDefault(require("../less/environment/abstract-file-manager.js")); -var options; -var logger; -var fileCache = {}; -// TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load -var FileManager = /** @class */ (function (_super) { - __extends(FileManager, _super); - function FileManager() { - return _super !== null && _super.apply(this, arguments) || this; - } - FileManager.prototype.alwaysMakePathsAbsolute = function () { - return true; - }; - FileManager.prototype.join = function (basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return this.extractUrlParts(laterPath, basePath).path; - }; - FileManager.prototype.doXHR = function (url, type, callback, errback) { - var xhr = new XMLHttpRequest(); - var async = options.isFileProtocol ? options.fileAsync : true; - if (typeof xhr.overrideMimeType === 'function') { - xhr.overrideMimeType('text/css'); - } - logger.debug("XHR: Getting '" + url + "'"); - xhr.open('GET', url, async); - xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5'); - xhr.send(null); - function handleResponse(xhr, callback, errback) { - if (xhr.status >= 200 && xhr.status < 300) { - callback(xhr.responseText, xhr.getResponseHeader('Last-Modified')); - } - else if (typeof errback === 'function') { - errback(xhr.status, url); - } - } - if (options.isFileProtocol && !options.fileAsync) { - if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) { - callback(xhr.responseText); - } - else { - errback(xhr.status, url); - } - } - else if (async) { - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - handleResponse(xhr, callback, errback); - } - }; - } - else { - handleResponse(xhr, callback, errback); - } - }; - FileManager.prototype.supports = function () { - return true; - }; - FileManager.prototype.clearFileCache = function () { - fileCache = {}; - }; - FileManager.prototype.loadFile = function (filename, currentDirectory, options, environment) { - // TODO: Add prefix support like less-node? - // What about multiple paths? - if (currentDirectory && !this.isPathAbsolute(filename)) { - filename = currentDirectory + filename; - } - filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename; - options = options || {}; - // sheet may be set to the stylesheet for the initial load or a collection of properties including - // some context variables for imports - var hrefParts = this.extractUrlParts(filename, window.location.href); - var href = hrefParts.url; - var self = this; - return new Promise(function (resolve, reject) { - if (options.useFileCache && fileCache[href]) { - try { - var lessText = fileCache[href]; - return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() } }); - } - catch (e) { - return reject({ filename: href, message: "Error loading file " + href + " error was " + e.message }); - } - } - self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { - // per file cache - fileCache[href] = data; - // Use remote copy (re-parse) - resolve({ contents: data, filename: href, webInfo: { lastModified: lastModified } }); - }, function doXHRError(status, url) { - reject({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href }); - }); - }); - }; - return FileManager; -}(abstract_file_manager_js_1.default)); -exports.default = (function (opts, log) { - options = opts; - logger = log; - return FileManager; -}); -//# sourceMappingURL=file-manager.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/file-manager.js.map b/packages/less/lib/less-browser/file-manager.js.map deleted file mode 100644 index 5eb17a1e3..000000000 --- a/packages/less/lib/less-browser/file-manager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"file-manager.js","sourceRoot":"","sources":["../../src/less-browser/file-manager.js"],"names":[],"mappings":";AAAA,mCAAmC;;;;;;;;;;;;;;;;;;AAEnC,0GAA+E;AAE/E,IAAI,OAAO,CAAC;AACZ,IAAI,MAAM,CAAC;AACX,IAAI,SAAS,GAAG,EAAE,CAAC;AAEnB,wIAAwI;AACxI;IAA0B,+BAAmB;IAA7C;;IAiGA,CAAC;IAhGG,6CAAuB,GAAvB;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,0BAAI,GAAJ,UAAK,QAAQ,EAAE,SAAS;QACpB,IAAI,CAAC,QAAQ,EAAE;YACX,OAAO,SAAS,CAAC;SACpB;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC;IAC1D,CAAC;IAED,2BAAK,GAAL,UAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO;QAC9B,IAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,IAAM,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QAEhE,IAAI,OAAO,GAAG,CAAC,gBAAgB,KAAK,UAAU,EAAE;YAC5C,GAAG,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;SACpC;QACD,MAAM,CAAC,KAAK,CAAC,mBAAiB,GAAG,MAAG,CAAC,CAAC;QACtC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CA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AAS,aAAa,CAAC,IAAI,EAAE,YAAY;gBACpE,iBAAiB;gBACjB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;gBAEvB,6BAA6B;gBAC7B,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,YAAY,cAAA,EAAE,EAAC,CAAC,CAAC;YAC1E,CAAC,EAAE,SAAS,UAAU,CAAC,MAAM,EAAE,GAAG;gBAC9B,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAI,GAAG,wBAAmB,MAAM,MAAG,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACL,kBAAC;AAAD,CAAC,AAjGD,CAA0B,kCAAmB,GAiG5C;AAED,mBAAe,UAAC,IAAI,EAAE,GAAG;IACrB,OAAO,GAAG,IAAI,CAAC;IACf,MAAM,GAAG,GAAG,CAAC;IACb,OAAO,WAAW,CAAC;AACvB,CAAC,EAAA","sourcesContent":["/* global window, XMLHttpRequest */\n\nimport AbstractFileManager from '../less/environment/abstract-file-manager.js';\n\nlet options;\nlet logger;\nlet fileCache = {};\n\n// TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load\nclass FileManager extends AbstractFileManager {\n alwaysMakePathsAbsolute() {\n return true;\n }\n\n join(basePath, laterPath) {\n if (!basePath) {\n return laterPath;\n }\n return this.extractUrlParts(laterPath, basePath).path;\n }\n\n doXHR(url, type, callback, errback) {\n const xhr = new XMLHttpRequest();\n const async = options.isFileProtocol ? options.fileAsync : true;\n\n if (typeof xhr.overrideMimeType === 'function') {\n xhr.overrideMimeType('text/css');\n }\n logger.debug(`XHR: Getting '${url}'`);\n xhr.open('GET', url, async);\n xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5');\n xhr.send(null);\n\n function handleResponse(xhr, callback, errback) {\n if (xhr.status >= 200 && xhr.status < 300) {\n callback(xhr.responseText,\n xhr.getResponseHeader('Last-Modified'));\n } else if (typeof errback === 'function') {\n errback(xhr.status, url);\n }\n }\n\n if (options.isFileProtocol && !options.fileAsync) {\n if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {\n callback(xhr.responseText);\n } else {\n errback(xhr.status, url);\n }\n } else if (async) {\n xhr.onreadystatechange = () => {\n if (xhr.readyState == 4) {\n handleResponse(xhr, callback, errback);\n }\n };\n } else {\n handleResponse(xhr, callback, errback);\n }\n }\n\n supports() {\n return true;\n }\n\n clearFileCache() {\n fileCache = {};\n }\n\n loadFile(filename, currentDirectory, options, environment) {\n // TODO: Add prefix support like less-node?\n // What about multiple paths?\n\n if (currentDirectory && !this.isPathAbsolute(filename)) {\n filename = currentDirectory + filename;\n }\n\n filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename;\n\n options = options || {};\n\n // sheet may be set to the stylesheet for the initial load or a collection of properties including\n // some context variables for imports\n const hrefParts = this.extractUrlParts(filename, window.location.href);\n const href = hrefParts.url;\n const self = this;\n \n return new Promise((resolve, reject) => {\n if (options.useFileCache && fileCache[href]) {\n try {\n const lessText = fileCache[href];\n return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() }});\n } catch (e) {\n return reject({ filename: href, message: `Error loading file ${href} error was ${e.message}` });\n }\n }\n\n self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) {\n // per file cache\n fileCache[href] = data;\n\n // Use remote copy (re-parse)\n resolve({ contents: data, filename: href, webInfo: { lastModified }});\n }, function doXHRError(status, url) {\n reject({ type: 'File', message: `'${url}' wasn't found (${status})`, href });\n });\n });\n }\n}\n\nexport default (opts, log) => {\n options = opts;\n logger = log;\n return FileManager;\n}\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/image-size.js b/packages/less/lib/less-browser/image-size.js deleted file mode 100644 index aeebb8471..000000000 --- a/packages/less/lib/less-browser/image-size.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var function_registry_1 = __importDefault(require("./../less/functions/function-registry")); -exports.default = (function () { - function imageSize() { - throw { - type: 'Runtime', - message: 'Image size functions are not supported in browser version of less' - }; - } - var imageFunctions = { - 'image-size': function (filePathNode) { - imageSize(this, filePathNode); - return -1; - }, - 'image-width': function (filePathNode) { - imageSize(this, filePathNode); - return -1; - }, - 'image-height': function (filePathNode) { - imageSize(this, filePathNode); - return -1; - } - }; - function_registry_1.default.addMultiple(imageFunctions); -}); -//# sourceMappingURL=image-size.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/image-size.js.map b/packages/less/lib/less-browser/image-size.js.map deleted file mode 100644 index b69edd4cb..000000000 --- a/packages/less/lib/less-browser/image-size.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image-size.js","sourceRoot":"","sources":["../../src/less-browser/image-size.js"],"names":[],"mappings":";;;;;AACA,4FAAqE;AAErE,mBAAe;IACX,SAAS,SAAS;QACd,MAAM;YACF,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,mEAAmE;SAC/E,CAAC;IACN,CAAC;IAED,IAAM,cAAc,GAAG;QACnB,YAAY,EAAE,UAAS,YAAY;YAC/B,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC,CAAC;QACd,CAAC;QACD,aAAa,EAAE,UAAS,YAAY;YAChC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC,CAAC;QACd,CAAC;QACD,cAAc,EAAE,UAAS,YAAY;YACjC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC,CAAC;QACd,CAAC;KACJ,CAAC;IAEF,2BAAgB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC,EAAC","sourcesContent":["\nimport functionRegistry from './../less/functions/function-registry';\n\nexport default () => {\n function imageSize() {\n throw {\n type: 'Runtime',\n message: 'Image size functions are not supported in browser version of less'\n };\n }\n\n const imageFunctions = {\n 'image-size': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n },\n 'image-width': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n },\n 'image-height': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n }\n };\n\n functionRegistry.addMultiple(imageFunctions);\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/index.js b/packages/less/lib/less-browser/index.js deleted file mode 100644 index 273bb9bea..000000000 --- a/packages/less/lib/less-browser/index.js +++ /dev/null @@ -1,256 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -// -// index.js -// Should expose the additional browser functions on to the less object -// -var utils_1 = require("./utils"); -var less_1 = __importDefault(require("../less")); -var browser_1 = __importDefault(require("./browser")); -var file_manager_1 = __importDefault(require("./file-manager")); -var plugin_loader_1 = __importDefault(require("./plugin-loader")); -var log_listener_1 = __importDefault(require("./log-listener")); -var error_reporting_1 = __importDefault(require("./error-reporting")); -var cache_1 = __importDefault(require("./cache")); -var image_size_1 = __importDefault(require("./image-size")); -exports.default = (function (window, options) { - var document = window.document; - var less = less_1.default(); - less.options = options; - var environment = less.environment; - var FileManager = file_manager_1.default(options, less.logger); - var fileManager = new FileManager(); - environment.addFileManager(fileManager); - less.FileManager = FileManager; - less.PluginLoader = plugin_loader_1.default; - log_listener_1.default(less, options); - var errors = error_reporting_1.default(window, less, options); - var cache = less.cache = options.cache || cache_1.default(window, options, less.logger); - image_size_1.default(less.environment); - // Setup user functions - Deprecate? - if (options.functions) { - less.functions.functionRegistry.addMultiple(options.functions); - } - var typePattern = /^text\/(x-)?less$/; - function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; - } - // only really needed for phantom - function bind(func, thisArg) { - var curryArgs = Array.prototype.slice.call(arguments, 2); - return function () { - var args = curryArgs.concat(Array.prototype.slice.call(arguments, 0)); - return func.apply(thisArg, args); - }; - } - function loadStyles(modifyVars) { - var styles = document.getElementsByTagName('style'); - var style; - for (var i = 0; i < styles.length; i++) { - style = styles[i]; - if (style.type.match(typePattern)) { - var instanceOptions = clone(options); - instanceOptions.modifyVars = modifyVars; - var lessText = style.innerHTML || ''; - instanceOptions.filename = document.location.href.replace(/#.*$/, ''); - /* jshint loopfunc:true */ - // use closure to store current style - less.render(lessText, instanceOptions, bind(function (style, e, result) { - if (e) { - errors.add(e, 'inline'); - } - else { - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = result.css; - } - else { - style.innerHTML = result.css; - } - } - }, null, style)); - } - } - } - function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) { - var instanceOptions = clone(options); - utils_1.addDataAttr(instanceOptions, sheet); - instanceOptions.mime = sheet.type; - if (modifyVars) { - instanceOptions.modifyVars = modifyVars; - } - function loadInitialFileCallback(loadedFile) { - var data = loadedFile.contents; - var path = loadedFile.filename; - var webInfo = loadedFile.webInfo; - var newFileInfo = { - currentDirectory: fileManager.getPath(path), - filename: path, - rootFilename: path, - rewriteUrls: instanceOptions.rewriteUrls - }; - newFileInfo.entryPath = newFileInfo.currentDirectory; - newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory; - if (webInfo) { - webInfo.remaining = remaining; - var css = cache.getCSS(path, webInfo, instanceOptions.modifyVars); - if (!reload && css) { - webInfo.local = true; - callback(null, css, data, sheet, webInfo, path); - return; - } - } - // TODO add tests around how this behaves when reloading - errors.remove(path); - instanceOptions.rootFileInfo = newFileInfo; - less.render(data, instanceOptions, function (e, result) { - if (e) { - e.href = path; - callback(e); - } - else { - cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css); - callback(null, result.css, data, sheet, webInfo, path); - } - }); - } - fileManager.loadFile(sheet.href, null, instanceOptions, environment) - .then(function (loadedFile) { - loadInitialFileCallback(loadedFile); - }).catch(function (err) { - console.log(err); - callback(err); - }); - } - function loadStyleSheets(callback, reload, modifyVars) { - for (var i = 0; i < less.sheets.length; i++) { - loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1), modifyVars); - } - } - function initRunningMode() { - if (less.env === 'development') { - less.watchTimer = setInterval(function () { - if (less.watchMode) { - fileManager.clearFileCache(); - loadStyleSheets(function (e, css, _, sheet, webInfo) { - if (e) { - errors.add(e, e.href || sheet.href); - } - else if (css) { - browser_1.default.createCSS(window.document, css, sheet); - } - }); - } - }, options.poll); - } - } - // - // Watch mode - // - less.watch = function () { - if (!less.watchMode) { - less.env = 'development'; - initRunningMode(); - } - this.watchMode = true; - return true; - }; - less.unwatch = function () { clearInterval(less.watchTimer); this.watchMode = false; return false; }; - // - // Synchronously get all tags with the 'rel' attribute set to - // "stylesheet/less". - // - less.registerStylesheetsImmediately = function () { - var links = document.getElementsByTagName('link'); - less.sheets = []; - for (var i = 0; i < links.length; i++) { - if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) && - (links[i].type.match(typePattern)))) { - less.sheets.push(links[i]); - } - } - }; - // - // Asynchronously get all tags with the 'rel' attribute set to - // "stylesheet/less", returning a Promise. - // - less.registerStylesheets = function () { return new Promise(function (resolve, reject) { - less.registerStylesheetsImmediately(); - resolve(); - }); }; - // - // With this function, it's possible to alter variables and re-render - // CSS without reloading less-files - // - less.modifyVars = function (record) { return less.refresh(true, record, false); }; - less.refresh = function (reload, modifyVars, clearFileCache) { - if ((reload || clearFileCache) && clearFileCache !== false) { - fileManager.clearFileCache(); - } - return new Promise(function (resolve, reject) { - var startTime; - var endTime; - var totalMilliseconds; - var remainingSheets; - startTime = endTime = new Date(); - // Set counter for remaining unprocessed sheets - remainingSheets = less.sheets.length; - if (remainingSheets === 0) { - endTime = new Date(); - totalMilliseconds = endTime - startTime; - less.logger.info('Less has finished and no sheets were loaded.'); - resolve({ - startTime: startTime, - endTime: endTime, - totalMilliseconds: totalMilliseconds, - sheets: less.sheets.length - }); - } - else { - // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array - loadStyleSheets(function (e, css, _, sheet, webInfo) { - if (e) { - errors.add(e, e.href || sheet.href); - reject(e); - return; - } - if (webInfo.local) { - less.logger.info("Loading " + sheet.href + " from cache."); - } - else { - less.logger.info("Rendered " + sheet.href + " successfully."); - } - browser_1.default.createCSS(window.document, css, sheet); - less.logger.info("CSS for " + sheet.href + " generated in " + (new Date() - endTime) + "ms"); - // Count completed sheet - remainingSheets--; - // Check if the last remaining sheet was processed and then call the promise - if (remainingSheets === 0) { - totalMilliseconds = new Date() - startTime; - less.logger.info("Less has finished. CSS generated in " + totalMilliseconds + "ms"); - resolve({ - startTime: startTime, - endTime: endTime, - totalMilliseconds: totalMilliseconds, - sheets: less.sheets.length - }); - } - endTime = new Date(); - }, reload, modifyVars); - } - loadStyles(modifyVars); - }); - }; - less.refreshStyles = loadStyles; - return less; -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/index.js.map b/packages/less/lib/less-browser/index.js.map deleted file mode 100644 index f470f2446..000000000 --- a/packages/less/lib/less-browser/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/less-browser/index.js"],"names":[],"mappings":";;;;;AAAA,EAAE;AACF,WAAW;AACX,uEAAuE;AACvE,EAAE;AACF,iCAAoC;AACpC,iDAA+B;AAC/B,sDAAgC;AAChC,gEAAgC;AAChC,kEAA2C;AAC3C,gEAAyC;AACzC,sEAA+C;AAC/C,kDAA4B;AAC5B,4DAAqC;AAErC,mBAAe,UAAC,MAAM,EAAE,OAAO;IAC3B,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,I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AC,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;oBAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAW,KAAK,CAAC,IAAI,uBAAiB,IAAI,IAAI,EAAE,GAAG,OAAO,QAAI,CAAC,CAAC;oBAEjF,wBAAwB;oBACxB,eAAe,EAAE,CAAC;oBAElB,4EAA4E;oBAC5E,IAAI,eAAe,KAAK,CAAC,EAAE;wBACvB,iBAAiB,GAAG,IAAI,IAAI,EAAE,GAAG,SAAS,CAAC;wBAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yCAAuC,iBAAiB,OAAI,CAAC,CAAC;wBAC/E,OAAO,CAAC;4BACJ,SAAS,WAAA;4BACT,OAAO,SAAA;4BACP,iBAAiB,mBAAA;4BACjB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;yBAC7B,CAAC,CAAC;qBACN;oBACD,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;gBACzB,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;aAC1B;YAED,UAAU,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC;IAChC,OAAO,IAAI,CAAC;AAChB,CAAC,EAAC","sourcesContent":["//\n// index.js\n// Should expose the additional browser functions on to the less object\n//\nimport {addDataAttr} from './utils';\nimport lessRoot from '../less';\nimport browser from './browser';\nimport FM from './file-manager';\nimport PluginLoader from './plugin-loader';\nimport LogListener from './log-listener';\nimport ErrorReporting from './error-reporting';\nimport Cache from './cache';\nimport ImageSize from './image-size';\n\nexport default (window, options) => {\n const document = window.document;\n const less = lessRoot();\n\n less.options = options;\n const environment = less.environment;\n const FileManager = FM(options, less.logger);\n const fileManager = new FileManager();\n environment.addFileManager(fileManager);\n less.FileManager = FileManager;\n less.PluginLoader = PluginLoader;\n\n LogListener(less, options);\n const errors = ErrorReporting(window, less, options);\n const cache = less.cache = options.cache || Cache(window, options, less.logger);\n ImageSize(less.environment);\n\n // Setup user functions - Deprecate?\n if (options.functions) {\n less.functions.functionRegistry.addMultiple(options.functions);\n }\n\n const typePattern = /^text\\/(x-)?less$/;\n\n function clone(obj) {\n const cloned = {};\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n cloned[prop] = obj[prop];\n }\n }\n return cloned;\n }\n\n // only really needed for phantom\n function bind(func, thisArg) {\n const curryArgs = Array.prototype.slice.call(arguments, 2);\n return function() {\n const args = curryArgs.concat(Array.prototype.slice.call(arguments, 0));\n return func.apply(thisArg, args);\n };\n }\n\n function loadStyles(modifyVars) {\n const styles = document.getElementsByTagName('style');\n let style;\n\n for (let i = 0; i < styles.length; i++) {\n style = styles[i];\n if (style.type.match(typePattern)) {\n const instanceOptions = clone(options);\n instanceOptions.modifyVars = modifyVars;\n const lessText = style.innerHTML || '';\n instanceOptions.filename = document.location.href.replace(/#.*$/, '');\n\n /* jshint loopfunc:true */\n // use closure to store current style\n less.render(lessText, instanceOptions,\n bind((style, e, result) => {\n if (e) {\n errors.add(e, 'inline');\n } else {\n style.type = 'text/css';\n if (style.styleSheet) {\n style.styleSheet.cssText = result.css;\n } else {\n style.innerHTML = result.css;\n }\n }\n }, null, style));\n }\n }\n }\n\n function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) {\n\n const instanceOptions = clone(options);\n addDataAttr(instanceOptions, sheet);\n instanceOptions.mime = sheet.type;\n\n if (modifyVars) {\n instanceOptions.modifyVars = modifyVars;\n }\n\n function loadInitialFileCallback(loadedFile) {\n const data = loadedFile.contents;\n const path = loadedFile.filename;\n const webInfo = loadedFile.webInfo;\n\n const newFileInfo = {\n currentDirectory: fileManager.getPath(path),\n filename: path,\n rootFilename: path,\n rewriteUrls: instanceOptions.rewriteUrls\n };\n\n newFileInfo.entryPath = newFileInfo.currentDirectory;\n newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory;\n\n if (webInfo) {\n webInfo.remaining = remaining;\n\n const css = cache.getCSS(path, webInfo, instanceOptions.modifyVars);\n if (!reload && css) {\n webInfo.local = true;\n callback(null, css, data, sheet, webInfo, path);\n return;\n }\n\n }\n\n // TODO add tests around how this behaves when reloading\n errors.remove(path);\n\n instanceOptions.rootFileInfo = newFileInfo;\n less.render(data, instanceOptions, (e, result) => {\n if (e) {\n e.href = path;\n callback(e);\n } else {\n cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css);\n callback(null, result.css, data, sheet, webInfo, path);\n }\n });\n }\n\n fileManager.loadFile(sheet.href, null, instanceOptions, environment)\n .then(loadedFile => {\n loadInitialFileCallback(loadedFile);\n }).catch(err => {\n console.log(err);\n callback(err);\n });\n\n }\n\n function loadStyleSheets(callback, reload, modifyVars) {\n for (let i = 0; i < less.sheets.length; i++) {\n loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1), modifyVars);\n }\n }\n\n function initRunningMode() {\n if (less.env === 'development') {\n less.watchTimer = setInterval(() => {\n if (less.watchMode) {\n fileManager.clearFileCache();\n loadStyleSheets((e, css, _, sheet, webInfo) => {\n if (e) {\n errors.add(e, e.href || sheet.href);\n } else if (css) {\n browser.createCSS(window.document, css, sheet);\n }\n });\n }\n }, options.poll);\n }\n }\n\n //\n // Watch mode\n //\n less.watch = function () {\n if (!less.watchMode ) {\n less.env = 'development';\n initRunningMode();\n }\n this.watchMode = true;\n return true;\n };\n\n less.unwatch = function () {clearInterval(less.watchTimer); this.watchMode = false; return false; };\n\n //\n // Synchronously get all tags with the 'rel' attribute set to\n // \"stylesheet/less\".\n //\n less.registerStylesheetsImmediately = () => {\n const links = document.getElementsByTagName('link');\n less.sheets = [];\n\n for (let i = 0; i < links.length; i++) {\n if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) &&\n (links[i].type.match(typePattern)))) {\n less.sheets.push(links[i]);\n }\n }\n };\n\n //\n // Asynchronously get all tags with the 'rel' attribute set to\n // \"stylesheet/less\", returning a Promise.\n //\n less.registerStylesheets = () => new Promise((resolve, reject) => {\n less.registerStylesheetsImmediately();\n resolve();\n });\n\n //\n // With this function, it's possible to alter variables and re-render\n // CSS without reloading less-files\n //\n less.modifyVars = record => less.refresh(true, record, false);\n\n less.refresh = (reload, modifyVars, clearFileCache) => {\n if ((reload || clearFileCache) && clearFileCache !== false) {\n fileManager.clearFileCache();\n }\n return new Promise((resolve, reject) => {\n let startTime;\n let endTime;\n let totalMilliseconds;\n let remainingSheets;\n startTime = endTime = new Date();\n\n // Set counter for remaining unprocessed sheets\n remainingSheets = less.sheets.length;\n\n if (remainingSheets === 0) {\n\n endTime = new Date();\n totalMilliseconds = endTime - startTime;\n less.logger.info('Less has finished and no sheets were loaded.');\n resolve({\n startTime,\n endTime,\n totalMilliseconds,\n sheets: less.sheets.length\n });\n\n } else {\n // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array\n loadStyleSheets((e, css, _, sheet, webInfo) => {\n if (e) {\n errors.add(e, e.href || sheet.href);\n reject(e);\n return;\n }\n if (webInfo.local) {\n less.logger.info(`Loading ${sheet.href} from cache.`);\n } else {\n less.logger.info(`Rendered ${sheet.href} successfully.`);\n }\n browser.createCSS(window.document, css, sheet);\n less.logger.info(`CSS for ${sheet.href} generated in ${new Date() - endTime}ms`);\n\n // Count completed sheet\n remainingSheets--;\n\n // Check if the last remaining sheet was processed and then call the promise\n if (remainingSheets === 0) {\n totalMilliseconds = new Date() - startTime;\n less.logger.info(`Less has finished. CSS generated in ${totalMilliseconds}ms`);\n resolve({\n startTime,\n endTime,\n totalMilliseconds,\n sheets: less.sheets.length\n });\n }\n endTime = new Date();\n }, reload, modifyVars);\n }\n\n loadStyles(modifyVars);\n });\n };\n\n less.refreshStyles = loadStyles;\n return less;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/log-listener.js b/packages/less/lib/less-browser/log-listener.js deleted file mode 100644 index 1a7656f63..000000000 --- a/packages/less/lib/less-browser/log-listener.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = (function (less, options) { - var logLevel_debug = 4; - var logLevel_info = 3; - var logLevel_warn = 2; - var logLevel_error = 1; - // The amount of logging in the javascript console. - // 3 - Debug, information and errors - // 2 - Information and errors - // 1 - Errors - // 0 - None - // Defaults to 2 - options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error); - if (!options.loggers) { - options.loggers = [{ - debug: function (msg) { - if (options.logLevel >= logLevel_debug) { - console.log(msg); - } - }, - info: function (msg) { - if (options.logLevel >= logLevel_info) { - console.log(msg); - } - }, - warn: function (msg) { - if (options.logLevel >= logLevel_warn) { - console.warn(msg); - } - }, - error: function (msg) { - if (options.logLevel >= logLevel_error) { - console.error(msg); - } - } - }]; - } - for (var i = 0; i < options.loggers.length; i++) { - less.logger.addListener(options.loggers[i]); - } -}); -//# sourceMappingURL=log-listener.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/log-listener.js.map b/packages/less/lib/less-browser/log-listener.js.map deleted file mode 100644 index aa06b4d71..000000000 --- a/packages/less/lib/less-browser/log-listener.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"log-listener.js","sourceRoot":"","sources":["../../src/less-browser/log-listener.js"],"names":[],"mappings":";;AAAA,mBAAe,UAAC,IAAI,EAAE,OAAO;IACzB,IAAM,cAAc,GAAG,CAAC,CAAC;IACzB,IAAM,aAAa,GAAG,CAAC,CAAC;IACxB,IAAM,aAAa,GAAG,CAAC,CAAC;IACxB,IAAM,cAAc,GAAG,CAAC,CAAC;IAEzB,mDAAmD;IACnD,oCAAoC;IACpC,6BAA6B;IAC7B,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,OAAO,CAAC,QAAQ,GAAG,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC,CAAE,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAElJ,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QAClB,OAAO,CAAC,OAAO,GAAG,CAAC;gBACf,KAAK,EAAE,UAAS,GAAG;oBACf,IAAI,OAAO,CAAC,QAAQ,IAAI,cAAc,EAAE;wBACpC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;qBACpB;gBACL,CAAC;gBACD,IAAI,EAAE,UAAS,GAAG;oBACd,IAAI,OAAO,CAAC,QAAQ,IAAI,aAAa,EAAE;wBACnC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;qBACpB;gBACL,CAAC;gBACD,IAAI,EAAE,UAAS,GAAG;oBACd,IAAI,OAAO,CAAC,QAAQ,IAAI,aAAa,EAAE;wBACnC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;qBACrB;gBACL,CAAC;gBACD,KAAK,EAAE,UAAS,GAAG;oBACf,IAAI,OAAO,CAAC,QAAQ,IAAI,cAAc,EAAE;wBACpC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;qBACtB;gBACL,CAAC;aACJ,CAAC,CAAC;KACN;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/C;AACL,CAAC,EAAC","sourcesContent":["export default (less, options) => {\n const logLevel_debug = 4;\n const logLevel_info = 3;\n const logLevel_warn = 2;\n const logLevel_error = 1;\n\n // The amount of logging in the javascript console.\n // 3 - Debug, information and errors\n // 2 - Information and errors\n // 1 - Errors\n // 0 - None\n // Defaults to 2\n options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error);\n\n if (!options.loggers) {\n options.loggers = [{\n debug: function(msg) {\n if (options.logLevel >= logLevel_debug) {\n console.log(msg);\n }\n },\n info: function(msg) {\n if (options.logLevel >= logLevel_info) {\n console.log(msg);\n }\n },\n warn: function(msg) {\n if (options.logLevel >= logLevel_warn) {\n console.warn(msg);\n }\n },\n error: function(msg) {\n if (options.logLevel >= logLevel_error) {\n console.error(msg);\n }\n }\n }];\n }\n for (let i = 0; i < options.loggers.length; i++) {\n less.logger.addListener(options.loggers[i]);\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/plugin-loader.js b/packages/less/lib/less-browser/plugin-loader.js deleted file mode 100644 index 244b4a922..000000000 --- a/packages/less/lib/less-browser/plugin-loader.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -// TODO: Add tests for browser @plugin -/* global window */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var abstract_plugin_loader_js_1 = __importDefault(require("../less/environment/abstract-plugin-loader.js")); -/** - * Browser Plugin Loader - */ -var PluginLoader = /** @class */ (function (_super) { - __extends(PluginLoader, _super); - function PluginLoader(less) { - var _this = _super.call(this) || this; - _this.less = less; - return _this; - // Should we shim this.require for browser? Probably not? - } - PluginLoader.prototype.loadPlugin = function (filename, basePath, context, environment, fileManager) { - return new Promise(function (fulfill, reject) { - fileManager.loadFile(filename, basePath, context, environment) - .then(fulfill).catch(reject); - }); - }; - return PluginLoader; -}(abstract_plugin_loader_js_1.default)); -exports.default = PluginLoader; -//# sourceMappingURL=plugin-loader.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/plugin-loader.js.map b/packages/less/lib/less-browser/plugin-loader.js.map deleted file mode 100644 index 4cd1bac03..000000000 --- a/packages/less/lib/less-browser/plugin-loader.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/less-browser/plugin-loader.js"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,mBAAmB;;;;;;;;;;;;;;;;;;AAEnB,4GAAiF;AAEjF;;GAEG;AACH;IAA2B,gCAAoB;IAC3C,sBAAY,IAAI;QAAhB,YACI,iBAAO,SAIV;QAFG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;QACjB,yDAAyD;IAC7D,CAAC;IAED,iCAAU,GAAV,UAAW,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW;QAC5D,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC/B,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC;iBACzD,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC;IACL,mBAAC;AAAD,CAAC,AAdD,CAA2B,mCAAoB,GAc9C;AAED,kBAAe,YAAY,CAAC","sourcesContent":["// TODO: Add tests for browser @plugin\n/* global window */\n\nimport AbstractPluginLoader from '../less/environment/abstract-plugin-loader.js';\n\n/**\n * Browser Plugin Loader\n */\nclass PluginLoader extends AbstractPluginLoader {\n constructor(less) {\n super();\n\n this.less = less;\n // Should we shim this.require for browser? Probably not?\n }\n\n loadPlugin(filename, basePath, context, environment, fileManager) {\n return new Promise((fulfill, reject) => {\n fileManager.loadFile(filename, basePath, context, environment)\n .then(fulfill).catch(reject);\n });\n }\n}\n\nexport default PluginLoader;\n\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-browser/utils.js b/packages/less/lib/less-browser/utils.js deleted file mode 100644 index 3aff2f15c..000000000 --- a/packages/less/lib/less-browser/utils.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.addDataAttr = exports.extractId = void 0; -function extractId(href) { - return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain - .replace(/[\?\&]livereload=\w+/, '') // Remove LiveReload cachebuster - .replace(/^\//, '') // Remove root / - .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension - .replace(/[^\.\w-]+/g, '-') // Replace illegal characters - .replace(/\./g, ':'); // Replace dots with colons(for valid id) -} -exports.extractId = extractId; -function addDataAttr(options, tag) { - for (var opt in tag.dataset) { - if (tag.dataset.hasOwnProperty(opt)) { - if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') { - options[opt] = tag.dataset[opt]; - } - else { - try { - options[opt] = JSON.parse(tag.dataset[opt]); - } - catch (_) { } - } - } - } -} -exports.addDataAttr = addDataAttr; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/packages/less/lib/less-browser/utils.js.map b/packages/less/lib/less-browser/utils.js.map deleted file mode 100644 index 0ea6ac6bc..000000000 --- a/packages/less/lib/less-browser/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/less-browser/utils.js"],"names":[],"mappings":";;;AACA,SAAgB,SAAS,CAAC,IAAI;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAE,2BAA2B;SACtE,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAQ,gCAAgC;SAC3E,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAyB,gBAAgB;SAC3D,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAgB,0BAA0B;SACrE,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAiB,6BAA6B;SACxE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAuB,yCAAyC;AAC7F,CAAC;AAPD,8BAOC;AAED,SAAgB,WAAW,CAAC,OAAO,EAAE,GAAG;IACpC,KAAK,IAAM,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE;QAC3B,IAAI,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YACjC,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,iBAAiB,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,gBAAgB,EAAE;gBAC9F,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;aACnC;iBAAM;gBACH,IAAI;oBACA,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;iBAC/C;gBACD,OAAO,CAAC,EAAE,GAAE;aACf;SACJ;KACJ;AACL,CAAC;AAbD,kCAaC","sourcesContent":["\nexport function extractId(href) {\n return href.replace(/^[a-z-]+:\\/+?[^\\/]+/, '') // Remove protocol & domain\n .replace(/[\\?\\&]livereload=\\w+/, '') // Remove LiveReload cachebuster\n .replace(/^\\//, '') // Remove root /\n .replace(/\\.[a-zA-Z]+$/, '') // Remove simple extension\n .replace(/[^\\.\\w-]+/g, '-') // Replace illegal characters\n .replace(/\\./g, ':'); // Replace dots with colons(for valid id)\n}\n\nexport function addDataAttr(options, tag) {\n for (const opt in tag.dataset) {\n if (tag.dataset.hasOwnProperty(opt)) {\n if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') {\n options[opt] = tag.dataset[opt];\n } else {\n try {\n options[opt] = JSON.parse(tag.dataset[opt]);\n }\n catch (_) {}\n }\n }\n }\n}\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/environment.js b/packages/less/lib/less-node/environment.js deleted file mode 100644 index cc6a5b2a7..000000000 --- a/packages/less/lib/less-node/environment.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - encodeBase64: function encodeBase64(str) { - // Avoid Buffer constructor on newer versions of Node.js. - var buffer = (Buffer.from ? Buffer.from(str) : (new Buffer(str))); - return buffer.toString('base64'); - }, - mimeLookup: function (filename) { - return require('mime').lookup(filename); - }, - charsetLookup: function (mime) { - return require('mime').charsets.lookup(mime); - }, - getSourceMapGenerator: function getSourceMapGenerator() { - return require('source-map').SourceMapGenerator; - } -}; -//# sourceMappingURL=environment.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/environment.js.map b/packages/less/lib/less-node/environment.js.map deleted file mode 100644 index 80d21c447..000000000 --- a/packages/less/lib/less-node/environment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/less-node/environment.js"],"names":[],"mappings":";;AAAA,kBAAe;IACX,YAAY,EAAE,SAAS,YAAY,CAAC,GAAG;QACnC,yDAAyD;QACzD,IAAM,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACpE,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IACD,UAAU,EAAE,UAAU,QAAQ;QAC1B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IACD,aAAa,EAAE,UAAU,IAAI;QACzB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IACD,qBAAqB,EAAE,SAAS,qBAAqB;QACjD,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC,kBAAkB,CAAC;IACpD,CAAC;CACJ,CAAC","sourcesContent":["export default {\n encodeBase64: function encodeBase64(str) {\n // Avoid Buffer constructor on newer versions of Node.js.\n const buffer = (Buffer.from ? Buffer.from(str) : (new Buffer(str)));\n return buffer.toString('base64');\n },\n mimeLookup: function (filename) {\n return require('mime').lookup(filename);\n },\n charsetLookup: function (mime) {\n return require('mime').charsets.lookup(mime);\n },\n getSourceMapGenerator: function getSourceMapGenerator() {\n return require('source-map').SourceMapGenerator;\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/file-manager.js b/packages/less/lib/less-node/file-manager.js deleted file mode 100644 index 5a453f180..000000000 --- a/packages/less/lib/less-node/file-manager.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var path_1 = __importDefault(require("path")); -var fs_1 = __importDefault(require("./fs")); -var abstract_file_manager_js_1 = __importDefault(require("../less/environment/abstract-file-manager.js")); -var FileManager = /** @class */ (function (_super) { - __extends(FileManager, _super); - function FileManager() { - return _super !== null && _super.apply(this, arguments) || this; - } - FileManager.prototype.supports = function () { - return true; - }; - FileManager.prototype.supportsSync = function () { - return true; - }; - FileManager.prototype.loadFile = function (filename, currentDirectory, options, environment, callback) { - var fullFilename; - var isAbsoluteFilename = this.isPathAbsolute(filename); - var filenamesTried = []; - var self = this; - var prefix = filename.slice(0, 1); - var explicit = prefix === '.' || prefix === '/'; - var result = null; - var isNodeModule = false; - var npmPrefix = 'npm://'; - options = options || {}; - var paths = isAbsoluteFilename ? [''] : [currentDirectory]; - if (options.paths) { - paths.push.apply(paths, options.paths); - } - if (!isAbsoluteFilename && paths.indexOf('.') === -1) { - paths.push('.'); - } - var prefixes = options.prefixes || ['']; - var fileParts = this.extractUrlParts(filename); - if (options.syncImport) { - getFileData(returnData, returnData); - if (callback) { - callback(result.error, result); - } - else { - return result; - } - } - else { - // promise is guaranteed to be asyncronous - // which helps as it allows the file handle - // to be closed before it continues with the next file - return new Promise(getFileData); - } - function returnData(data) { - if (!data.filename) { - result = { error: data }; - } - else { - result = data; - } - } - function getFileData(fulfill, reject) { - (function tryPathIndex(i) { - if (i < paths.length) { - (function tryPrefix(j) { - if (j < prefixes.length) { - isNodeModule = false; - fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename; - if (paths[i]) { - fullFilename = path_1.default.join(paths[i], fullFilename); - } - if (!explicit && paths[i] === '.') { - try { - fullFilename = require.resolve(fullFilename); - isNodeModule = true; - } - catch (e) { - filenamesTried.push(npmPrefix + fullFilename); - tryWithExtension(); - } - } - else { - tryWithExtension(); - } - function tryWithExtension() { - var extFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename; - if (extFilename !== fullFilename && !explicit && paths[i] === '.') { - try { - fullFilename = require.resolve(extFilename); - isNodeModule = true; - } - catch (e) { - filenamesTried.push(npmPrefix + extFilename); - fullFilename = extFilename; - } - } - else { - fullFilename = extFilename; - } - } - var readFileArgs = [fullFilename]; - if (!options.rawBuffer) { - readFileArgs.push('utf-8'); - } - if (options.syncImport) { - try { - var data = fs_1.default.readFileSync.apply(this, readFileArgs); - fulfill({ contents: data, filename: fullFilename }); - } - catch (e) { - filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename); - return tryPrefix(j + 1); - } - } - else { - readFileArgs.push(function (e, data) { - if (e) { - filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename); - return tryPrefix(j + 1); - } - fulfill({ contents: data, filename: fullFilename }); - }); - fs_1.default.readFile.apply(this, readFileArgs); - } - } - else { - tryPathIndex(i + 1); - } - })(0); - } - else { - reject({ type: 'File', message: "'" + filename + "' wasn't found. Tried - " + filenamesTried.join(',') }); - } - }(0)); - } - }; - FileManager.prototype.loadFileSync = function (filename, currentDirectory, options, environment) { - options.syncImport = true; - return this.loadFile(filename, currentDirectory, options, environment); - }; - return FileManager; -}(abstract_file_manager_js_1.default)); -exports.default = FileManager; -//# sourceMappingURL=file-manager.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/file-manager.js.map b/packages/less/lib/less-node/file-manager.js.map deleted file mode 100644 index 432f025d8..000000000 --- a/packages/less/lib/less-node/file-manager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"file-manager.js","sourceRoot":"","sources":["../../src/less-node/file-manager.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,4CAAsB;AACtB,0GAA+E;AAE/E;IAA0B,+BAAmB;IAA7C;;IA4IA,CAAC;IA3IG,8BAAQ,GAAR;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kCAAY,GAAZ;QACI,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,8BAAQ,GAAR,UAAS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ;QAC/D,IAAI,YAAY,CAAC;QACjB,IAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,IAAM,IAAI,GAAG,IAAI,CAAC;QAClB,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,IAAM,QAAQ,GAAG,MAAM,KAAK,GA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Y,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;yBACvB;oBACL,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACT;qBAAM;oBACH,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAI,QAAQ,gCAA2B,cAAc,CAAC,IAAI,CAAC,GAAG,CAAG,EAAE,CAAC,CAAC;iBACxG;YACL,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACV,CAAC;IACL,CAAC;IAED,kCAAY,GAAZ,UAAa,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW;QACzD,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC;IACL,kBAAC;AAAD,CAAC,AA5ID,CAA0B,kCAAmB,GA4I5C;AAED,kBAAe,WAAW,CAAC","sourcesContent":["import path from 'path';\nimport fs from './fs';\nimport AbstractFileManager from '../less/environment/abstract-file-manager.js';\n\nclass FileManager extends AbstractFileManager {\n supports() {\n return true;\n }\n\n supportsSync() {\n return true;\n }\n\n loadFile(filename, currentDirectory, options, environment, callback) {\n let fullFilename;\n const isAbsoluteFilename = this.isPathAbsolute(filename);\n const filenamesTried = [];\n const self = this;\n const prefix = filename.slice(0, 1);\n const explicit = prefix === '.' || prefix === '/';\n let result = null;\n let isNodeModule = false;\n const npmPrefix = 'npm://';\n\n options = options || {};\n\n const paths = isAbsoluteFilename ? [''] : [currentDirectory];\n\n if (options.paths) { paths.push(...options.paths); }\n\n if (!isAbsoluteFilename && paths.indexOf('.') === -1) { paths.push('.'); }\n\n const prefixes = options.prefixes || [''];\n const fileParts = this.extractUrlParts(filename);\n\n if (options.syncImport) {\n getFileData(returnData, returnData);\n if (callback) {\n callback(result.error, result);\n }\n else {\n return result;\n }\n }\n else {\n // promise is guaranteed to be asyncronous\n // which helps as it allows the file handle\n // to be closed before it continues with the next file\n return new Promise(getFileData);\n }\n\n function returnData(data) {\n if (!data.filename) {\n result = { error: data };\n }\n else {\n result = data;\n }\n }\n\n function getFileData(fulfill, reject) {\n (function tryPathIndex(i) {\n if (i < paths.length) {\n (function tryPrefix(j) {\n if (j < prefixes.length) {\n isNodeModule = false;\n fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename;\n\n if (paths[i]) {\n fullFilename = path.join(paths[i], fullFilename);\n }\n\n if (!explicit && paths[i] === '.') {\n try {\n fullFilename = require.resolve(fullFilename);\n isNodeModule = true;\n }\n catch (e) {\n filenamesTried.push(npmPrefix + fullFilename);\n tryWithExtension();\n }\n }\n else {\n tryWithExtension();\n }\n\n function tryWithExtension() {\n const extFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename;\n\n if (extFilename !== fullFilename && !explicit && paths[i] === '.') {\n try {\n fullFilename = require.resolve(extFilename);\n isNodeModule = true;\n }\n catch (e) {\n filenamesTried.push(npmPrefix + extFilename);\n fullFilename = extFilename;\n }\n }\n else {\n fullFilename = extFilename;\n }\n }\n \n const readFileArgs = [fullFilename];\n if (!options.rawBuffer) {\n readFileArgs.push('utf-8');\n }\n if (options.syncImport) {\n try {\n const data = fs.readFileSync.apply(this, readFileArgs);\n fulfill({ contents: data, filename: fullFilename});\n }\n catch (e) {\n filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);\n return tryPrefix(j + 1);\n }\n }\n else {\n readFileArgs.push(function(e, data) {\n if (e) {\n filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);\n return tryPrefix(j + 1);\n }\n fulfill({ contents: data, filename: fullFilename});\n });\n fs.readFile.apply(this, readFileArgs);\n }\n }\n else {\n tryPathIndex(i + 1);\n }\n })(0);\n } else {\n reject({ type: 'File', message: `'${filename}' wasn't found. Tried - ${filenamesTried.join(',')}` });\n }\n }(0));\n }\n }\n\n loadFileSync(filename, currentDirectory, options, environment) {\n options.syncImport = true;\n return this.loadFile(filename, currentDirectory, options, environment);\n }\n}\n\nexport default FileManager;"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/fs.js b/packages/less/lib/less-node/fs.js deleted file mode 100644 index 070af7537..000000000 --- a/packages/less/lib/less-node/fs.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var fs; -try { - fs = require('graceful-fs'); -} -catch (e) { - fs = require('fs'); -} -exports.default = fs; -//# sourceMappingURL=fs.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/fs.js.map b/packages/less/lib/less-node/fs.js.map deleted file mode 100644 index 9e89960dd..000000000 --- a/packages/less/lib/less-node/fs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/less-node/fs.js"],"names":[],"mappings":";;AAAA,IAAI,EAAE,CAAC;AACP,IACA;IACI,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC/B;AACD,OAAO,CAAC,EACR;IACI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB;AACD,kBAAe,EAAE,CAAC","sourcesContent":["let fs;\ntry\n{\n fs = require('graceful-fs');\n}\ncatch (e)\n{\n fs = require('fs');\n}\nexport default fs;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/image-size.js b/packages/less/lib/less-node/image-size.js deleted file mode 100644 index 5ef995e63..000000000 --- a/packages/less/lib/less-node/image-size.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var dimension_1 = __importDefault(require("../less/tree/dimension")); -var expression_1 = __importDefault(require("../less/tree/expression")); -var function_registry_1 = __importDefault(require("./../less/functions/function-registry")); -exports.default = (function (environment) { - function imageSize(functionContext, filePathNode) { - var filePath = filePathNode.value; - var currentFileInfo = functionContext.currentFileInfo; - var currentDirectory = currentFileInfo.rewriteUrls ? - currentFileInfo.currentDirectory : currentFileInfo.entryPath; - var fragmentStart = filePath.indexOf('#'); - var fragment = ''; - if (fragmentStart !== -1) { - fragment = filePath.slice(fragmentStart); - filePath = filePath.slice(0, fragmentStart); - } - var fileManager = environment.getFileManager(filePath, currentDirectory, functionContext.context, environment, true); - if (!fileManager) { - throw { - type: 'File', - message: "Can not set up FileManager for " + filePathNode - }; - } - var fileSync = fileManager.loadFileSync(filePath, currentDirectory, functionContext.context, environment); - if (fileSync.error) { - throw fileSync.error; - } - var sizeOf = require('image-size'); - return sizeOf(fileSync.filename); - } - var imageFunctions = { - 'image-size': function (filePathNode) { - var size = imageSize(this, filePathNode); - return new expression_1.default([ - new dimension_1.default(size.width, 'px'), - new dimension_1.default(size.height, 'px') - ]); - }, - 'image-width': function (filePathNode) { - var size = imageSize(this, filePathNode); - return new dimension_1.default(size.width, 'px'); - }, - 'image-height': function (filePathNode) { - var size = imageSize(this, filePathNode); - return new dimension_1.default(size.height, 'px'); - } - }; - function_registry_1.default.addMultiple(imageFunctions); -}); -//# sourceMappingURL=image-size.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/image-size.js.map b/packages/less/lib/less-node/image-size.js.map deleted file mode 100644 index 8c73b9bc7..000000000 --- a/packages/less/lib/less-node/image-size.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image-size.js","sourceRoot":"","sources":["../../src/less-node/image-size.js"],"names":[],"mappings":";;;;;AAAA,qEAA+C;AAC/C,uEAAiD;AACjD,4FAAqE;AAErE,mBAAe,UAAA,WAAW;IAEtB,SAAS,SAAS,CAAC,eAAe,EAAE,YAAY;QAC5C,IAAI,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC;QAClC,IAAM,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC;QACxD,IAAM,gBAAgB,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;YAClD,eAAe,CAAC,gBAAgB,CAAC,CAAC,C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,IAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC3C,OAAO,IAAI,mBAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,cAAc,EAAE,UAAS,YAAY;YACjC,IAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAC3C,OAAO,IAAI,mBAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;KACJ,CAAC;IAEF,2BAAgB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC,EAAC","sourcesContent":["import Dimension from '../less/tree/dimension';\nimport Expression from '../less/tree/expression';\nimport functionRegistry from './../less/functions/function-registry';\n\nexport default environment => {\n\n function imageSize(functionContext, filePathNode) {\n let filePath = filePathNode.value;\n const currentFileInfo = functionContext.currentFileInfo;\n const currentDirectory = currentFileInfo.rewriteUrls ?\n currentFileInfo.currentDirectory : currentFileInfo.entryPath;\n\n const fragmentStart = filePath.indexOf('#');\n let fragment = '';\n if (fragmentStart !== -1) {\n fragment = filePath.slice(fragmentStart);\n filePath = filePath.slice(0, fragmentStart);\n }\n\n const fileManager = environment.getFileManager(filePath, currentDirectory, functionContext.context, environment, true);\n\n if (!fileManager) {\n throw {\n type: 'File',\n message: `Can not set up FileManager for ${filePathNode}`\n };\n }\n\n const fileSync = fileManager.loadFileSync(filePath, currentDirectory, functionContext.context, environment);\n\n if (fileSync.error) {\n throw fileSync.error;\n }\n\n const sizeOf = require('image-size');\n return sizeOf(fileSync.filename);\n }\n\n const imageFunctions = {\n 'image-size': function(filePathNode) {\n const size = imageSize(this, filePathNode);\n return new Expression([\n new Dimension(size.width, 'px'),\n new Dimension(size.height, 'px')\n ]);\n },\n 'image-width': function(filePathNode) {\n const size = imageSize(this, filePathNode);\n return new Dimension(size.width, 'px');\n },\n 'image-height': function(filePathNode) {\n const size = imageSize(this, filePathNode);\n return new Dimension(size.height, 'px');\n }\n };\n\n functionRegistry.addMultiple(imageFunctions);\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/index.js b/packages/less/lib/less-node/index.js deleted file mode 100644 index 7e318498b..000000000 --- a/packages/less/lib/less-node/index.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var environment_1 = __importDefault(require("./environment")); -var file_manager_1 = __importDefault(require("./file-manager")); -var url_file_manager_1 = __importDefault(require("./url-file-manager")); -var less_1 = __importDefault(require("../less")); -var lessc_helper_1 = __importDefault(require("./lessc-helper")); -var plugin_loader_1 = __importDefault(require("./plugin-loader")); -var fs_1 = __importDefault(require("./fs")); -var default_options_1 = __importDefault(require("../less/default-options")); -var image_size_1 = __importDefault(require("./image-size")); -var less = less_1.default(environment_1.default, [new file_manager_1.default(), new url_file_manager_1.default()]); -// allow people to create less with their own environment -less.createFromEnvironment = less_1.default; -less.lesscHelper = lessc_helper_1.default; -less.PluginLoader = plugin_loader_1.default; -less.fs = fs_1.default; -less.FileManager = file_manager_1.default; -less.UrlFileManager = url_file_manager_1.default; -// Set up options -less.options = default_options_1.default(); -// provide image-size functionality -image_size_1.default(less.environment); -exports.default = less; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/index.js.map b/packages/less/lib/less-node/index.js.map deleted file mode 100644 index 58f2a6a94..000000000 --- a/packages/less/lib/less-node/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/less-node/index.js"],"names":[],"mappings":";;;;;AAAA,8DAAwC;AACxC,gEAAyC;AACzC,wEAAgD;AAChD,iDAA4C;AAC5C,gEAAyC;AACzC,kEAA2C;AAC3C,4CAAsB;AACtB,4EAAqD;AACrD,4DAAqC;AAErC,IAAM,IAAI,GAAG,cAAqB,CAAC,qBAAW,EAAE,CAAC,IAAI,sBAAW,EAAE,EAAE,IAAI,0BAAc,EAAE,CAAC,CAAC,CAAC;AAE3F,yDAAyD;AACzD,IAAI,CAAC,qBAAqB,GAAG,cAAqB,CAAC;AACnD,IAAI,CAAC,WAAW,GAAG,sBAAW,CAAC;AAC/B,IAAI,CAAC,YAAY,GAAG,uBAAY,CAAC;AACjC,IAAI,CAAC,EAAE,GAAG,YAAE,CAAC;AACb,IAAI,CAAC,WAAW,GAAG,sBAAW,CAAC;AAC/B,IAAI,CAAC,cAAc,GAAG,0BAAc,CAAC;AAErC,iBAAiB;AACjB,IAAI,CAAC,OAAO,GAAG,yBAAc,EAAE,CAAC;AAEhC,mCAAmC;AACnC,oBAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAE5B,kBAAe,IAAI,CAAC","sourcesContent":["import environment from './environment';\nimport FileManager from './file-manager';\nimport UrlFileManager from './url-file-manager';\nimport createFromEnvironment from '../less';\nimport lesscHelper from './lessc-helper';\nimport PluginLoader from './plugin-loader';\nimport fs from './fs';\nimport defaultOptions from '../less/default-options';\nimport imageSize from './image-size';\n\nconst less = createFromEnvironment(environment, [new FileManager(), new UrlFileManager()]);\n\n// allow people to create less with their own environment\nless.createFromEnvironment = createFromEnvironment;\nless.lesscHelper = lesscHelper;\nless.PluginLoader = PluginLoader;\nless.fs = fs;\nless.FileManager = FileManager;\nless.UrlFileManager = UrlFileManager;\n\n// Set up options\nless.options = defaultOptions();\n\n// provide image-size functionality\nimageSize(less.environment);\n\nexport default less;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/lessc-helper.js b/packages/less/lib/less-node/lessc-helper.js deleted file mode 100644 index 6ab8d4da8..000000000 --- a/packages/less/lib/less-node/lessc-helper.js +++ /dev/null @@ -1,92 +0,0 @@ -// lessc_helper.js -// -// helper functions for lessc -var lessc_helper = { - // Stylize a string - stylize: function (str, style) { - var styles = { - 'reset': [0, 0], - 'bold': [1, 22], - 'inverse': [7, 27], - 'underline': [4, 24], - 'yellow': [33, 39], - 'green': [32, 39], - 'red': [31, 39], - 'grey': [90, 39] - }; - return "\u001B[" + styles[style][0] + "m" + str + "\u001B[" + styles[style][1] + "m"; - }, - // Print command line options - printUsage: function () { - console.log('usage: lessc [option option=parameter ...] [destination]'); - console.log(''); - console.log('If source is set to `-\' (dash or hyphen-minus), input is read from stdin.'); - console.log(''); - console.log('options:'); - console.log(' -h, --help Prints help (this message) and exit.'); - console.log(' --include-path=PATHS Sets include paths. Separated by `:\'. `;\' also supported on windows.'); - console.log(' -M, --depends Outputs a makefile import dependency list to stdout.'); - console.log(' --no-color Disables colorized output.'); - console.log(' --ie-compat Enables IE8 compatibility checks.'); - console.log(' --js Enables inline JavaScript in less files'); - console.log(' -l, --lint Syntax check only (lint).'); - console.log(' -s, --silent Suppresses output of error messages.'); - console.log(' --strict-imports Forces evaluation of imports.'); - console.log(' --insecure Allows imports from insecure https hosts.'); - console.log(' -v, --version Prints version number and exit.'); - console.log(' --verbose Be verbose.'); - console.log(' --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map).'); - console.log(' --source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths.'); - console.log(' --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.'); - console.log(' --source-map-include-source Puts the less files into the map instead of referencing them.'); - console.log(' --source-map-inline Puts the map (and any less files) as a base64 data uri into the output css file.'); - console.log(' --source-map-url=URL Sets a custom URL to map file, for sourceMappingURL comment'); - console.log(' in generated CSS file.'); - console.log(' --source-map-no-annotation Excludes the sourceMappingURL comment from the output css file.'); - console.log(' -rp, --rootpath=URL Sets rootpath for url rewriting in relative imports and urls'); - console.log(' Works with or without the relative-urls option.'); - console.log(' -ru=, --rewrite-urls= Rewrites URLs to make them relative to the base less file.'); - console.log(' all|local|off \'all\' rewrites all URLs, \'local\' just those starting with a \'.\''); - console.log(''); - console.log(' -m=, --math='); - console.log(' always Less will eagerly perform math operations always.'); - console.log(' parens-division Math performed except for division (/) operator'); - console.log(' parens | strict Math only performed inside parentheses'); - console.log(' strict-legacy Parens required in very strict terms (legacy --strict-math)'); - console.log(''); - console.log(' -su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units'); - console.log(' --strict-units=on|off that cannot be represented.'); - console.log(' --global-var=\'VAR=VALUE\' Defines a variable that can be referenced by the file.'); - console.log(' --modify-var=\'VAR=VALUE\' Modifies a variable already declared in the file.'); - console.log(' --url-args=\'QUERYSTRING\' Adds params into url tokens (e.g. 42, cb=42 or \'a=1&b=2\')'); - console.log(' --plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin begins'); - console.log(' less-plugin. E.g. the clean css plugin is called less-plugin-clean-css'); - console.log(' once installed (npm install less-plugin-clean-css), use either with'); - console.log(' --plugin=less-plugin-clean-css or just --clean-css'); - console.log(' specify options afterwards e.g. --plugin=less-plugin-clean-css="advanced"'); - console.log(' or --clean-css="advanced"'); - console.log(''); - console.log('-------------------------- Deprecated ----------------'); - console.log(' -sm=on|off Legacy parens-only math. Use --math'); - console.log(' --strict-math=on|off '); - console.log(''); - console.log(' --line-numbers=TYPE Outputs filename and line numbers.'); - console.log(' TYPE can be either \'comments\', which will output'); - console.log(' the debug info within comments, \'mediaquery\''); - console.log(' that will output the information within a fake'); - console.log(' media query which is compatible with the SASS'); - console.log(' format, and \'all\' which will do both.'); - console.log(' -x, --compress Compresses output by removing some whitespaces.'); - console.log(' We recommend you use a dedicated minifer like less-plugin-clean-css'); - console.log(''); - console.log('Report bugs to: http://github.com/less/less.js/issues'); - console.log('Home page: '); - } -}; -// Exports helper functions -for (var h in lessc_helper) { - if (lessc_helper.hasOwnProperty(h)) { - exports[h] = lessc_helper[h]; - } -} -//# sourceMappingURL=lessc-helper.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/lessc-helper.js.map b/packages/less/lib/less-node/lessc-helper.js.map deleted file mode 100644 index 312ec89c6..000000000 --- a/packages/less/lib/less-node/lessc-helper.js.map +++ /dev/null @@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AAC;QACxF,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;QAC1F,OAAO,CAAC,GAAG,CAAC,gGAAgG,CAAC,CAAC;QAC9G,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IACpD,CAAC;CACJ,CAAC;AAEF,2BAA2B;AAC3B,KAAK,IAAM,CAAC,IAAI,YAAY,EAAE;IAAE,IAAI,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;QAAE,OAAO,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;KAAE;CAAC","sourcesContent":["// lessc_helper.js\n//\n// helper functions for lessc\nconst lessc_helper = {\n\n // Stylize a string\n stylize : function(str, style) {\n const styles = {\n 'reset' : [0, 0],\n 'bold' : [1, 22],\n 'inverse' : [7, 27],\n 'underline' : [4, 24],\n 'yellow' : [33, 39],\n 'green' : [32, 39],\n 'red' : [31, 39],\n 'grey' : [90, 39]\n };\n return `\\x1b[${styles[style][0]}m${str}\\x1b[${styles[style][1]}m`;\n },\n\n // Print command line options\n printUsage: function() {\n console.log('usage: lessc [option option=parameter ...] [destination]');\n console.log('');\n console.log('If source is set to `-\\' (dash or hyphen-minus), input is read from stdin.');\n console.log('');\n console.log('options:');\n console.log(' -h, --help Prints help (this message) and exit.');\n console.log(' --include-path=PATHS Sets include paths. Separated by `:\\'. `;\\' also supported on windows.');\n console.log(' -M, --depends Outputs a makefile import dependency list to stdout.');\n console.log(' --no-color Disables colorized output.');\n console.log(' --ie-compat Enables IE8 compatibility checks.');\n console.log(' --js Enables inline JavaScript in less files');\n console.log(' -l, --lint Syntax check only (lint).');\n console.log(' -s, --silent Suppresses output of error messages.');\n console.log(' --strict-imports Forces evaluation of imports.');\n console.log(' --insecure Allows imports from insecure https hosts.');\n console.log(' -v, --version Prints version number and exit.');\n console.log(' --verbose Be verbose.');\n console.log(' --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map).');\n console.log(' --source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths.');\n console.log(' --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.');\n console.log(' --source-map-include-source Puts the less files into the map instead of referencing them.');\n console.log(' --source-map-inline Puts the map (and any less files) as a base64 data uri into the output css file.');\n console.log(' --source-map-url=URL Sets a custom URL to map file, for sourceMappingURL comment');\n console.log(' in generated CSS file.');\n console.log(' --source-map-no-annotation Excludes the sourceMappingURL comment from the output css file.');\n console.log(' -rp, --rootpath=URL Sets rootpath for url rewriting in relative imports and urls');\n console.log(' Works with or without the relative-urls option.');\n console.log(' -ru=, --rewrite-urls= Rewrites URLs to make them relative to the base less file.');\n console.log(' all|local|off \\'all\\' rewrites all URLs, \\'local\\' just those starting with a \\'.\\'');\n console.log('');\n console.log(' -m=, --math=');\n console.log(' always Less will eagerly perform math operations always.');\n console.log(' parens-division Math performed except for division (/) operator');\n console.log(' parens | strict Math only performed inside parentheses');\n console.log(' strict-legacy Parens required in very strict terms (legacy --strict-math)');\n console.log('');\n console.log(' -su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units');\n console.log(' --strict-units=on|off that cannot be represented.');\n console.log(' --global-var=\\'VAR=VALUE\\' Defines a variable that can be referenced by the file.');\n console.log(' --modify-var=\\'VAR=VALUE\\' Modifies a variable already declared in the file.');\n console.log(' --url-args=\\'QUERYSTRING\\' Adds params into url tokens (e.g. 42, cb=42 or \\'a=1&b=2\\')');\n console.log(' --plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin begins');\n console.log(' less-plugin. E.g. the clean css plugin is called less-plugin-clean-css');\n console.log(' once installed (npm install less-plugin-clean-css), use either with');\n console.log(' --plugin=less-plugin-clean-css or just --clean-css');\n console.log(' specify options afterwards e.g. --plugin=less-plugin-clean-css=\"advanced\"');\n console.log(' or --clean-css=\"advanced\"');\n console.log('');\n console.log('-------------------------- Deprecated ----------------');\n console.log(' -sm=on|off Legacy parens-only math. Use --math');\n console.log(' --strict-math=on|off ');\n console.log('');\n console.log(' --line-numbers=TYPE Outputs filename and line numbers.');\n console.log(' TYPE can be either \\'comments\\', which will output');\n console.log(' the debug info within comments, \\'mediaquery\\'');\n console.log(' that will output the information within a fake');\n console.log(' media query which is compatible with the SASS');\n console.log(' format, and \\'all\\' which will do both.');\n console.log(' -x, --compress Compresses output by removing some whitespaces.');\n console.log(' We recommend you use a dedicated minifer like less-plugin-clean-css');\n console.log('');\n console.log('Report bugs to: http://github.com/less/less.js/issues');\n console.log('Home page: ');\n }\n};\n\n// Exports helper functions\nfor (const h in lessc_helper) { if (lessc_helper.hasOwnProperty(h)) { exports[h] = lessc_helper[h]; }}\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/plugin-loader.js b/packages/less/lib/less-node/plugin-loader.js deleted file mode 100644 index 475380ff4..000000000 --- a/packages/less/lib/less-node/plugin-loader.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var path_1 = __importDefault(require("path")); -var abstract_plugin_loader_js_1 = __importDefault(require("../less/environment/abstract-plugin-loader.js")); -/** - * Node Plugin Loader - */ -var PluginLoader = /** @class */ (function (_super) { - __extends(PluginLoader, _super); - function PluginLoader(less) { - var _this = _super.call(this) || this; - _this.less = less; - _this.require = function (prefix) { - prefix = path_1.default.dirname(prefix); - return function (id) { - var str = id.substr(0, 2); - if (str === '..' || str === './') { - return require(path_1.default.join(prefix, id)); - } - else { - return require(id); - } - }; - }; - return _this; - } - PluginLoader.prototype.loadPlugin = function (filename, basePath, context, environment, fileManager) { - var prefix = filename.slice(0, 1); - var explicit = prefix === '.' || prefix === '/' || filename.slice(-3).toLowerCase() === '.js'; - if (!explicit) { - context.prefixes = ['less-plugin-', '']; - } - if (context.syncImport) { - return fileManager.loadFileSync(filename, basePath, context, environment); - } - return new Promise(function (fulfill, reject) { - fileManager.loadFile(filename, basePath, context, environment).then(function (data) { - try { - fulfill(data); - } - catch (e) { - console.log(e); - reject(e); - } - }).catch(function (err) { - reject(err); - }); - }); - }; - PluginLoader.prototype.loadPluginSync = function (filename, basePath, context, environment, fileManager) { - context.syncImport = true; - return this.loadPlugin(filename, basePath, context, environment, fileManager); - }; - return PluginLoader; -}(abstract_plugin_loader_js_1.default)); -exports.default = PluginLoader; -//# sourceMappingURL=plugin-loader.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/plugin-loader.js.map b/packages/less/lib/less-node/plugin-loader.js.map deleted file mode 100644 index 37df4873b..000000000 --- a/packages/less/lib/less-node/plugin-loader.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/less-node/plugin-loader.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,4GAAiF;AAEjF;;GAEG;AACH;IAA2B,gCAAoB;IAC3C,sBAAY,IAAI;QAAhB,YACI,iBAAO,SAeV;QAbG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,OAAO,GAAG,UAAA,MAAM;YACjB,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC9B,OAAO,UAAA,EAAE;gBACL,IAAM,GAA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,KAAK,CAAC,UAAA,GAAG;gBACP,MAAM,CAAC,GAAG,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,qCAAc,GAAd,UAAe,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW;QAChE,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAClF,CAAC;IACL,mBAAC;AAAD,CAAC,AAnDD,CAA2B,mCAAoB,GAmD9C;AAED,kBAAe,YAAY,CAAC","sourcesContent":["import path from 'path';\nimport AbstractPluginLoader from '../less/environment/abstract-plugin-loader.js';\n\n/**\n * Node Plugin Loader\n */\nclass PluginLoader extends AbstractPluginLoader {\n constructor(less) {\n super();\n\n this.less = less;\n this.require = prefix => {\n prefix = path.dirname(prefix);\n return id => {\n const str = id.substr(0, 2);\n if (str === '..' || str === './') {\n return require(path.join(prefix, id));\n }\n else {\n return require(id);\n }\n };\n };\n }\n\n loadPlugin(filename, basePath, context, environment, fileManager) {\n const prefix = filename.slice(0, 1);\n const explicit = prefix === '.' || prefix === '/' || filename.slice(-3).toLowerCase() === '.js';\n if (!explicit) {\n context.prefixes = ['less-plugin-', ''];\n }\n\n if (context.syncImport) {\n return fileManager.loadFileSync(filename, basePath, context, environment);\n }\n\n return new Promise((fulfill, reject) => {\n fileManager.loadFile(filename, basePath, context, environment).then(\n data => {\n try {\n fulfill(data);\n }\n catch (e) {\n console.log(e);\n reject(e);\n }\n }\n ).catch(err => {\n reject(err);\n });\n });\n }\n\n loadPluginSync(filename, basePath, context, environment, fileManager) {\n context.syncImport = true;\n return this.loadPlugin(filename, basePath, context, environment, fileManager);\n }\n}\n\nexport default PluginLoader;\n\n"]} \ No newline at end of file diff --git a/packages/less/lib/less-node/url-file-manager.js b/packages/less/lib/less-node/url-file-manager.js deleted file mode 100644 index 6259bb18c..000000000 --- a/packages/less/lib/less-node/url-file-manager.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var isUrlRe = /^(?:https?:)?\/\//i; -var url_1 = __importDefault(require("url")); -var request; -var abstract_file_manager_js_1 = __importDefault(require("../less/environment/abstract-file-manager.js")); -var logger_1 = __importDefault(require("../less/logger")); -var UrlFileManager = /** @class */ (function (_super) { - __extends(UrlFileManager, _super); - function UrlFileManager() { - return _super !== null && _super.apply(this, arguments) || this; - } - UrlFileManager.prototype.supports = function (filename, currentDirectory, options, environment) { - return isUrlRe.test(filename) || isUrlRe.test(currentDirectory); - }; - UrlFileManager.prototype.loadFile = function (filename, currentDirectory, options, environment) { - return new Promise(function (fulfill, reject) { - if (request === undefined) { - try { - request = require('native-request'); - } - catch (e) { - request = null; - } - } - if (!request) { - reject({ type: 'File', message: 'optional dependency \'native-request\' required to import over http(s)\n' }); - return; - } - var urlStr = isUrlRe.test(filename) ? filename : url_1.default.resolve(currentDirectory, filename); - var urlObj = url_1.default.parse(urlStr); - if (!urlObj.protocol) { - urlObj.protocol = 'http'; - urlStr = urlObj.format(); - } - request.get({ uri: urlStr, strictSSL: !options.insecure }, function (error, res, body) { - if (error) { - reject({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n " + error + "\n" }); - return; - } - if (res && res.statusCode === 404) { - reject({ type: 'File', message: "resource '" + urlStr + "' was not found\n" }); - return; - } - if (!body) { - logger_1.default.warn("Warning: Empty body (HTTP " + res.statusCode + ") returned by \"" + urlStr + "\""); - } - fulfill({ contents: body, filename: urlStr }); - }); - }); - }; - return UrlFileManager; -}(abstract_file_manager_js_1.default)); -exports.default = UrlFileManager; -//# sourceMappingURL=url-file-manager.js.map \ No newline at end of file diff --git a/packages/less/lib/less-node/url-file-manager.js.map b/packages/less/lib/less-node/url-file-manager.js.map deleted file mode 100644 index 9b291949b..000000000 --- a/packages/less/lib/less-node/url-file-manager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"url-file-manager.js","sourceRoot":"","sources":["../../src/less-node/url-file-manager.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAM,OAAO,GAAG,oBAAoB,CAAC;AACrC,4CAAsB;AACtB,IAAI,OAAO,CAAC;AACZ,0GAA+E;AAC/E,0DAAoC;AAEpC;IAA6B,kCAAmB;IAAhD;;IAwCA,CAAC;IAvCG,iCAAQ,GAAR,UAAS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW;QACrD,OAAO,OAAO,CAAC,IAAI,CAAE,QAAQ,CAAE,IAAI,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACtE,CAAC;IAED,iCAAQ,GAAR,UAAS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW;QACrD,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAC/B,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,IAAI;oBAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;iBAAE;gBAC5C,OAAO,CAAC,EAAE;oBAAE,OAAO,GAAG,IAAI,CAAC;iBAAE;aAChC;YACD,IAAI,CAAC,OAAO,EAAE;gBACV,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,0EAA0E,EAAE,CAAC,CAAC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Content":["const isUrlRe = /^(?:https?:)?\\/\\//i;\nimport url from 'url';\nlet request;\nimport AbstractFileManager from '../less/environment/abstract-file-manager.js';\nimport logger from '../less/logger';\n\nclass UrlFileManager extends AbstractFileManager {\n supports(filename, currentDirectory, options, environment) {\n return isUrlRe.test( filename ) || isUrlRe.test(currentDirectory);\n }\n\n loadFile(filename, currentDirectory, options, environment) {\n return new Promise((fulfill, reject) => {\n if (request === undefined) {\n try { request = require('native-request'); }\n catch (e) { request = null; }\n }\n if (!request) {\n reject({ type: 'File', message: 'optional dependency \\'native-request\\' required to import over http(s)\\n' });\n return;\n }\n\n let urlStr = isUrlRe.test( filename ) ? filename : url.resolve(currentDirectory, filename);\n const urlObj = url.parse(urlStr);\n\n if (!urlObj.protocol) {\n urlObj.protocol = 'http';\n urlStr = urlObj.format();\n }\n\n request.get({uri: urlStr, strictSSL: !options.insecure }, (error, res, body) => {\n if (error) {\n reject({ type: 'File', message: `resource '${urlStr}' gave this Error:\\n ${error}\\n` });\n return;\n }\n if (res && res.statusCode === 404) {\n reject({ type: 'File', message: `resource '${urlStr}' was not found\\n` });\n return;\n }\n if (!body) {\n logger.warn(`Warning: Empty body (HTTP ${res.statusCode}) returned by \"${urlStr}\"`);\n }\n fulfill({ contents: body, filename: urlStr });\n });\n });\n }\n}\n\nexport default UrlFileManager;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/constants.js b/packages/less/lib/less/constants.js deleted file mode 100644 index abc971c47..000000000 --- a/packages/less/lib/less/constants.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.RewriteUrls = exports.Math = void 0; -exports.Math = { - ALWAYS: 0, - PARENS_DIVISION: 1, - PARENS: 2, - STRICT_LEGACY: 3 -}; -exports.RewriteUrls = { - OFF: 0, - LOCAL: 1, - ALL: 2 -}; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/packages/less/lib/less/constants.js.map b/packages/less/lib/less/constants.js.map deleted file mode 100644 index 11ae28303..000000000 --- a/packages/less/lib/less/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/less/constants.js"],"names":[],"mappings":";;;AACa,QAAA,IAAI,GAAG;IAChB,MAAM,EAAE,CAAC;IACT,eAAe,EAAE,CAAC;IAClB,MAAM,EAAE,CAAC;IACT,aAAa,EAAE,CAAC;CACnB,CAAC;AAEW,QAAA,WAAW,GAAG;IACvB,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;CACT,CAAC","sourcesContent":["\nexport const Math = {\n ALWAYS: 0,\n PARENS_DIVISION: 1,\n PARENS: 2,\n STRICT_LEGACY: 3\n};\n\nexport const RewriteUrls = {\n OFF: 0,\n LOCAL: 1,\n ALL: 2\n};"]} \ No newline at end of file diff --git a/packages/less/lib/less/contexts.js b/packages/less/lib/less/contexts.js deleted file mode 100644 index 9491e7577..000000000 --- a/packages/less/lib/less/contexts.js +++ /dev/null @@ -1,171 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var contexts = {}; -exports.default = contexts; -var Constants = __importStar(require("./constants")); -var copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) { - if (!original) { - return; - } - for (var i = 0; i < propertiesToCopy.length; i++) { - if (original.hasOwnProperty(propertiesToCopy[i])) { - destination[propertiesToCopy[i]] = original[propertiesToCopy[i]]; - } - } -}; -/* - parse is used whilst parsing - */ -var parseCopyProperties = [ - // options - 'paths', - 'rewriteUrls', - 'rootpath', - 'strictImports', - 'insecure', - 'dumpLineNumbers', - 'compress', - 'syncImport', - 'chunkInput', - 'mime', - 'useFileCache', - // context - 'processImports', - // Used by the import manager to stop multiple import visitors being created. - 'pluginManager' // Used as the plugin manager for the session -]; -contexts.Parse = function (options) { - copyFromOriginal(options, this, parseCopyProperties); - if (typeof this.paths === 'string') { - this.paths = [this.paths]; - } -}; -var evalCopyProperties = [ - 'paths', - 'compress', - 'math', - 'strictUnits', - 'sourceMap', - 'importMultiple', - 'urlArgs', - 'javascriptEnabled', - 'pluginManager', - 'importantScope', - 'rewriteUrls' // option - whether to adjust URL's to be relative -]; -function isPathRelative(path) { - return !/^(?:[a-z-]+:|\/|#)/i.test(path); -} -function isPathLocalRelative(path) { - return path.charAt(0) === '.'; -} -contexts.Eval = /** @class */ (function () { - function Eval(options, frames) { - copyFromOriginal(options, this, evalCopyProperties); - if (typeof this.paths === 'string') { - this.paths = [this.paths]; - } - this.frames = frames || []; - this.importantScope = this.importantScope || []; - this.inCalc = false; - this.mathOn = true; - } - Eval.prototype.enterCalc = function () { - if (!this.calcStack) { - this.calcStack = []; - } - this.calcStack.push(true); - this.inCalc = true; - }; - Eval.prototype.exitCalc = function () { - this.calcStack.pop(); - if (!this.calcStack.length) { - this.inCalc = false; - } - }; - Eval.prototype.inParenthesis = function () { - if (!this.parensStack) { - this.parensStack = []; - } - this.parensStack.push(true); - }; - ; - Eval.prototype.outOfParenthesis = function () { - this.parensStack.pop(); - }; - ; - Eval.prototype.isMathOn = function (op) { - if (!this.mathOn) { - return false; - } - if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) { - return false; - } - if (this.math > Constants.Math.PARENS_DIVISION) { - return this.parensStack && this.parensStack.length; - } - return true; - }; - Eval.prototype.pathRequiresRewrite = function (path) { - var isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative; - return isRelative(path); - }; - Eval.prototype.rewritePath = function (path, rootpath) { - var newPath; - rootpath = rootpath || ''; - newPath = this.normalizePath(rootpath + path); - // If a path was explicit relative and the rootpath was not an absolute path - // we must ensure that the new path is also explicit relative. - if (isPathLocalRelative(path) && - isPathRelative(rootpath) && - isPathLocalRelative(newPath) === false) { - newPath = "./" + newPath; - } - return newPath; - }; - Eval.prototype.normalizePath = function (path) { - var segments = path.split('/').reverse(); - var segment; - path = []; - while (segments.length !== 0) { - segment = segments.pop(); - switch (segment) { - case '.': - break; - case '..': - if ((path.length === 0) || (path[path.length - 1] === '..')) { - path.push(segment); - } - else { - path.pop(); - } - break; - default: - path.push(segment); - break; - } - } - return path.join('/'); - }; - return Eval; -}()); -//# sourceMappingURL=contexts.js.map \ No newline at end of file diff --git a/packages/less/lib/less/contexts.js.map b/packages/less/lib/less/contexts.js.map deleted file mode 100644 index 5d0a3dbbe..000000000 --- a/packages/less/lib/less/contexts.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contexts.js","sourceRoot":"","sources":["../../src/less/contexts.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,kBAAe,QAAQ,CAAC;AACxB,qDAAyC;AAEzC,IAAM,gBAAgB,GAAG,SAAS,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,gBAAgB;IACtF,IAAI,CAAC,QAAQ,EAAE;QAAE,OAAO;KAAE;IAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC9C,IAAI,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE;YAC9C,W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I,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE;wBACzD,IAAI,CAAC,IAAI,CAAE,OAAO,CAAE,CAAC;qBACxB;yBAAM;wBACH,IAAI,CAAC,GAAG,EAAE,CAAC;qBACd;oBACD,MAAM;gBACV;oBACI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACnB,MAAM;aACb;SACJ;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IACL,WAAC;AAAD,CAAC,AAnGe,GAmGf,CAAA","sourcesContent":["const contexts = {};\nexport default contexts;\nimport * as Constants from './constants';\n\nconst copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) {\n if (!original) { return; }\n\n for (let i = 0; i < propertiesToCopy.length; i++) {\n if (original.hasOwnProperty(propertiesToCopy[i])) {\n destination[propertiesToCopy[i]] = original[propertiesToCopy[i]];\n }\n }\n};\n\n/*\n parse is used whilst parsing\n */\nconst parseCopyProperties = [\n // options\n 'paths', // option - unmodified - paths to search for imports on\n 'rewriteUrls', // option - whether to adjust URL's to be relative\n 'rootpath', // option - rootpath to append to URL's\n 'strictImports', // option -\n 'insecure', // option - whether to allow imports from insecure ssl hosts\n 'dumpLineNumbers', // option - whether to dump line numbers\n 'compress', // option - whether to compress\n 'syncImport', // option - whether to import synchronously\n 'chunkInput', // option - whether to chunk input. more performant but causes parse issues.\n 'mime', // browser only - mime type for sheet import\n 'useFileCache', // browser only - whether to use the per file session cache\n // context\n 'processImports', // option & context - whether to process imports. if false then imports will not be imported.\n // Used by the import manager to stop multiple import visitors being created.\n 'pluginManager' // Used as the plugin manager for the session\n];\n\ncontexts.Parse = function(options) {\n copyFromOriginal(options, this, parseCopyProperties);\n\n if (typeof this.paths === 'string') { this.paths = [this.paths]; }\n};\n\nconst evalCopyProperties = [\n 'paths', // additional include paths\n 'compress', // whether to compress\n 'math', // whether math has to be within parenthesis\n 'strictUnits', // whether units need to evaluate correctly\n 'sourceMap', // whether to output a source map\n 'importMultiple', // whether we are currently importing multiple copies\n 'urlArgs', // whether to add args into url tokens\n 'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false\n 'pluginManager', // Used as the plugin manager for the session\n 'importantScope', // used to bubble up !important statements\n 'rewriteUrls' // option - whether to adjust URL's to be relative\n];\n\nfunction isPathRelative(path) {\n return !/^(?:[a-z-]+:|\\/|#)/i.test(path);\n}\n\nfunction isPathLocalRelative(path) {\n return path.charAt(0) === '.';\n}\n\ncontexts.Eval = class {\n constructor(options, frames) {\n copyFromOriginal(options, this, evalCopyProperties);\n\n if (typeof this.paths === 'string') { this.paths = [this.paths]; }\n\n this.frames = frames || [];\n this.importantScope = this.importantScope || [];\n this.inCalc = false;\n this.mathOn = true;\n }\n\n enterCalc() {\n if (!this.calcStack) {\n this.calcStack = [];\n }\n this.calcStack.push(true);\n this.inCalc = true;\n }\n\n exitCalc() {\n this.calcStack.pop();\n if (!this.calcStack.length) {\n this.inCalc = false;\n }\n }\n\n inParenthesis() {\n if (!this.parensStack) {\n this.parensStack = [];\n }\n this.parensStack.push(true);\n };\n\n outOfParenthesis() {\n this.parensStack.pop();\n };\n\n isMathOn(op) {\n if (!this.mathOn) {\n return false;\n }\n if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {\n return false;\n }\n if (this.math > Constants.Math.PARENS_DIVISION) {\n return this.parensStack && this.parensStack.length;\n }\n return true;\n }\n\n pathRequiresRewrite(path) {\n const isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;\n\n return isRelative(path);\n }\n\n rewritePath(path, rootpath) {\n let newPath;\n\n rootpath = rootpath || '';\n newPath = this.normalizePath(rootpath + path);\n\n // If a path was explicit relative and the rootpath was not an absolute path\n // we must ensure that the new path is also explicit relative.\n if (isPathLocalRelative(path) &&\n isPathRelative(rootpath) &&\n isPathLocalRelative(newPath) === false) {\n newPath = `./${newPath}`;\n }\n\n return newPath;\n }\n\n normalizePath(path) {\n const segments = path.split('/').reverse();\n let segment;\n\n path = [];\n while (segments.length !== 0) {\n segment = segments.pop();\n switch ( segment ) {\n case '.':\n break;\n case '..':\n if ((path.length === 0) || (path[path.length - 1] === '..')) {\n path.push( segment );\n } else {\n path.pop();\n }\n break;\n default:\n path.push(segment);\n break;\n }\n }\n\n return path.join('/');\n }\n}\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/data/colors.js b/packages/less/lib/less/data/colors.js deleted file mode 100644 index 16d5dc80d..000000000 --- a/packages/less/lib/less/data/colors.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - 'aliceblue': '#f0f8ff', - 'antiquewhite': '#faebd7', - 'aqua': '#00ffff', - 'aquamarine': '#7fffd4', - 'azure': '#f0ffff', - 'beige': '#f5f5dc', - 'bisque': '#ffe4c4', - 'black': '#000000', - 'blanchedalmond': '#ffebcd', - 'blue': '#0000ff', - 'blueviolet': '#8a2be2', - 'brown': '#a52a2a', - 'burlywood': '#deb887', - 'cadetblue': '#5f9ea0', - 'chartreuse': '#7fff00', - 'chocolate': '#d2691e', - 'coral': '#ff7f50', - 'cornflowerblue': '#6495ed', - 'cornsilk': '#fff8dc', - 'crimson': '#dc143c', - 'cyan': '#00ffff', - 'darkblue': '#00008b', - 'darkcyan': '#008b8b', - 'darkgoldenrod': '#b8860b', - 'darkgray': '#a9a9a9', - 'darkgrey': '#a9a9a9', - 'darkgreen': '#006400', - 'darkkhaki': '#bdb76b', - 'darkmagenta': '#8b008b', - 'darkolivegreen': '#556b2f', - 'darkorange': '#ff8c00', - 'darkorchid': '#9932cc', - 'darkred': '#8b0000', - 'darksalmon': '#e9967a', - 'darkseagreen': '#8fbc8f', - 'darkslateblue': '#483d8b', - 'darkslategray': '#2f4f4f', - 'darkslategrey': '#2f4f4f', - 'darkturquoise': '#00ced1', - 'darkviolet': '#9400d3', - 'deeppink': '#ff1493', - 'deepskyblue': '#00bfff', - 'dimgray': '#696969', - 'dimgrey': '#696969', - 'dodgerblue': '#1e90ff', - 'firebrick': '#b22222', - 'floralwhite': '#fffaf0', - 'forestgreen': '#228b22', - 'fuchsia': '#ff00ff', - 'gainsboro': '#dcdcdc', - 'ghostwhite': '#f8f8ff', - 'gold': '#ffd700', - 'goldenrod': '#daa520', - 'gray': '#808080', - 'grey': '#808080', - 'green': '#008000', - 'greenyellow': '#adff2f', - 'honeydew': '#f0fff0', - 'hotpink': '#ff69b4', - 'indianred': '#cd5c5c', - 'indigo': '#4b0082', - 'ivory': '#fffff0', - 'khaki': '#f0e68c', - 'lavender': '#e6e6fa', - 'lavenderblush': '#fff0f5', - 'lawngreen': '#7cfc00', - 'lemonchiffon': '#fffacd', - 'lightblue': '#add8e6', - 'lightcoral': '#f08080', - 'lightcyan': '#e0ffff', - 'lightgoldenrodyellow': '#fafad2', - 'lightgray': '#d3d3d3', - 'lightgrey': '#d3d3d3', - 'lightgreen': '#90ee90', - 'lightpink': '#ffb6c1', - 'lightsalmon': '#ffa07a', - 'lightseagreen': '#20b2aa', - 'lightskyblue': '#87cefa', - 'lightslategray': '#778899', - 'lightslategrey': '#778899', - 'lightsteelblue': '#b0c4de', - 'lightyellow': '#ffffe0', - 'lime': '#00ff00', - 'limegreen': '#32cd32', - 'linen': '#faf0e6', - 'magenta': '#ff00ff', - 'maroon': '#800000', - 'mediumaquamarine': '#66cdaa', - 'mediumblue': '#0000cd', - 'mediumorchid': '#ba55d3', - 'mediumpurple': '#9370d8', - 'mediumseagreen': '#3cb371', - 'mediumslateblue': '#7b68ee', - 'mediumspringgreen': '#00fa9a', - 'mediumturquoise': '#48d1cc', - 'mediumvioletred': '#c71585', - 'midnightblue': '#191970', - 'mintcream': '#f5fffa', - 'mistyrose': '#ffe4e1', - 'moccasin': '#ffe4b5', - 'navajowhite': '#ffdead', - 'navy': '#000080', - 'oldlace': '#fdf5e6', - 'olive': '#808000', - 'olivedrab': '#6b8e23', - 'orange': '#ffa500', - 'orangered': '#ff4500', - 'orchid': '#da70d6', - 'palegoldenrod': '#eee8aa', - 'palegreen': '#98fb98', - 'paleturquoise': '#afeeee', - 'palevioletred': '#d87093', - 'papayawhip': '#ffefd5', - 'peachpuff': '#ffdab9', - 'peru': '#cd853f', - 'pink': '#ffc0cb', - 'plum': '#dda0dd', - 'powderblue': '#b0e0e6', - 'purple': '#800080', - 'rebeccapurple': '#663399', - 'red': '#ff0000', - 'rosybrown': '#bc8f8f', - 'royalblue': '#4169e1', - 'saddlebrown': '#8b4513', - 'salmon': '#fa8072', - 'sandybrown': '#f4a460', - 'seagreen': '#2e8b57', - 'seashell': '#fff5ee', - 'sienna': '#a0522d', - 'silver': '#c0c0c0', - 'skyblue': '#87ceeb', - 'slateblue': '#6a5acd', - 'slategray': '#708090', - 'slategrey': '#708090', - 'snow': '#fffafa', - 'springgreen': '#00ff7f', - 'steelblue': '#4682b4', - 'tan': '#d2b48c', - 'teal': '#008080', - 'thistle': '#d8bfd8', - 'tomato': '#ff6347', - 'turquoise': '#40e0d0', - 'violet': '#ee82ee', - 'wheat': '#f5deb3', - 'white': '#ffffff', - 'whitesmoke': '#f5f5f5', - 'yellow': '#ffff00', - 'yellowgreen': '#9acd32' -}; -//# sourceMappingURL=colors.js.map \ No newline at end of file diff --git a/packages/less/lib/less/data/colors.js.map b/packages/less/lib/less/data/colors.js.map deleted file mode 100644 index 39d3cc01c..000000000 --- a/packages/less/lib/less/data/colors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../../src/less/data/colors.js"],"names":[],"mappings":";;AAAA,kBAAe;IACX,WAAW,EAAC,SAAS;IACrB,cAAc,EAAC,SAAS;IACxB,MAAM,EAAC,SAAS;IAChB,YAAY,EAAC,SAAS;IACtB,OAAO,EAAC,SAAS;IACjB,OAAO,EAAC,SAAS;IACj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,EAAC,SAAS;IACrB,QAAQ,EAAC,SAAS;IAClB,eAAe,EAAC,SAAS;IACzB,WAAW,EAAC,SAAS;IACrB,eAAe,EAAC,SAAS;IACzB,eAAe,EAAC,SAAS;IACzB,YAAY,EAAC,SAAS;IACtB,WAAW,EAAC,SAAS;IACrB,MAAM,EAAC,SAAS;IAChB,MAAM,EAAC,SAAS;IAChB,MAAM,EAAC,SAAS;IAChB,YAAY,EAAC,SAAS;IACtB,QAAQ,EAAC,SAAS;IAClB,eAAe,EAAC,SAAS;IACzB,KAAK,EAAC,SAAS;IACf,WAAW,EAAC,SAAS;IACrB,WAAW,EAAC,SAAS;IACrB,aAAa,EAAC,SAAS;IACvB,QAAQ,EAAC,SAAS;IAClB,YAAY,EAAC,SAAS;IACtB,UAAU,EAAC,SAAS;IACpB,UAAU,EAAC,SAAS;IACpB,QAAQ,EAAC,SAAS;IAClB,QAAQ,EAAC,SAAS;IAClB,SAAS,EAAC,SAAS;IACnB,WAAW,EAAC,SAAS;IACrB,WAAW,EAAC,SAAS;IACrB,WAAW,EAAC,SAAS;IACrB,MAAM,EAAC,SAAS;IAChB,aAAa,EAAC,SAAS;IACvB,WAAW,EAAC,SAAS;IACrB,KAAK,EAAC,SAAS;IACf,MAAM,EAAC,SAAS;IAChB,SAAS,EAAC,SAAS;IACnB,QAAQ,EAAC,SAAS;IAClB,WAAW,EAAC,SAAS;IACrB,QAAQ,EAAC,SAAS;IAClB,OAAO,EAAC,SAAS;IACjB,OAAO,EAAC,SAAS;IACjB,YAAY,EAAC,SAAS;IACtB,QAAQ,EAAC,SAAS;IAClB,aAAa,EAAC,SAAS;CAC1B,CAAC","sourcesContent":["export default {\n 'aliceblue':'#f0f8ff',\n 'antiquewhite':'#faebd7',\n 'aqua':'#00ffff',\n 'aquamarine':'#7fffd4',\n 'azure':'#f0ffff',\n 'beige':'#f5f5dc',\n 'bisque':'#ffe4c4',\n 'black':'#000000',\n 'blanchedalmond':'#ffebcd',\n 'blue':'#0000ff',\n 'blueviolet':'#8a2be2',\n 'brown':'#a52a2a',\n 'burlywood':'#deb887',\n 'cadetblue':'#5f9ea0',\n 'chartreuse':'#7fff00',\n 'chocolate':'#d2691e',\n 'coral':'#ff7f50',\n 'cornflowerblue':'#6495ed',\n 'cornsilk':'#fff8dc',\n 'crimson':'#dc143c',\n 'cyan':'#00ffff',\n 'darkblue':'#00008b',\n 'darkcyan':'#008b8b',\n 'darkgoldenrod':'#b8860b',\n 'darkgray':'#a9a9a9',\n 'darkgrey':'#a9a9a9',\n 'darkgreen':'#006400',\n 'darkkhaki':'#bdb76b',\n 'darkmagenta':'#8b008b',\n 'darkolivegreen':'#556b2f',\n 'darkorange':'#ff8c00',\n 'darkorchid':'#9932cc',\n 'darkred':'#8b0000',\n 'darksalmon':'#e9967a',\n 'darkseagreen':'#8fbc8f',\n 'darkslateblue':'#483d8b',\n 'darkslategray':'#2f4f4f',\n 'darkslategrey':'#2f4f4f',\n 'darkturquoise':'#00ced1',\n 'darkviolet':'#9400d3',\n 'deeppink':'#ff1493',\n 'deepskyblue':'#00bfff',\n 'dimgray':'#696969',\n 'dimgrey':'#696969',\n 'dodgerblue':'#1e90ff',\n 'firebrick':'#b22222',\n 'floralwhite':'#fffaf0',\n 'forestgreen':'#228b22',\n 'fuchsia':'#ff00ff',\n 'gainsboro':'#dcdcdc',\n 'ghostwhite':'#f8f8ff',\n 'gold':'#ffd700',\n 'goldenrod':'#daa520',\n 'gray':'#808080',\n 'grey':'#808080',\n 'green':'#008000',\n 'greenyellow':'#adff2f',\n 'honeydew':'#f0fff0',\n 'hotpink':'#ff69b4',\n 'indianred':'#cd5c5c',\n 'indigo':'#4b0082',\n 'ivory':'#fffff0',\n 'khaki':'#f0e68c',\n 'lavender':'#e6e6fa',\n 'lavenderblush':'#fff0f5',\n 'lawngreen':'#7cfc00',\n 'lemonchiffon':'#fffacd',\n 'lightblue':'#add8e6',\n 'lightcoral':'#f08080',\n 'lightcyan':'#e0ffff',\n 'lightgoldenrodyellow':'#fafad2',\n 'lightgray':'#d3d3d3',\n 'lightgrey':'#d3d3d3',\n 'lightgreen':'#90ee90',\n 'lightpink':'#ffb6c1',\n 'lightsalmon':'#ffa07a',\n 'lightseagreen':'#20b2aa',\n 'lightskyblue':'#87cefa',\n 'lightslategray':'#778899',\n 'lightslategrey':'#778899',\n 'lightsteelblue':'#b0c4de',\n 'lightyellow':'#ffffe0',\n 'lime':'#00ff00',\n 'limegreen':'#32cd32',\n 'linen':'#faf0e6',\n 'magenta':'#ff00ff',\n 'maroon':'#800000',\n 'mediumaquamarine':'#66cdaa',\n 'mediumblue':'#0000cd',\n 'mediumorchid':'#ba55d3',\n 'mediumpurple':'#9370d8',\n 'mediumseagreen':'#3cb371',\n 'mediumslateblue':'#7b68ee',\n 'mediumspringgreen':'#00fa9a',\n 'mediumturquoise':'#48d1cc',\n 'mediumvioletred':'#c71585',\n 'midnightblue':'#191970',\n 'mintcream':'#f5fffa',\n 'mistyrose':'#ffe4e1',\n 'moccasin':'#ffe4b5',\n 'navajowhite':'#ffdead',\n 'navy':'#000080',\n 'oldlace':'#fdf5e6',\n 'olive':'#808000',\n 'olivedrab':'#6b8e23',\n 'orange':'#ffa500',\n 'orangered':'#ff4500',\n 'orchid':'#da70d6',\n 'palegoldenrod':'#eee8aa',\n 'palegreen':'#98fb98',\n 'paleturquoise':'#afeeee',\n 'palevioletred':'#d87093',\n 'papayawhip':'#ffefd5',\n 'peachpuff':'#ffdab9',\n 'peru':'#cd853f',\n 'pink':'#ffc0cb',\n 'plum':'#dda0dd',\n 'powderblue':'#b0e0e6',\n 'purple':'#800080',\n 'rebeccapurple':'#663399',\n 'red':'#ff0000',\n 'rosybrown':'#bc8f8f',\n 'royalblue':'#4169e1',\n 'saddlebrown':'#8b4513',\n 'salmon':'#fa8072',\n 'sandybrown':'#f4a460',\n 'seagreen':'#2e8b57',\n 'seashell':'#fff5ee',\n 'sienna':'#a0522d',\n 'silver':'#c0c0c0',\n 'skyblue':'#87ceeb',\n 'slateblue':'#6a5acd',\n 'slategray':'#708090',\n 'slategrey':'#708090',\n 'snow':'#fffafa',\n 'springgreen':'#00ff7f',\n 'steelblue':'#4682b4',\n 'tan':'#d2b48c',\n 'teal':'#008080',\n 'thistle':'#d8bfd8',\n 'tomato':'#ff6347',\n 'turquoise':'#40e0d0',\n 'violet':'#ee82ee',\n 'wheat':'#f5deb3',\n 'white':'#ffffff',\n 'whitesmoke':'#f5f5f5',\n 'yellow':'#ffff00',\n 'yellowgreen':'#9acd32'\n};"]} \ No newline at end of file diff --git a/packages/less/lib/less/data/index.js b/packages/less/lib/less/data/index.js deleted file mode 100644 index edcd12c77..000000000 --- a/packages/less/lib/less/data/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var colors_1 = __importDefault(require("./colors")); -var unit_conversions_1 = __importDefault(require("./unit-conversions")); -exports.default = { colors: colors_1.default, unitConversions: unit_conversions_1.default }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/less/lib/less/data/index.js.map b/packages/less/lib/less/data/index.js.map deleted file mode 100644 index 1b4905255..000000000 --- a/packages/less/lib/less/data/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/less/data/index.js"],"names":[],"mappings":";;;;;AAAA,oDAA8B;AAC9B,wEAAiD;AAEjD,kBAAe,EAAE,MAAM,kBAAA,EAAE,eAAe,4BAAA,EAAE,CAAC","sourcesContent":["import colors from './colors';\nimport unitConversions from './unit-conversions';\n\nexport default { colors, unitConversions };\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/data/unit-conversions.js b/packages/less/lib/less/data/unit-conversions.js deleted file mode 100644 index edfb2c196..000000000 --- a/packages/less/lib/less/data/unit-conversions.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - length: { - 'm': 1, - 'cm': 0.01, - 'mm': 0.001, - 'in': 0.0254, - 'px': 0.0254 / 96, - 'pt': 0.0254 / 72, - 'pc': 0.0254 / 72 * 12 - }, - duration: { - 's': 1, - 'ms': 0.001 - }, - angle: { - 'rad': 1 / (2 * Math.PI), - 'deg': 1 / 360, - 'grad': 1 / 400, - 'turn': 1 - } -}; -//# sourceMappingURL=unit-conversions.js.map \ No newline at end of file diff --git a/packages/less/lib/less/data/unit-conversions.js.map b/packages/less/lib/less/data/unit-conversions.js.map deleted file mode 100644 index f413aa027..000000000 --- a/packages/less/lib/less/data/unit-conversions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unit-conversions.js","sourceRoot":"","sources":["../../../src/less/data/unit-conversions.js"],"names":[],"mappings":";;AAAA,kBAAe;IACX,MAAM,EAAE;QACJ,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM,GAAG,EAAE;QACjB,IAAI,EAAE,MAAM,GAAG,EAAE;QACjB,IAAI,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE;KACzB;IACD,QAAQ,EAAE;QACN,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,KAAK;KACd;IACD,KAAK,EAAE;QACH,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QACxB,KAAK,EAAE,CAAC,GAAG,GAAG;QACd,MAAM,EAAE,CAAC,GAAG,GAAG;QACf,MAAM,EAAE,CAAC;KACZ;CACJ,CAAC","sourcesContent":["export default {\n length: {\n 'm': 1,\n 'cm': 0.01,\n 'mm': 0.001,\n 'in': 0.0254,\n 'px': 0.0254 / 96,\n 'pt': 0.0254 / 72,\n 'pc': 0.0254 / 72 * 12\n },\n duration: {\n 's': 1,\n 'ms': 0.001\n },\n angle: {\n 'rad': 1 / (2 * Math.PI),\n 'deg': 1 / 360,\n 'grad': 1 / 400,\n 'turn': 1\n }\n};"]} \ No newline at end of file diff --git a/packages/less/lib/less/default-options.js b/packages/less/lib/less/default-options.js deleted file mode 100644 index f88f322f9..000000000 --- a/packages/less/lib/less/default-options.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// Export a new default each time -exports.default = (function () { return ({ - /* Inline Javascript - @plugin still allowed */ - javascriptEnabled: false, - /* Outputs a makefile import dependency list to stdout. */ - depends: false, - /* (DEPRECATED) Compress using less built-in compression. - * This does an okay job but does not utilise all the tricks of - * dedicated css compression. */ - compress: false, - /* Runs the less parser and just reports errors without any output. */ - lint: false, - /* Sets available include paths. - * If the file in an @import rule does not exist at that exact location, - * less will look for it at the location(s) passed to this option. - * You might use this for instance to specify a path to a library which - * you want to be referenced simply and relatively in the less files. */ - paths: [], - /* color output in the terminal */ - color: true, - /* The strictImports controls whether the compiler will allow an @import inside of either - * @media blocks or (a later addition) other selector blocks. - * See: https://github.com/less/less.js/issues/656 */ - strictImports: false, - /* Allow Imports from Insecure HTTPS Hosts */ - insecure: false, - /* Allows you to add a path to every generated import and url in your css. - * This does not affect less import statements that are processed, just ones - * that are left in the output css. */ - rootpath: '', - /* By default URLs are kept as-is, so if you import a file in a sub-directory - * that references an image, exactly the same URL will be output in the css. - * This option allows you to re-write URL's in imported files so that the - * URL is always relative to the base imported file */ - rewriteUrls: false, - /* How to process math - * 0 always - eagerly try to solve all operations - * 1 parens-division - require parens for division "/" - * 2 parens | strict - require parens for all operations - * 3 strict-legacy - legacy strict behavior (super-strict) - */ - math: 0, - /* Without this option, less attempts to guess at the output unit when it does maths. */ - strictUnits: false, - /* Effectively the declaration is put at the top of your base Less file, - * meaning it can be used but it also can be overridden if this variable - * is defined in the file. */ - globalVars: null, - /* As opposed to the global variable option, this puts the declaration at the - * end of your base file, meaning it will override anything defined in your Less file. */ - modifyVars: null, - /* This option allows you to specify a argument to go on to every URL. */ - urlArgs: '' -}); }); -//# sourceMappingURL=default-options.js.map \ No newline at end of file diff --git a/packages/less/lib/less/default-options.js.map b/packages/less/lib/less/default-options.js.map deleted file mode 100644 index acb24072c..000000000 --- a/packages/less/lib/less/default-options.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default-options.js","sourceRoot":"","sources":["../../src/less/default-options.js"],"names":[],"mappings":";;AAAA,iCAAiC;AACjC,mBAAe,cAAM,OAAA,CAAC;IAClB,+CAA+C;IAC/C,iBAAiB,EAAE,KAAK;IAExB,0DAA0D;IAC1D,OAAO,EAAE,KAAK;IAEd;;iCAE6B;IAC7B,QAAQ,EAAE,KAAK;IAEf,sEAAsE;IACtE,IAAI,EAAE,KAAK;IAEX;;;;yEAIqE;IACrE,KAAK,EAAE,EAAE;IAET,kCAAkC;IAClC,KAAK,EAAE,IAAI;IAEX;;sDAEkD;IAClD,aAAa,EAAE,KAAK;IAEpB,6CAA6C;IAC7C,QAAQ,EAAE,KAAK;IAEf;;uCAEmC;IACnC,QAAQ,EAAE,EAAE;IAEZ;;;uDAGmD;IACnD,WAAW,EAAE,KAAK;IAElB;;;;;IAKA;IACA,IAAI,EAAE,CAAC;IAEP,wFAAwF;IACxF,WAAW,EAAE,KAAK;IAElB;;8BAE0B;IAC1B,UAAU,EAAE,IAAI;IAEhB;0FACsF;IACtF,UAAU,EAAE,IAAI;IAEhB,0EAA0E;IAC1E,OAAO,EAAE,EAAE;CACd,CAAC,EAlEmB,CAkEnB,EAAC","sourcesContent":["// Export a new default each time\nexport default () => ({\n /* Inline Javascript - @plugin still allowed */\n javascriptEnabled: false,\n\n /* Outputs a makefile import dependency list to stdout. */\n depends: false,\n\n /* (DEPRECATED) Compress using less built-in compression. \n * This does an okay job but does not utilise all the tricks of \n * dedicated css compression. */\n compress: false,\n\n /* Runs the less parser and just reports errors without any output. */\n lint: false,\n\n /* Sets available include paths.\n * If the file in an @import rule does not exist at that exact location, \n * less will look for it at the location(s) passed to this option. \n * You might use this for instance to specify a path to a library which \n * you want to be referenced simply and relatively in the less files. */\n paths: [],\n\n /* color output in the terminal */\n color: true,\n\n /* The strictImports controls whether the compiler will allow an @import inside of either \n * @media blocks or (a later addition) other selector blocks.\n * See: https://github.com/less/less.js/issues/656 */\n strictImports: false,\n\n /* Allow Imports from Insecure HTTPS Hosts */\n insecure: false,\n\n /* Allows you to add a path to every generated import and url in your css. \n * This does not affect less import statements that are processed, just ones \n * that are left in the output css. */\n rootpath: '',\n\n /* By default URLs are kept as-is, so if you import a file in a sub-directory \n * that references an image, exactly the same URL will be output in the css. \n * This option allows you to re-write URL's in imported files so that the \n * URL is always relative to the base imported file */\n rewriteUrls: false,\n\n /* How to process math \n * 0 always - eagerly try to solve all operations\n * 1 parens-division - require parens for division \"/\"\n * 2 parens | strict - require parens for all operations\n * 3 strict-legacy - legacy strict behavior (super-strict)\n */\n math: 0,\n\n /* Without this option, less attempts to guess at the output unit when it does maths. */\n strictUnits: false,\n\n /* Effectively the declaration is put at the top of your base Less file, \n * meaning it can be used but it also can be overridden if this variable \n * is defined in the file. */\n globalVars: null,\n\n /* As opposed to the global variable option, this puts the declaration at the\n * end of your base file, meaning it will override anything defined in your Less file. */\n modifyVars: null,\n\n /* This option allows you to specify a argument to go on to every URL. */\n urlArgs: ''\n});"]} \ No newline at end of file diff --git a/packages/less/lib/less/environment/abstract-file-manager.js b/packages/less/lib/less/environment/abstract-file-manager.js deleted file mode 100644 index ac76b731b..000000000 --- a/packages/less/lib/less/environment/abstract-file-manager.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var AbstractFileManager = /** @class */ (function () { - function AbstractFileManager() { - } - AbstractFileManager.prototype.getPath = function (filename) { - var j = filename.lastIndexOf('?'); - if (j > 0) { - filename = filename.slice(0, j); - } - j = filename.lastIndexOf('/'); - if (j < 0) { - j = filename.lastIndexOf('\\'); - } - if (j < 0) { - return ''; - } - return filename.slice(0, j + 1); - }; - AbstractFileManager.prototype.tryAppendExtension = function (path, ext) { - return /(\.[a-z]*$)|([\?;].*)$/.test(path) ? path : path + ext; - }; - AbstractFileManager.prototype.tryAppendLessExtension = function (path) { - return this.tryAppendExtension(path, '.less'); - }; - ; - AbstractFileManager.prototype.supportsSync = function () { return false; }; - AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () { return false; }; - AbstractFileManager.prototype.isPathAbsolute = function (filename) { - return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); - }; - // TODO: pull out / replace? - AbstractFileManager.prototype.join = function (basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return basePath + laterPath; - }; - ; - AbstractFileManager.prototype.pathDiff = function (url, baseUrl) { - // diff between two paths to create a relative path - var urlParts = this.extractUrlParts(url); - var baseUrlParts = this.extractUrlParts(baseUrl); - var i; - var max; - var urlDirectories; - var baseUrlDirectories; - var diff = ''; - if (urlParts.hostPart !== baseUrlParts.hostPart) { - return ''; - } - max = Math.max(baseUrlParts.directories.length, urlParts.directories.length); - for (i = 0; i < max; i++) { - if (baseUrlParts.directories[i] !== urlParts.directories[i]) { - break; - } - } - baseUrlDirectories = baseUrlParts.directories.slice(i); - urlDirectories = urlParts.directories.slice(i); - for (i = 0; i < baseUrlDirectories.length - 1; i++) { - diff += '../'; - } - for (i = 0; i < urlDirectories.length - 1; i++) { - diff += urlDirectories[i] + "/"; - } - return diff; - }; - ; - // helper function, not part of API - AbstractFileManager.prototype.extractUrlParts = function (url, baseUrl) { - // urlParts[1] = protocol://hostname/ OR / - // urlParts[2] = / if path relative to host base - // urlParts[3] = directories - // urlParts[4] = filename - // urlParts[5] = parameters - var urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i; - var urlParts = url.match(urlPartsRegex); - var returner = {}; - var rawDirectories = []; - var directories = []; - var i; - var baseUrlParts; - if (!urlParts) { - throw new Error("Could not parse sheet href - '" + url + "'"); - } - // Stylesheets in IE don't always return the full path - if (baseUrl && (!urlParts[1] || urlParts[2])) { - baseUrlParts = baseUrl.match(urlPartsRegex); - if (!baseUrlParts) { - throw new Error("Could not parse page url - '" + baseUrl + "'"); - } - urlParts[1] = urlParts[1] || baseUrlParts[1] || ''; - if (!urlParts[2]) { - urlParts[3] = baseUrlParts[3] + urlParts[3]; - } - } - if (urlParts[3]) { - rawDirectories = urlParts[3].replace(/\\/g, '/').split('/'); - // collapse '..' and skip '.' - for (i = 0; i < rawDirectories.length; i++) { - if (rawDirectories[i] === '..') { - directories.pop(); - } - else if (rawDirectories[i] !== '.') { - directories.push(rawDirectories[i]); - } - } - } - returner.hostPart = urlParts[1]; - returner.directories = directories; - returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/'); - returner.path = (urlParts[1] || '') + directories.join('/'); - returner.filename = urlParts[4]; - returner.fileUrl = returner.path + (urlParts[4] || ''); - returner.url = returner.fileUrl + (urlParts[5] || ''); - return returner; - }; - ; - return AbstractFileManager; -}()); -exports.default = AbstractFileManager; -//# sourceMappingURL=abstract-file-manager.js.map \ No newline at end of file diff --git a/packages/less/lib/less/environment/abstract-file-manager.js.map b/packages/less/lib/less/environment/abstract-file-manager.js.map deleted file mode 100644 index c08ebfb99..000000000 --- a/packages/less/lib/less/environment/abstract-file-manager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-file-manager.js","sourceRoot":"","sources":["../../../src/less/environment/abstract-file-manager.js"],"names":[],"mappings":";;AAAA;IAAA;IA4HA,CAAC;IA3HG,qCAAO,GAAP,UAAQ,QAAQ;QACZ,IAAI,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,GAAG,CAAC,EAAE;YACP,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACnC;QACD,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CA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oBAChC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;iBACvC;aAEJ;SACJ;QAED,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;QACnC,QAAQ,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClE,QAAQ,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5D,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACvD,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACtD,OAAO,QAAQ,CAAC;IACpB,CAAC;IAAA,CAAC;IACN,0BAAC;AAAD,CAAC,AA5HD,IA4HC;AAED,kBAAe,mBAAmB,CAAC","sourcesContent":["class AbstractFileManager {\n getPath(filename) {\n let j = filename.lastIndexOf('?');\n if (j > 0) {\n filename = filename.slice(0, j);\n }\n j = filename.lastIndexOf('/');\n if (j < 0) {\n j = filename.lastIndexOf('\\\\');\n }\n if (j < 0) {\n return '';\n }\n return filename.slice(0, j + 1);\n }\n\n tryAppendExtension(path, ext) {\n return /(\\.[a-z]*$)|([\\?;].*)$/.test(path) ? path : path + ext;\n }\n\n tryAppendLessExtension(path) {\n return this.tryAppendExtension(path, '.less');\n };\n\n supportsSync() { return false; }\n\n alwaysMakePathsAbsolute() { return false; }\n\n isPathAbsolute(filename) {\n return (/^(?:[a-z-]+:|\\/|\\\\|#)/i).test(filename);\n }\n // TODO: pull out / replace?\n join(basePath, laterPath) {\n if (!basePath) {\n return laterPath;\n }\n return basePath + laterPath;\n };\n\n pathDiff(url, baseUrl) {\n // diff between two paths to create a relative path\n const urlParts = this.extractUrlParts(url);\n const baseUrlParts = this.extractUrlParts(baseUrl);\n\n let i;\n let max;\n let urlDirectories;\n let baseUrlDirectories;\n let diff = '';\n if (urlParts.hostPart !== baseUrlParts.hostPart) {\n return '';\n }\n max = Math.max(baseUrlParts.directories.length, urlParts.directories.length);\n for (i = 0; i < max; i++) {\n if (baseUrlParts.directories[i] !== urlParts.directories[i]) { break; }\n }\n baseUrlDirectories = baseUrlParts.directories.slice(i);\n urlDirectories = urlParts.directories.slice(i);\n for (i = 0; i < baseUrlDirectories.length - 1; i++) {\n diff += '../';\n }\n for (i = 0; i < urlDirectories.length - 1; i++) {\n diff += `${urlDirectories[i]}/`;\n }\n return diff;\n };\n // helper function, not part of API\n extractUrlParts(url, baseUrl) {\n // urlParts[1] = protocol://hostname/ OR /\n // urlParts[2] = / if path relative to host base\n // urlParts[3] = directories\n // urlParts[4] = filename\n // urlParts[5] = parameters\n\n const urlPartsRegex = /^((?:[a-z-]+:)?\\/{2}(?:[^\\/\\?#]*\\/)|([\\/\\\\]))?((?:[^\\/\\\\\\?#]*[\\/\\\\])*)([^\\/\\\\\\?#]*)([#\\?].*)?$/i;\n\n const urlParts = url.match(urlPartsRegex);\n const returner = {};\n let rawDirectories = [];\n const directories = [];\n let i;\n let baseUrlParts;\n\n if (!urlParts) {\n throw new Error(`Could not parse sheet href - '${url}'`);\n }\n\n // Stylesheets in IE don't always return the full path\n if (baseUrl && (!urlParts[1] || urlParts[2])) {\n baseUrlParts = baseUrl.match(urlPartsRegex);\n if (!baseUrlParts) {\n throw new Error(`Could not parse page url - '${baseUrl}'`);\n }\n urlParts[1] = urlParts[1] || baseUrlParts[1] || '';\n if (!urlParts[2]) {\n urlParts[3] = baseUrlParts[3] + urlParts[3];\n }\n }\n\n if (urlParts[3]) {\n rawDirectories = urlParts[3].replace(/\\\\/g, '/').split('/');\n\n // collapse '..' and skip '.'\n for (i = 0; i < rawDirectories.length; i++) {\n\n if (rawDirectories[i] === '..') {\n directories.pop();\n }\n else if (rawDirectories[i] !== '.') {\n directories.push(rawDirectories[i]);\n }\n \n }\n }\n\n returner.hostPart = urlParts[1];\n returner.directories = directories;\n returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/');\n returner.path = (urlParts[1] || '') + directories.join('/');\n returner.filename = urlParts[4];\n returner.fileUrl = returner.path + (urlParts[4] || '');\n returner.url = returner.fileUrl + (urlParts[5] || '');\n return returner;\n };\n}\n\nexport default AbstractFileManager;"]} \ No newline at end of file diff --git a/packages/less/lib/less/environment/abstract-plugin-loader.js b/packages/less/lib/less/environment/abstract-plugin-loader.js deleted file mode 100644 index 5aa2939e1..000000000 --- a/packages/less/lib/less/environment/abstract-plugin-loader.js +++ /dev/null @@ -1,168 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var function_registry_1 = __importDefault(require("../functions/function-registry")); -var less_error_1 = __importDefault(require("../less-error")); -var AbstractPluginLoader = /** @class */ (function () { - function AbstractPluginLoader() { - // Implemented by Node.js plugin loader - this.require = function () { return null; }; - } - AbstractPluginLoader.prototype.evalPlugin = function (contents, context, imports, pluginOptions, fileInfo) { - var loader; - var registry; - var pluginObj; - var localModule; - var pluginManager; - var filename; - var result; - pluginManager = context.pluginManager; - if (fileInfo) { - if (typeof fileInfo === 'string') { - filename = fileInfo; - } - else { - filename = fileInfo.filename; - } - } - var shortname = (new this.less.FileManager()).extractUrlParts(filename).filename; - if (filename) { - pluginObj = pluginManager.get(filename); - if (pluginObj) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new less_error_1.default(e, imports, filename); - } - return pluginObj; - } - } - localModule = { - exports: {}, - pluginManager: pluginManager, - fileInfo: fileInfo - }; - registry = function_registry_1.default.create(); - var registerPlugin = function (obj) { - pluginObj = obj; - }; - try { - loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents); - loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo); - } - catch (e) { - return new less_error_1.default(e, imports, filename); - } - if (!pluginObj) { - pluginObj = localModule.exports; - } - pluginObj = this.validatePlugin(pluginObj, filename, shortname); - if (pluginObj instanceof less_error_1.default) { - return pluginObj; - } - if (pluginObj) { - pluginObj.imports = imports; - pluginObj.filename = filename; - // For < 3.x (or unspecified minVersion) - setOptions() before install() - if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - } - // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); - pluginObj.functions = registry.getLocalFunctions(); - // Need to call setOptions again because the pluginObj might have functions - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - // Run every @plugin call - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new less_error_1.default(e, imports, filename); - } - } - else { - return new less_error_1.default({ message: 'Not a valid plugin' }, imports, filename); - } - return pluginObj; - }; - AbstractPluginLoader.prototype.trySetOptions = function (plugin, filename, name, options) { - if (options && !plugin.setOptions) { - return new less_error_1.default({ - message: "Options have been provided but the plugin " + name + " does not support any options." - }); - } - try { - plugin.setOptions && plugin.setOptions(options); - } - catch (e) { - return new less_error_1.default(e); - } - }; - AbstractPluginLoader.prototype.validatePlugin = function (plugin, filename, name) { - if (plugin) { - // support plugins being a function - // so that the plugin can be more usable programmatically - if (typeof plugin === 'function') { - plugin = new plugin(); - } - if (plugin.minVersion) { - if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { - return new less_error_1.default({ - message: "Plugin " + name + " requires version " + this.versionToString(plugin.minVersion) - }); - } - } - return plugin; - } - return null; - }; - AbstractPluginLoader.prototype.compareVersion = function (aVersion, bVersion) { - if (typeof aVersion === 'string') { - aVersion = aVersion.match(/^(\d+)\.?(\d+)?\.?(\d+)?/); - aVersion.shift(); - } - for (var i = 0; i < aVersion.length; i++) { - if (aVersion[i] !== bVersion[i]) { - return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1; - } - } - return 0; - }; - AbstractPluginLoader.prototype.versionToString = function (version) { - var versionString = ''; - for (var i = 0; i < version.length; i++) { - versionString += (versionString ? '.' : '') + version[i]; - } - return versionString; - }; - AbstractPluginLoader.prototype.printUsage = function (plugins) { - for (var i = 0; i < plugins.length; i++) { - var plugin = plugins[i]; - if (plugin.printUsage) { - plugin.printUsage(); - } - } - }; - return AbstractPluginLoader; -}()); -exports.default = AbstractPluginLoader; -//# sourceMappingURL=abstract-plugin-loader.js.map \ No newline at end of file diff --git a/packages/less/lib/less/environment/abstract-plugin-loader.js.map b/packages/less/lib/less/environment/abstract-plugin-loader.js.map deleted file mode 100644 index 634ebe189..000000000 --- a/packages/less/lib/less/environment/abstract-plugin-loader.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"abstract-plugin-loader.js","sourceRoot":"","sources":["../../../src/less/environment/abstract-plugin-loader.js"],"names":[],"mappings":";;;;;AAAA,qFAA8D;AAC9D,6DAAsC;AAEtC;IACI;QACI,uCAAuC;QACvC,IAAI,CAAC,OAAO,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAA;IAC7B,CAAC;IAED,yCAAU,GAAV,UAAW,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ;QAC1D,IAAI,MAAM,CAAC;QACX,IAAI,QAAQ,CA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E;YACrC,aAAa,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SAC5D;QACD,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,yCAAU,GAAV,UAAW,OAAO;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,IAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,MAAM,CAAC,UAAU,EAAE;gBACnB,MAAM,CAAC,UAAU,EAAE,CAAC;aACvB;SACJ;IACL,CAAC;IACL,2BAAC;AAAD,CAAC,AApLD,IAoLC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import functionRegistry from '../functions/function-registry';\nimport LessError from '../less-error';\n\nclass AbstractPluginLoader {\n constructor() {\n // Implemented by Node.js plugin loader\n this.require = () => null\n }\n\n evalPlugin(contents, context, imports, pluginOptions, fileInfo) {\n let loader;\n let registry;\n let pluginObj;\n let localModule;\n let pluginManager;\n let filename;\n let result;\n\n pluginManager = context.pluginManager;\n\n if (fileInfo) {\n if (typeof fileInfo === 'string') {\n filename = fileInfo;\n }\n else {\n filename = fileInfo.filename;\n }\n }\n const shortname = (new this.less.FileManager()).extractUrlParts(filename).filename;\n\n if (filename) {\n pluginObj = pluginManager.get(filename);\n\n if (pluginObj) {\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n if (result) {\n return result;\n }\n try {\n if (pluginObj.use) {\n pluginObj.use.call(this.context, pluginObj);\n }\n }\n catch (e) {\n e.message = e.message || 'Error during @plugin call';\n return new LessError(e, imports, filename);\n }\n return pluginObj;\n }\n }\n localModule = {\n exports: {},\n pluginManager,\n fileInfo\n };\n registry = functionRegistry.create();\n\n const registerPlugin = obj => {\n pluginObj = obj;\n };\n\n try {\n loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents);\n loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo);\n }\n catch (e) {\n return new LessError(e, imports, filename);\n }\n\n if (!pluginObj) {\n pluginObj = localModule.exports;\n }\n pluginObj = this.validatePlugin(pluginObj, filename, shortname);\n\n if (pluginObj instanceof LessError) {\n return pluginObj;\n }\n\n if (pluginObj) {\n pluginObj.imports = imports;\n pluginObj.filename = filename;\n\n // For < 3.x (or unspecified minVersion) - setOptions() before install()\n if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) {\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n\n if (result) {\n return result;\n }\n }\n\n // Run on first load\n pluginManager.addPlugin(pluginObj, fileInfo.filename, registry);\n pluginObj.functions = registry.getLocalFunctions();\n\n // Need to call setOptions again because the pluginObj might have functions\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n if (result) {\n return result;\n }\n\n // Run every @plugin call\n try {\n if (pluginObj.use) {\n pluginObj.use.call(this.context, pluginObj);\n }\n }\n catch (e) {\n e.message = e.message || 'Error during @plugin call';\n return new LessError(e, imports, filename);\n }\n\n }\n else {\n return new LessError({ message: 'Not a valid plugin' }, imports, filename);\n }\n\n return pluginObj;\n }\n\n trySetOptions(plugin, filename, name, options) {\n if (options && !plugin.setOptions) {\n return new LessError({\n message: `Options have been provided but the plugin ${name} does not support any options.`\n });\n }\n try {\n plugin.setOptions && plugin.setOptions(options);\n }\n catch (e) {\n return new LessError(e);\n }\n }\n\n validatePlugin(plugin, filename, name) {\n if (plugin) {\n // support plugins being a function\n // so that the plugin can be more usable programmatically\n if (typeof plugin === 'function') {\n plugin = new plugin();\n }\n\n if (plugin.minVersion) {\n if (this.compareVersion(plugin.minVersion, this.less.version) < 0) {\n return new LessError({\n message: `Plugin ${name} requires version ${this.versionToString(plugin.minVersion)}`\n });\n }\n }\n return plugin;\n }\n return null;\n }\n\n compareVersion(aVersion, bVersion) {\n if (typeof aVersion === 'string') {\n aVersion = aVersion.match(/^(\\d+)\\.?(\\d+)?\\.?(\\d+)?/);\n aVersion.shift();\n }\n for (let i = 0; i < aVersion.length; i++) {\n if (aVersion[i] !== bVersion[i]) {\n return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1;\n }\n }\n return 0;\n }\n\n versionToString(version) {\n let versionString = '';\n for (let i = 0; i < version.length; i++) {\n versionString += (versionString ? '.' : '') + version[i];\n }\n return versionString;\n }\n\n printUsage(plugins) {\n for (let i = 0; i < plugins.length; i++) {\n const plugin = plugins[i];\n if (plugin.printUsage) {\n plugin.printUsage();\n }\n }\n }\n}\n\nexport default AbstractPluginLoader;\n\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/environment/environment-api.js b/packages/less/lib/less/environment/environment-api.js deleted file mode 100644 index ea555ddf1..000000000 --- a/packages/less/lib/less/environment/environment-api.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - /** - * Converts a string to a base 64 string - * @param str - */ - encodeBase64: function (str) { - }, - /** - * Lookup the mime-type of a filename - * @param filename - */ - mimeLookup: function (filename) { - }, - /** - * Look up the charset of a mime type - * @param mime - */ - charsetLookup: function (mime) { - }, - /** - * Gets a source map generator - */ - getSourceMapGenerator: function getSourceMapGenerator() { - } -}; -//# sourceMappingURL=environment-api.js.map \ No newline at end of file diff --git a/packages/less/lib/less/environment/environment-api.js.map b/packages/less/lib/less/environment/environment-api.js.map deleted file mode 100644 index 3d37d3550..000000000 --- a/packages/less/lib/less/environment/environment-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment-api.js","sourceRoot":"","sources":["../../../src/less/environment/environment-api.js"],"names":[],"mappings":";;AAAA,kBAAe;IACX;;;OAGG;IACH,YAAY,EAAE,UAAS,GAAG;IAC1B,CAAC;IACD;;;OAGG;IACH,UAAU,EAAE,UAAU,QAAQ;IAC9B,CAAC;IACD;;;OAGG;IACH,aAAa,EAAE,UAAU,IAAI;IAC7B,CAAC;IACD;;OAEG;IACH,qBAAqB,EAAE,SAAS,qBAAqB;IACrD,CAAC;CACJ,CAAC","sourcesContent":["export default {\n /**\n * Converts a string to a base 64 string\n * @param str\n */\n encodeBase64: function(str) {\n },\n /**\n * Lookup the mime-type of a filename\n * @param filename\n */\n mimeLookup: function (filename) {\n },\n /**\n * Look up the charset of a mime type\n * @param mime\n */\n charsetLookup: function (mime) {\n },\n /**\n * Gets a source map generator\n */\n getSourceMapGenerator: function getSourceMapGenerator() {\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/environment/environment.js b/packages/less/lib/less/environment/environment.js deleted file mode 100644 index ede5e96da..000000000 --- a/packages/less/lib/less/environment/environment.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -/** - * @todo Document why this abstraction exists, and the relationship between - * environment, file managers, and plugin manager - */ -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var logger_1 = __importDefault(require("../logger")); -var environment = /** @class */ (function () { - function environment(externalEnvironment, fileManagers) { - this.fileManagers = fileManagers || []; - externalEnvironment = externalEnvironment || {}; - var optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator']; - var requiredFunctions = []; - var functions = requiredFunctions.concat(optionalFunctions); - for (var i = 0; i < functions.length; i++) { - var propName = functions[i]; - var environmentFunc = externalEnvironment[propName]; - if (environmentFunc) { - this[propName] = environmentFunc.bind(externalEnvironment); - } - else if (i < requiredFunctions.length) { - this.warn("missing required function in environment - " + propName); - } - } - } - environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) { - if (!filename) { - logger_1.default.warn('getFileManager called with no filename.. Please report this issue. continuing.'); - } - if (currentDirectory == null) { - logger_1.default.warn('getFileManager called with null directory.. Please report this issue. continuing.'); - } - var fileManagers = this.fileManagers; - if (options.pluginManager) { - fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers()); - } - for (var i = fileManagers.length - 1; i >= 0; i--) { - var fileManager = fileManagers[i]; - if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) { - return fileManager; - } - } - return null; - }; - environment.prototype.addFileManager = function (fileManager) { - this.fileManagers.push(fileManager); - }; - environment.prototype.clearFileManagers = function () { - this.fileManagers = []; - }; - return environment; -}()); -exports.default = environment; -//# sourceMappingURL=environment.js.map \ No newline at end of file diff --git a/packages/less/lib/less/environment/environment.js.map b/packages/less/lib/less/environment/environment.js.map deleted file mode 100644 index 06a43efec..000000000 --- a/packages/less/lib/less/environment/environment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/less/environment/environment.js"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,qDAA+B;AAE/B;IACI,qBAAY,mBAAmB,EAAE,YAAY;QACzC,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,EAAE,CAAC;QACvC,mBAAmB,GAAG,mBAAmB,IAAI,EAAE,CAAC;QAEhD,IAAM,iBAAiB,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,uBAAuB,CAAC,CAAC;QACnG,IAAM,iBAAiB,GAAG,EAAE,CAAC;QAC7B,IAAM,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAE9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,IAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAM,eAAe,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YACtD,IAAI,eAAe,EAAE;gBACjB,IAAI,CAAC,QAAQ,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;aAC9D;iBAAM,IAAI,CAAC,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document why this abstraction exists, and the relationship between\n * environment, file managers, and plugin manager\n */\n\nimport logger from '../logger';\n\nclass environment {\n constructor(externalEnvironment, fileManagers) {\n this.fileManagers = fileManagers || [];\n externalEnvironment = externalEnvironment || {};\n\n const optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator'];\n const requiredFunctions = [];\n const functions = requiredFunctions.concat(optionalFunctions);\n\n for (let i = 0; i < functions.length; i++) {\n const propName = functions[i];\n const environmentFunc = externalEnvironment[propName];\n if (environmentFunc) {\n this[propName] = environmentFunc.bind(externalEnvironment);\n } else if (i < requiredFunctions.length) {\n this.warn(`missing required function in environment - ${propName}`);\n }\n }\n }\n\n getFileManager(filename, currentDirectory, options, environment, isSync) {\n\n if (!filename) {\n logger.warn('getFileManager called with no filename.. Please report this issue. continuing.');\n }\n if (currentDirectory == null) {\n logger.warn('getFileManager called with null directory.. Please report this issue. continuing.');\n }\n\n let fileManagers = this.fileManagers;\n if (options.pluginManager) {\n fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers());\n }\n for (let i = fileManagers.length - 1; i >= 0 ; i--) {\n const fileManager = fileManagers[i];\n if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) {\n return fileManager;\n }\n }\n return null;\n }\n\n addFileManager(fileManager) {\n this.fileManagers.push(fileManager);\n }\n\n clearFileManagers() {\n this.fileManagers = [];\n }\n}\n\nexport default environment;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/environment/file-manager-api.js b/packages/less/lib/less/environment/file-manager-api.js deleted file mode 100644 index 81183e4e8..000000000 --- a/packages/less/lib/less/environment/file-manager-api.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - /** - * Given the full path to a file, return the path component - * Provided by AbstractFileManager - * @param {string} filename - * @returns {string} - */ - getPath: function (filename) { - }, - /** - * Append a .less extension if appropriate. Only called if less thinks one could be added. - * Provided by AbstractFileManager - * @param filename - * @returns {string} - */ - tryAppendLessExtension: function (filename) { - }, - /** - * Whether the rootpath should be converted to be absolute. - * The browser ovverides this to return true because urls must be absolute. - * Provided by AbstractFileManager (returns false) - * @returns {bool} - */ - alwaysMakePathsAbsolute: function () { - }, - /** - * Returns whether a path is absolute - * Provided by AbstractFileManager - * @param {string} path - * @returns {bool} - */ - isPathAbsolute: function (path) { - }, - /** - * joins together 2 paths - * Provided by AbstractFileManager - * @param {string} basePath - * @param {string} laterPath - */ - join: function (basePath, laterPath) { - }, - /** - * Returns the difference between 2 paths - * E.g. url = a/ baseUrl = a/b/ returns ../ - * url = a/b/ baseUrl = a/ returns b/ - * Provided by AbstractFileManager - * @param {string} url - * @param {string} baseUrl - * @returns {string} - */ - pathDiff: function (url, baseUrl) { - }, - /** - * Returns whether this file manager supports this file for syncronous file retrieval - * If true is returned, loadFileSync will then be called with the file. - * Provided by AbstractFileManager (returns false) - * @param {string} filename - * @param {string} currentDirectory - * @param {object} options - * @param {less.environment.environment} environment - * @returns {bool} - */ - supportsSync: function (filename, currentDirectory, options, environment) { - }, - /** - * - * @param {string} filename - * @param {string} currentDirectory - * @param {object} options - * @param {less.environment.environment} environment - * @returns {bool} - */ - supports: function (filename, currentDirectory, options, environment) { - }, - /** - * Loads a file asynchronously. Expects a promise that either rejects with an error or fulfills with an - * object containing - * { filename: - full resolved path to file - * contents: - the contents of the file, as a string } - * - * @param {string} filename - * @param {string} currentDirectory - * @param {object} options - * @param {less.environment.environment} environment - * @returns {Promise} - */ - loadFile: function (filename, currentDirectory, options, environment) { - }, - /** - * Loads a file synchronously. Expects an immediate return with an object containing - * { error: - error object if an error occurs - * filename: - full resolved path to file - * contents: - the contents of the file, as a string } - * - * @param {string} filename - * @param {string} currentDirectory - * @param {object} options - * @param {less.environment.environment} environment - * @returns {object} should be an object containing error or contents and filename - */ - loadFileSync: function (filename, currentDirectory, options, environment) { - } -}; -//# sourceMappingURL=file-manager-api.js.map \ No newline at end of file diff --git a/packages/less/lib/less/environment/file-manager-api.js.map b/packages/less/lib/less/environment/file-manager-api.js.map deleted file mode 100644 index 77473813f..000000000 --- a/packages/less/lib/less/environment/file-manager-api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"file-manager-api.js","sourceRoot":"","sources":["../../../src/less/environment/file-manager-api.js"],"names":[],"mappings":";;AAAA,kBAAe;IACX;;;;;OAKG;IACH,OAAO,EAAE,UAAS,QAAQ;IAC1B,CAAC;IACD;;;;;OAKG;IACH,sBAAsB,EAAE,UAAS,QAAQ;IACzC,CAAC;IACD;;;;;OAKG;IACH,uBAAuB,EAAE;IACzB,CAAC;IACD;;;;;OAKG;IACH,cAAc,EAAE,UAAS,IAAI;IAC7B,CAAC;IACD;;;;;OAKG;IACH,IAAI,EAAE,UAAS,QAAQ,EAAE,SAAS;IAClC,CAAC;IACD;;;;;;;;OAQG;IACH,QAAQ,EAAE,UAAS,GAAG,EAAE,OAAO;IAC/B,CAAC;IACD;;;;;;;;;OASG;IACH,YAAY,EAAE,UAAS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW;IACvE,CAAC;IACD;;;;;;;OAOG;IACH,QAAQ,EAAE,UAAS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW;IACnE,CAAC;IACD;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE,UAAS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW;IACnE,CAAC;IACD;;;;;;;;;;;OAWG;IACH,YAAY,EAAE,UAAS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW;IACvE,CAAC;CACJ,CAAC","sourcesContent":["export default {\n /**\n * Given the full path to a file, return the path component\n * Provided by AbstractFileManager\n * @param {string} filename\n * @returns {string}\n */\n getPath: function(filename) {\n },\n /**\n * Append a .less extension if appropriate. Only called if less thinks one could be added.\n * Provided by AbstractFileManager\n * @param filename\n * @returns {string}\n */\n tryAppendLessExtension: function(filename) {\n },\n /**\n * Whether the rootpath should be converted to be absolute.\n * The browser ovverides this to return true because urls must be absolute.\n * Provided by AbstractFileManager (returns false)\n * @returns {bool}\n */\n alwaysMakePathsAbsolute: function() {\n },\n /**\n * Returns whether a path is absolute\n * Provided by AbstractFileManager\n * @param {string} path\n * @returns {bool}\n */\n isPathAbsolute: function(path) {\n },\n /**\n * joins together 2 paths\n * Provided by AbstractFileManager\n * @param {string} basePath\n * @param {string} laterPath\n */\n join: function(basePath, laterPath) {\n },\n /**\n * Returns the difference between 2 paths\n * E.g. url = a/ baseUrl = a/b/ returns ../\n * url = a/b/ baseUrl = a/ returns b/\n * Provided by AbstractFileManager\n * @param {string} url\n * @param {string} baseUrl\n * @returns {string}\n */\n pathDiff: function(url, baseUrl) {\n },\n /**\n * Returns whether this file manager supports this file for syncronous file retrieval\n * If true is returned, loadFileSync will then be called with the file.\n * Provided by AbstractFileManager (returns false)\n * @param {string} filename\n * @param {string} currentDirectory\n * @param {object} options\n * @param {less.environment.environment} environment\n * @returns {bool}\n */\n supportsSync: function(filename, currentDirectory, options, environment) {\n },\n /**\n *\n * @param {string} filename\n * @param {string} currentDirectory\n * @param {object} options\n * @param {less.environment.environment} environment\n * @returns {bool}\n */\n supports: function(filename, currentDirectory, options, environment) {\n },\n /**\n * Loads a file asynchronously. Expects a promise that either rejects with an error or fulfills with an\n * object containing\n * { filename: - full resolved path to file\n * contents: - the contents of the file, as a string }\n *\n * @param {string} filename\n * @param {string} currentDirectory\n * @param {object} options\n * @param {less.environment.environment} environment\n * @returns {Promise}\n */\n loadFile: function(filename, currentDirectory, options, environment) {\n },\n /**\n * Loads a file synchronously. Expects an immediate return with an object containing\n * { error: - error object if an error occurs\n * filename: - full resolved path to file\n * contents: - the contents of the file, as a string }\n *\n * @param {string} filename\n * @param {string} currentDirectory\n * @param {object} options\n * @param {less.environment.environment} environment\n * @returns {object} should be an object containing error or contents and filename\n */\n loadFileSync: function(filename, currentDirectory, options, environment) {\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/boolean.js b/packages/less/lib/less/functions/boolean.js deleted file mode 100644 index 4e8ba9ce7..000000000 --- a/packages/less/lib/less/functions/boolean.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var anonymous_1 = __importDefault(require("../tree/anonymous")); -var keyword_1 = __importDefault(require("../tree/keyword")); -function boolean(condition) { - return condition ? keyword_1.default.True : keyword_1.default.False; -} -function If(condition, trueValue, falseValue) { - return condition ? trueValue - : (falseValue || new anonymous_1.default); -} -exports.default = { boolean: boolean, 'if': If }; -//# sourceMappingURL=boolean.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/boolean.js.map b/packages/less/lib/less/functions/boolean.js.map deleted file mode 100644 index 12bc2c997..000000000 --- a/packages/less/lib/less/functions/boolean.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src/less/functions/boolean.js"],"names":[],"mappings":";;;;;AAAA,gEAA0C;AAC1C,4DAAsC;AAEtC,SAAS,OAAO,CAAC,SAAS;IACtB,OAAO,SAAS,CAAC,CAAC,CAAC,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAO,CAAC,KAAK,CAAC;AACpD,CAAC;AAED,SAAS,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU;IACxC,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS;QACxB,CAAC,CAAC,CAAC,UAAU,IAAI,IAAI,mBAAS,CAAC,CAAC;AACxC,CAAC;AAED,kBAAe,EAAE,OAAO,SAAA,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC","sourcesContent":["import Anonymous from '../tree/anonymous';\nimport Keyword from '../tree/keyword';\n\nfunction boolean(condition) {\n return condition ? Keyword.True : Keyword.False;\n}\n\nfunction If(condition, trueValue, falseValue) {\n return condition ? trueValue\n : (falseValue || new Anonymous);\n}\n\nexport default { boolean, 'if': If };\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/color-blending.js b/packages/less/lib/less/functions/color-blending.js deleted file mode 100644 index 32e5e1696..000000000 --- a/packages/less/lib/less/functions/color-blending.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var color_1 = __importDefault(require("../tree/color")); -// Color Blending -// ref: http://www.w3.org/TR/compositing-1 -function colorBlend(mode, color1, color2) { - var ab = color1.alpha; // result - var // backdrop - cb; - var as = color2.alpha; - var // source - cs; - var ar; - var cr; - var r = []; - ar = as + ab * (1 - as); - for (var i = 0; i < 3; i++) { - cb = color1.rgb[i] / 255; - cs = color2.rgb[i] / 255; - cr = mode(cb, cs); - if (ar) { - cr = (as * cs + ab * (cb - - as * (cb + cs - cr))) / ar; - } - r[i] = cr * 255; - } - return new color_1.default(r, ar); -} -var colorBlendModeFunctions = { - multiply: function (cb, cs) { - return cb * cs; - }, - screen: function (cb, cs) { - return cb + cs - cb * cs; - }, - overlay: function (cb, cs) { - cb *= 2; - return (cb <= 1) ? - colorBlendModeFunctions.multiply(cb, cs) : - colorBlendModeFunctions.screen(cb - 1, cs); - }, - softlight: function (cb, cs) { - var d = 1; - var e = cb; - if (cs > 0.5) { - e = 1; - d = (cb > 0.25) ? Math.sqrt(cb) - : ((16 * cb - 12) * cb + 4) * cb; - } - return cb - (1 - 2 * cs) * e * (d - cb); - }, - hardlight: function (cb, cs) { - return colorBlendModeFunctions.overlay(cs, cb); - }, - difference: function (cb, cs) { - return Math.abs(cb - cs); - }, - exclusion: function (cb, cs) { - return cb + cs - 2 * cb * cs; - }, - // non-w3c functions: - average: function (cb, cs) { - return (cb + cs) / 2; - }, - negation: function (cb, cs) { - return 1 - Math.abs(cb + cs - 1); - } -}; -for (var f in colorBlendModeFunctions) { - if (colorBlendModeFunctions.hasOwnProperty(f)) { - colorBlend[f] = colorBlend.bind(null, colorBlendModeFunctions[f]); - } -} -exports.default = colorBlend; -//# sourceMappingURL=color-blending.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/color-blending.js.map b/packages/less/lib/less/functions/color-blending.js.map deleted file mode 100644 index d7bd27f7c..000000000 --- a/packages/less/lib/less/functions/color-blending.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"color-blending.js","sourceRoot":"","sources":["../../../src/less/functions/color-blending.js"],"names":[],"mappings":";;;;;AAAA,wDAAkC;AAElC,iBAAiB;AACjB,0CAA0C;AAE1C,SAAS,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM;IACpC,IAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAQ,SAAS;IAEzC,IAAI,WAAW;IACX,EAAE,CAAC;IAEP,IAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAExB,IAAI,SAAS;IACT,EAAE,CAAC;IAEP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAM,CAAC,GAAG,EAAE,CAAC;IAEb,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACxB,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACzB,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACzB,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAClB,IAAI,EAAE,EAAE;YACJ,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;gBAClB,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,C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,EAAE,UAAS,EAAE,EAAE,EAAE;QACtB,OAAO,uBAAuB,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,UAAU,EAAE,UAAS,EAAE,EAAE,EAAE;QACvB,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,SAAS,EAAE,UAAS,EAAE,EAAE,EAAE;QACtB,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;IACjC,CAAC;IAED,qBAAqB;IACrB,OAAO,EAAE,UAAS,EAAE,EAAE,EAAE;QACpB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,QAAQ,EAAE,UAAS,EAAE,EAAE,EAAE;QACrB,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;CACJ,CAAC;AAEF,KAAK,IAAM,CAAC,IAAI,uBAAuB,EAAE;IACrC,IAAI,uBAAuB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;QAC3C,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;KACrE;CACJ;AAED,kBAAe,UAAU,CAAC","sourcesContent":["import Color from '../tree/color';\n\n// Color Blending\n// ref: http://www.w3.org/TR/compositing-1\n\nfunction colorBlend(mode, color1, color2) {\n const ab = color1.alpha; // result\n\n let // backdrop\n cb;\n\n const as = color2.alpha;\n\n let // source\n cs;\n\n let ar;\n let cr;\n const r = [];\n\n ar = as + ab * (1 - as);\n for (let i = 0; i < 3; i++) {\n cb = color1.rgb[i] / 255;\n cs = color2.rgb[i] / 255;\n cr = mode(cb, cs);\n if (ar) {\n cr = (as * cs + ab * (cb -\n as * (cb + cs - cr))) / ar;\n }\n r[i] = cr * 255;\n }\n\n return new Color(r, ar);\n}\n\nconst colorBlendModeFunctions = {\n multiply: function(cb, cs) {\n return cb * cs;\n },\n screen: function(cb, cs) {\n return cb + cs - cb * cs;\n },\n overlay: function(cb, cs) {\n cb *= 2;\n return (cb <= 1) ?\n colorBlendModeFunctions.multiply(cb, cs) :\n colorBlendModeFunctions.screen(cb - 1, cs);\n },\n softlight: function(cb, cs) {\n let d = 1;\n let e = cb;\n if (cs > 0.5) {\n e = 1;\n d = (cb > 0.25) ? Math.sqrt(cb)\n : ((16 * cb - 12) * cb + 4) * cb;\n }\n return cb - (1 - 2 * cs) * e * (d - cb);\n },\n hardlight: function(cb, cs) {\n return colorBlendModeFunctions.overlay(cs, cb);\n },\n difference: function(cb, cs) {\n return Math.abs(cb - cs);\n },\n exclusion: function(cb, cs) {\n return cb + cs - 2 * cb * cs;\n },\n\n // non-w3c functions:\n average: function(cb, cs) {\n return (cb + cs) / 2;\n },\n negation: function(cb, cs) {\n return 1 - Math.abs(cb + cs - 1);\n }\n};\n\nfor (const f in colorBlendModeFunctions) {\n if (colorBlendModeFunctions.hasOwnProperty(f)) {\n colorBlend[f] = colorBlend.bind(null, colorBlendModeFunctions[f]);\n }\n}\n\nexport default colorBlend;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/color.js b/packages/less/lib/less/functions/color.js deleted file mode 100644 index cb5ae8628..000000000 --- a/packages/less/lib/less/functions/color.js +++ /dev/null @@ -1,404 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var dimension_1 = __importDefault(require("../tree/dimension")); -var color_1 = __importDefault(require("../tree/color")); -var quoted_1 = __importDefault(require("../tree/quoted")); -var anonymous_1 = __importDefault(require("../tree/anonymous")); -var colorFunctions; -function clamp(val) { - return Math.min(1, Math.max(0, val)); -} -function hsla(origColor, hsl) { - var color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a); - if (color) { - if (origColor.value && - /^(rgb|hsl)/.test(origColor.value)) { - color.value = origColor.value; - } - else { - color.value = 'rgb'; - } - return color; - } -} -function toHSL(color) { - if (color.toHSL) { - return color.toHSL(); - } - else { - throw new Error('Argument cannot be evaluated to a color'); - } -} -function toHSV(color) { - if (color.toHSV) { - return color.toHSV(); - } - else { - throw new Error('Argument cannot be evaluated to a color'); - } -} -function number(n) { - if (n instanceof dimension_1.default) { - return parseFloat(n.unit.is('%') ? n.value / 100 : n.value); - } - else if (typeof n === 'number') { - return n; - } - else { - throw { - type: 'Argument', - message: 'color functions take numbers as parameters' - }; - } -} -function scaled(n, size) { - if (n instanceof dimension_1.default && n.unit.is('%')) { - return parseFloat(n.value * size / 100); - } - else { - return number(n); - } -} -colorFunctions = { - rgb: function (r, g, b) { - var color = colorFunctions.rgba(r, g, b, 1.0); - if (color) { - color.value = 'rgb'; - return color; - } - }, - rgba: function (r, g, b, a) { - try { - if (r instanceof color_1.default) { - if (g) { - a = number(g); - } - else { - a = r.alpha; - } - return new color_1.default(r.rgb, a, 'rgba'); - } - var rgb = [r, g, b].map(function (c) { return scaled(c, 255); }); - a = number(a); - return new color_1.default(rgb, a, 'rgba'); - } - catch (e) { } - }, - hsl: function (h, s, l) { - var color = colorFunctions.hsla(h, s, l, 1.0); - if (color) { - color.value = 'hsl'; - return color; - } - }, - hsla: function (h, s, l, a) { - try { - if (h instanceof color_1.default) { - if (s) { - a = number(s); - } - else { - a = h.alpha; - } - return new color_1.default(h.rgb, a, 'hsla'); - } - var m1_1; - var m2_1; - function hue(h) { - h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h); - if (h * 6 < 1) { - return m1_1 + (m2_1 - m1_1) * h * 6; - } - else if (h * 2 < 1) { - return m2_1; - } - else if (h * 3 < 2) { - return m1_1 + (m2_1 - m1_1) * (2 / 3 - h) * 6; - } - else { - return m1_1; - } - } - h = (number(h) % 360) / 360; - s = clamp(number(s)); - l = clamp(number(l)); - a = clamp(number(a)); - m2_1 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - m1_1 = l * 2 - m2_1; - var rgb = [ - hue(h + 1 / 3) * 255, - hue(h) * 255, - hue(h - 1 / 3) * 255 - ]; - a = number(a); - return new color_1.default(rgb, a, 'hsla'); - } - catch (e) { } - }, - hsv: function (h, s, v) { - return colorFunctions.hsva(h, s, v, 1.0); - }, - hsva: function (h, s, v, a) { - h = ((number(h) % 360) / 360) * 360; - s = number(s); - v = number(v); - a = number(a); - var i; - var f; - i = Math.floor((h / 60) % 6); - f = (h / 60) - i; - var vs = [v, - v * (1 - s), - v * (1 - f * s), - v * (1 - (1 - f) * s)]; - var perm = [[0, 3, 1], - [2, 0, 1], - [1, 0, 3], - [1, 2, 0], - [3, 1, 0], - [0, 1, 2]]; - return colorFunctions.rgba(vs[perm[i][0]] * 255, vs[perm[i][1]] * 255, vs[perm[i][2]] * 255, a); - }, - hue: function (color) { - return new dimension_1.default(toHSL(color).h); - }, - saturation: function (color) { - return new dimension_1.default(toHSL(color).s * 100, '%'); - }, - lightness: function (color) { - return new dimension_1.default(toHSL(color).l * 100, '%'); - }, - hsvhue: function (color) { - return new dimension_1.default(toHSV(color).h); - }, - hsvsaturation: function (color) { - return new dimension_1.default(toHSV(color).s * 100, '%'); - }, - hsvvalue: function (color) { - return new dimension_1.default(toHSV(color).v * 100, '%'); - }, - red: function (color) { - return new dimension_1.default(color.rgb[0]); - }, - green: function (color) { - return new dimension_1.default(color.rgb[1]); - }, - blue: function (color) { - return new dimension_1.default(color.rgb[2]); - }, - alpha: function (color) { - return new dimension_1.default(toHSL(color).a); - }, - luma: function (color) { - return new dimension_1.default(color.luma() * color.alpha * 100, '%'); - }, - luminance: function (color) { - var luminance = (0.2126 * color.rgb[0] / 255) + - (0.7152 * color.rgb[1] / 255) + - (0.0722 * color.rgb[2] / 255); - return new dimension_1.default(luminance * color.alpha * 100, '%'); - }, - saturate: function (color, amount, method) { - // filter: saturate(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s += hsl.s * amount.value / 100; - } - else { - hsl.s += amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - desaturate: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s -= hsl.s * amount.value / 100; - } - else { - hsl.s -= amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - lighten: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l += hsl.l * amount.value / 100; - } - else { - hsl.l += amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - darken: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l -= hsl.l * amount.value / 100; - } - else { - hsl.l -= amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - fadein: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a += hsl.a * amount.value / 100; - } - else { - hsl.a += amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fadeout: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a -= hsl.a * amount.value / 100; - } - else { - hsl.a -= amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fade: function (color, amount) { - var hsl = toHSL(color); - hsl.a = amount.value / 100; - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - spin: function (color, amount) { - var hsl = toHSL(color); - var hue = (hsl.h + amount.value) % 360; - hsl.h = hue < 0 ? 360 + hue : hue; - return hsla(color, hsl); - }, - // - // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein - // http://sass-lang.com - // - mix: function (color1, color2, weight) { - if (!weight) { - weight = new dimension_1.default(50); - } - var p = weight.value / 100.0; - var w = p * 2 - 1; - var a = toHSL(color1).a - toHSL(color2).a; - var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; - var w2 = 1 - w1; - var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2, - color1.rgb[1] * w1 + color2.rgb[1] * w2, - color1.rgb[2] * w1 + color2.rgb[2] * w2]; - var alpha = color1.alpha * p + color2.alpha * (1 - p); - return new color_1.default(rgb, alpha); - }, - greyscale: function (color) { - return colorFunctions.desaturate(color, new dimension_1.default(100)); - }, - contrast: function (color, dark, light, threshold) { - // filter: contrast(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - if (typeof light === 'undefined') { - light = colorFunctions.rgba(255, 255, 255, 1.0); - } - if (typeof dark === 'undefined') { - dark = colorFunctions.rgba(0, 0, 0, 1.0); - } - // Figure out which is actually light and dark: - if (dark.luma() > light.luma()) { - var t = light; - light = dark; - dark = t; - } - if (typeof threshold === 'undefined') { - threshold = 0.43; - } - else { - threshold = number(threshold); - } - if (color.luma() < threshold) { - return light; - } - else { - return dark; - } - }, - // Changes made in 2.7.0 - Reverted in 3.0.0 - // contrast: function (color, color1, color2, threshold) { - // // Return which of `color1` and `color2` has the greatest contrast with `color` - // // according to the standard WCAG contrast ratio calculation. - // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef - // // The threshold param is no longer used, in line with SASS. - // // filter: contrast(3.2); - // // should be kept as is, so check for color - // if (!color.rgb) { - // return null; - // } - // if (typeof color1 === 'undefined') { - // color1 = colorFunctions.rgba(0, 0, 0, 1.0); - // } - // if (typeof color2 === 'undefined') { - // color2 = colorFunctions.rgba(255, 255, 255, 1.0); - // } - // var contrast1, contrast2; - // var luma = color.luma(); - // var luma1 = color1.luma(); - // var luma2 = color2.luma(); - // // Calculate contrast ratios for each color - // if (luma > luma1) { - // contrast1 = (luma + 0.05) / (luma1 + 0.05); - // } else { - // contrast1 = (luma1 + 0.05) / (luma + 0.05); - // } - // if (luma > luma2) { - // contrast2 = (luma + 0.05) / (luma2 + 0.05); - // } else { - // contrast2 = (luma2 + 0.05) / (luma + 0.05); - // } - // if (contrast1 > contrast2) { - // return color1; - // } else { - // return color2; - // } - // }, - argb: function (color) { - return new anonymous_1.default(color.toARGB()); - }, - color: function (c) { - if ((c instanceof quoted_1.default) && - (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) { - var val = c.value.slice(1); - return new color_1.default(val, undefined, "#" + val); - } - if ((c instanceof color_1.default) || (c = color_1.default.fromKeyword(c.value))) { - c.value = undefined; - return c; - } - throw { - type: 'Argument', - message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF' - }; - }, - tint: function (color, amount) { - return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount); - }, - shade: function (color, amount) { - return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount); - } -}; -exports.default = colorFunctions; -//# sourceMappingURL=color.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/color.js.map b/packages/less/lib/less/functions/color.js.map deleted file mode 100644 index 01416a168..000000000 --- a/packages/less/lib/less/functions/color.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"color.js","sourceRoot":"","sources":["../../../src/less/functions/color.js"],"names":[],"mappings":";;;;;AAAA,gEAA0C;AAC1C,wDAAkC;AAClC,0DAAoC;AACpC,gEAA0C;AAC1C,IAAI,cAAc,CAAC;AAEnB,SAAS,KAAK,CAAC,GAAG;IACd,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AACD,SAAS,IAAI,CAAC,SAAS,EAAE,GAAG;IACxB,IAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,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C,KAAK,CAAC,CAAC,EAAE;YACxE,IAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC7B,OAAO,IAAI,eAAK,CAAC,GAAG,EAAE,SAAS,EAAE,MAAI,GAAK,CAAC,CAAC;SAC/C;QACD,IAAI,CAAC,CAAC,YAAY,eAAK,CAAC,IAAI,CAAC,CAAC,GAAG,eAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE;YAC1D,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC;YACpB,OAAO,CAAC,CAAC;SACZ;QACD,MAAM;YACF,IAAI,EAAK,UAAU;YACnB,OAAO,EAAE,iEAAiE;SAC7E,CAAC;IACN,CAAC;IACD,IAAI,EAAE,UAAS,KAAK,EAAE,MAAM;QACxB,OAAO,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChF,CAAC;IACD,KAAK,EAAE,UAAS,KAAK,EAAE,MAAM;QACzB,OAAO,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC;CACJ,CAAC;AAEF,kBAAe,cAAc,CAAC","sourcesContent":["import Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nlet colorFunctions;\n\nfunction clamp(val) {\n return Math.min(1, Math.max(0, val));\n}\nfunction hsla(origColor, hsl) {\n const color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a);\n if (color) {\n if (origColor.value && \n /^(rgb|hsl)/.test(origColor.value)) {\n color.value = origColor.value;\n } else {\n color.value = 'rgb';\n }\n return color;\n }\n}\nfunction toHSL(color) {\n if (color.toHSL) {\n return color.toHSL();\n } else {\n throw new Error('Argument cannot be evaluated to a color');\n }\n}\n\nfunction toHSV(color) {\n if (color.toHSV) {\n return color.toHSV();\n } else {\n throw new Error('Argument cannot be evaluated to a color');\n }\n}\n\nfunction number(n) {\n if (n instanceof Dimension) {\n return parseFloat(n.unit.is('%') ? n.value / 100 : n.value);\n } else if (typeof n === 'number') {\n return n;\n } else {\n throw {\n type: 'Argument',\n message: 'color functions take numbers as parameters'\n };\n }\n}\nfunction scaled(n, size) {\n if (n instanceof Dimension && n.unit.is('%')) {\n return parseFloat(n.value * size / 100);\n } else {\n return number(n);\n }\n}\ncolorFunctions = {\n rgb: function (r, g, b) {\n const color = colorFunctions.rgba(r, g, b, 1.0);\n if (color) {\n color.value = 'rgb';\n return color;\n }\n },\n rgba: function (r, g, b, a) {\n try {\n if (r instanceof Color) {\n if (g) {\n a = number(g);\n } else {\n a = r.alpha;\n }\n return new Color(r.rgb, a, 'rgba');\n }\n const rgb = [r, g, b].map(c => scaled(c, 255));\n a = number(a);\n return new Color(rgb, a, 'rgba');\n }\n catch (e) {}\n },\n hsl: function (h, s, l) {\n const color = colorFunctions.hsla(h, s, l, 1.0);\n if (color) {\n color.value = 'hsl';\n return color;\n }\n },\n hsla: function (h, s, l, a) {\n try {\n if (h instanceof Color) {\n if (s) {\n a = number(s);\n } else {\n a = h.alpha;\n }\n return new Color(h.rgb, a, 'hsla');\n }\n\n let m1;\n let m2;\n\n function hue(h) {\n h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n else if (h * 2 < 1) {\n return m2;\n }\n else if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n else {\n return m1;\n }\n }\n\n h = (number(h) % 360) / 360;\n s = clamp(number(s));l = clamp(number(l));a = clamp(number(a));\n\n m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n m1 = l * 2 - m2;\n\n const rgb = [\n hue(h + 1 / 3) * 255,\n hue(h) * 255,\n hue(h - 1 / 3) * 255\n ];\n a = number(a);\n return new Color(rgb, a, 'hsla');\n }\n catch (e) {}\n },\n\n hsv: function(h, s, v) {\n return colorFunctions.hsva(h, s, v, 1.0);\n },\n\n hsva: function(h, s, v, a) {\n h = ((number(h) % 360) / 360) * 360;\n s = number(s);v = number(v);a = number(a);\n\n let i;\n let f;\n i = Math.floor((h / 60) % 6);\n f = (h / 60) - i;\n\n const vs = [v,\n v * (1 - s),\n v * (1 - f * s),\n v * (1 - (1 - f) * s)];\n const perm = [[0, 3, 1],\n [2, 0, 1],\n [1, 0, 3],\n [1, 2, 0],\n [3, 1, 0],\n [0, 1, 2]];\n\n return colorFunctions.rgba(vs[perm[i][0]] * 255,\n vs[perm[i][1]] * 255,\n vs[perm[i][2]] * 255,\n a);\n },\n\n hue: function (color) {\n return new Dimension(toHSL(color).h);\n },\n saturation: function (color) {\n return new Dimension(toHSL(color).s * 100, '%');\n },\n lightness: function (color) {\n return new Dimension(toHSL(color).l * 100, '%');\n },\n hsvhue: function(color) {\n return new Dimension(toHSV(color).h);\n },\n hsvsaturation: function (color) {\n return new Dimension(toHSV(color).s * 100, '%');\n },\n hsvvalue: function (color) {\n return new Dimension(toHSV(color).v * 100, '%');\n },\n red: function (color) {\n return new Dimension(color.rgb[0]);\n },\n green: function (color) {\n return new Dimension(color.rgb[1]);\n },\n blue: function (color) {\n return new Dimension(color.rgb[2]);\n },\n alpha: function (color) {\n return new Dimension(toHSL(color).a);\n },\n luma: function (color) {\n return new Dimension(color.luma() * color.alpha * 100, '%');\n },\n luminance: function (color) {\n const luminance =\n (0.2126 * color.rgb[0] / 255) +\n (0.7152 * color.rgb[1] / 255) +\n (0.0722 * color.rgb[2] / 255);\n\n return new Dimension(luminance * color.alpha * 100, '%');\n },\n saturate: function (color, amount, method) {\n // filter: saturate(3.2);\n // should be kept as is, so check for color\n if (!color.rgb) {\n return null;\n }\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.s += hsl.s * amount.value / 100;\n }\n else {\n hsl.s += amount.value / 100;\n }\n hsl.s = clamp(hsl.s);\n return hsla(color, hsl);\n },\n desaturate: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.s -= hsl.s * amount.value / 100;\n }\n else {\n hsl.s -= amount.value / 100;\n }\n hsl.s = clamp(hsl.s);\n return hsla(color, hsl);\n },\n lighten: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.l += hsl.l * amount.value / 100;\n }\n else {\n hsl.l += amount.value / 100;\n }\n hsl.l = clamp(hsl.l);\n return hsla(color, hsl);\n },\n darken: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.l -= hsl.l * amount.value / 100;\n }\n else {\n hsl.l -= amount.value / 100;\n }\n hsl.l = clamp(hsl.l);\n return hsla(color, hsl);\n },\n fadein: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.a += hsl.a * amount.value / 100;\n }\n else {\n hsl.a += amount.value / 100;\n }\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n fadeout: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.a -= hsl.a * amount.value / 100;\n }\n else {\n hsl.a -= amount.value / 100;\n }\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n fade: function (color, amount) {\n const hsl = toHSL(color);\n\n hsl.a = amount.value / 100;\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n spin: function (color, amount) {\n const hsl = toHSL(color);\n const hue = (hsl.h + amount.value) % 360;\n\n hsl.h = hue < 0 ? 360 + hue : hue;\n\n return hsla(color, hsl);\n },\n //\n // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein\n // http://sass-lang.com\n //\n mix: function (color1, color2, weight) {\n if (!weight) {\n weight = new Dimension(50);\n }\n const p = weight.value / 100.0;\n const w = p * 2 - 1;\n const a = toHSL(color1).a - toHSL(color2).a;\n\n const w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n const w2 = 1 - w1;\n\n const rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,\n color1.rgb[1] * w1 + color2.rgb[1] * w2,\n color1.rgb[2] * w1 + color2.rgb[2] * w2];\n\n const alpha = color1.alpha * p + color2.alpha * (1 - p);\n\n return new Color(rgb, alpha);\n },\n greyscale: function (color) {\n return colorFunctions.desaturate(color, new Dimension(100));\n },\n contrast: function (color, dark, light, threshold) {\n // filter: contrast(3.2);\n // should be kept as is, so check for color\n if (!color.rgb) {\n return null;\n }\n if (typeof light === 'undefined') {\n light = colorFunctions.rgba(255, 255, 255, 1.0);\n }\n if (typeof dark === 'undefined') {\n dark = colorFunctions.rgba(0, 0, 0, 1.0);\n }\n // Figure out which is actually light and dark:\n if (dark.luma() > light.luma()) {\n const t = light;\n light = dark;\n dark = t;\n }\n if (typeof threshold === 'undefined') {\n threshold = 0.43;\n } else {\n threshold = number(threshold);\n }\n if (color.luma() < threshold) {\n return light;\n } else {\n return dark;\n }\n },\n // Changes made in 2.7.0 - Reverted in 3.0.0\n // contrast: function (color, color1, color2, threshold) {\n // // Return which of `color1` and `color2` has the greatest contrast with `color`\n // // according to the standard WCAG contrast ratio calculation.\n // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n // // The threshold param is no longer used, in line with SASS.\n // // filter: contrast(3.2);\n // // should be kept as is, so check for color\n // if (!color.rgb) {\n // return null;\n // }\n // if (typeof color1 === 'undefined') {\n // color1 = colorFunctions.rgba(0, 0, 0, 1.0);\n // }\n // if (typeof color2 === 'undefined') {\n // color2 = colorFunctions.rgba(255, 255, 255, 1.0);\n // }\n // var contrast1, contrast2;\n // var luma = color.luma();\n // var luma1 = color1.luma();\n // var luma2 = color2.luma();\n // // Calculate contrast ratios for each color\n // if (luma > luma1) {\n // contrast1 = (luma + 0.05) / (luma1 + 0.05);\n // } else {\n // contrast1 = (luma1 + 0.05) / (luma + 0.05);\n // }\n // if (luma > luma2) {\n // contrast2 = (luma + 0.05) / (luma2 + 0.05);\n // } else {\n // contrast2 = (luma2 + 0.05) / (luma + 0.05);\n // }\n // if (contrast1 > contrast2) {\n // return color1;\n // } else {\n // return color2;\n // }\n // },\n argb: function (color) {\n return new Anonymous(color.toARGB());\n },\n color: function(c) {\n if ((c instanceof Quoted) &&\n (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) {\n const val = c.value.slice(1);\n return new Color(val, undefined, `#${val}`);\n }\n if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) {\n c.value = undefined;\n return c;\n }\n throw {\n type: 'Argument',\n message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF'\n };\n },\n tint: function(color, amount) {\n return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount);\n },\n shade: function(color, amount) {\n return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount);\n }\n};\n\nexport default colorFunctions;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/data-uri.js b/packages/less/lib/less/functions/data-uri.js deleted file mode 100644 index 4aa3b3716..000000000 --- a/packages/less/lib/less/functions/data-uri.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var quoted_1 = __importDefault(require("../tree/quoted")); -var url_1 = __importDefault(require("../tree/url")); -var utils = __importStar(require("../utils")); -var logger_1 = __importDefault(require("../logger")); -exports.default = (function (environment) { - var fallback = function (functionThis, node) { return new url_1.default(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); }; - return { 'data-uri': function (mimetypeNode, filePathNode) { - if (!filePathNode) { - filePathNode = mimetypeNode; - mimetypeNode = null; - } - var mimetype = mimetypeNode && mimetypeNode.value; - var filePath = filePathNode.value; - var currentFileInfo = this.currentFileInfo; - var currentDirectory = currentFileInfo.rewriteUrls ? - currentFileInfo.currentDirectory : currentFileInfo.entryPath; - var fragmentStart = filePath.indexOf('#'); - var fragment = ''; - if (fragmentStart !== -1) { - fragment = filePath.slice(fragmentStart); - filePath = filePath.slice(0, fragmentStart); - } - var context = utils.clone(this.context); - context.rawBuffer = true; - var fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true); - if (!fileManager) { - return fallback(this, filePathNode); - } - var useBase64 = false; - // detect the mimetype if not given - if (!mimetypeNode) { - mimetype = environment.mimeLookup(filePath); - if (mimetype === 'image/svg+xml') { - useBase64 = false; - } - else { - // use base 64 unless it's an ASCII or UTF-8 format - var charset = environment.charsetLookup(mimetype); - useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0; - } - if (useBase64) { - mimetype += ';base64'; - } - } - else { - useBase64 = /;base64$/.test(mimetype); - } - var fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment); - if (!fileSync.contents) { - logger_1.default.warn("Skipped data-uri embedding of " + filePath + " because file not found"); - return fallback(this, filePathNode || mimetypeNode); - } - var buf = fileSync.contents; - if (useBase64 && !environment.encodeBase64) { - return fallback(this, filePathNode); - } - buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf); - var uri = "data:" + mimetype + "," + buf + fragment; - return new url_1.default(new quoted_1.default("\"" + uri + "\"", uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - } }; -}); -//# sourceMappingURL=data-uri.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/data-uri.js.map b/packages/less/lib/less/functions/data-uri.js.map deleted file mode 100644 index e6605011a..000000000 --- a/packages/less/lib/less/functions/data-uri.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data-uri.js","sourceRoot":"","sources":["../../../src/less/functions/data-uri.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAoC;AACpC,oDAA8B;AAC9B,8CAAkC;AAClC,qDAA+B;AAE/B,mBAAe,UAAA,WAAW;IAEtB,IAAM,QAAQ,GAAG,UAAC,YAAY,EAAE,IAAI,IAAK,OAAA,IAAI,aAAG,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAA1F,CAA0F,CAAC;IAEpI,OAAO,EAAE,UAAU,EAAE,UAAS,YAAY,EAAE,YAAY;YAEpD,IAAI,CAAC,YAAY,EAAE;gBACf,YAAY,GAAG,YAAY,CAAC;gBAC5B,YAAY,GAAG,IAAI,CAAC;aACvB;YAED,IAAI,QAAQ,GAAG,YAAY,IAAI,YAAY,CAAC,KAAK,CAAC;YAClD,IAAI,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC;YAClC,IAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;YAC7C,IAAM,gBAAgB,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;gBAClD,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CA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WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YAC5F,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBACpB,gBAAM,CAAC,IAAI,CAAC,mCAAiC,QAAQ,4BAAyB,CAAC,CAAC;gBAChF,OAAO,QAAQ,CAAC,IAAI,EAAE,YAAY,IAAI,YAAY,CAAC,CAAC;aACvD;YACD,IAAI,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC;YAC5B,IAAI,SAAS,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE;gBACxC,OAAO,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;aACvC;YAED,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;YAE1E,IAAM,GAAG,GAAG,UAAQ,QAAQ,SAAI,GAAG,GAAG,QAAU,CAAC;YAEjD,OAAO,IAAI,aAAG,CAAC,IAAI,gBAAM,CAAC,OAAI,GAAG,OAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC3H,CAAC,EAAC,CAAC;AACP,CAAC,EAAC","sourcesContent":["import Quoted from '../tree/quoted';\nimport URL from '../tree/url';\nimport * as utils from '../utils';\nimport logger from '../logger';\n\nexport default environment => {\n \n const fallback = (functionThis, node) => new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); \n\n return { 'data-uri': function(mimetypeNode, filePathNode) {\n\n if (!filePathNode) {\n filePathNode = mimetypeNode;\n mimetypeNode = null;\n }\n\n let mimetype = mimetypeNode && mimetypeNode.value;\n let filePath = filePathNode.value;\n const currentFileInfo = this.currentFileInfo;\n const currentDirectory = currentFileInfo.rewriteUrls ?\n currentFileInfo.currentDirectory : currentFileInfo.entryPath;\n\n const fragmentStart = filePath.indexOf('#');\n let fragment = '';\n if (fragmentStart !== -1) {\n fragment = filePath.slice(fragmentStart);\n filePath = filePath.slice(0, fragmentStart);\n }\n const context = utils.clone(this.context);\n context.rawBuffer = true;\n\n const fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true);\n\n if (!fileManager) {\n return fallback(this, filePathNode);\n }\n\n let useBase64 = false;\n\n // detect the mimetype if not given\n if (!mimetypeNode) {\n\n mimetype = environment.mimeLookup(filePath);\n\n if (mimetype === 'image/svg+xml') {\n useBase64 = false;\n } else {\n // use base 64 unless it's an ASCII or UTF-8 format\n const charset = environment.charsetLookup(mimetype);\n useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0;\n }\n if (useBase64) { mimetype += ';base64'; }\n }\n else {\n useBase64 = /;base64$/.test(mimetype);\n }\n\n const fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment);\n if (!fileSync.contents) {\n logger.warn(`Skipped data-uri embedding of ${filePath} because file not found`);\n return fallback(this, filePathNode || mimetypeNode);\n }\n let buf = fileSync.contents;\n if (useBase64 && !environment.encodeBase64) {\n return fallback(this, filePathNode);\n }\n\n buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf);\n\n const uri = `data:${mimetype},${buf}${fragment}`;\n\n return new URL(new Quoted(`\"${uri}\"`, uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo);\n }};\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/default.js b/packages/less/lib/less/functions/default.js deleted file mode 100644 index a0fdf41a8..000000000 --- a/packages/less/lib/less/functions/default.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var keyword_1 = __importDefault(require("../tree/keyword")); -var defaultFunc = { - eval: function () { - var v = this.value_; - var e = this.error_; - if (e) { - throw e; - } - if (v != null) { - return v ? keyword_1.default.True : keyword_1.default.False; - } - }, - value: function (v) { - this.value_ = v; - }, - error: function (e) { - this.error_ = e; - }, - reset: function () { - this.value_ = this.error_ = null; - } -}; -exports.default = defaultFunc; -//# sourceMappingURL=default.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/default.js.map b/packages/less/lib/less/functions/default.js.map deleted file mode 100644 index ebea73fb0..000000000 --- a/packages/less/lib/less/functions/default.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/less/functions/default.js"],"names":[],"mappings":";;;;;AAAA,4DAAsC;AAEtC,IAAM,WAAW,GAAG;IAChB,IAAI,EAAE;QACF,IAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE;YACH,MAAM,CAAC,CAAC;SACX;QACD,IAAI,CAAC,IAAI,IAAI,EAAE;YACX,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAO,CAAC,KAAK,CAAC;SAC3C;IACL,CAAC;IACD,KAAK,EAAE,UAAU,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,KAAK,EAAE,UAAU,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,KAAK,EAAE;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrC,CAAC;CACJ,CAAC;AAEF,kBAAe,WAAW,CAAC","sourcesContent":["import Keyword from '../tree/keyword';\n\nconst defaultFunc = {\n eval: function () {\n const v = this.value_;\n const e = this.error_;\n if (e) {\n throw e;\n }\n if (v != null) {\n return v ? Keyword.True : Keyword.False;\n }\n },\n value: function (v) {\n this.value_ = v;\n },\n error: function (e) {\n this.error_ = e;\n },\n reset: function () {\n this.value_ = this.error_ = null;\n }\n};\n\nexport default defaultFunc;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/function-caller.js b/packages/less/lib/less/functions/function-caller.js deleted file mode 100644 index 95a42cfc1..000000000 --- a/packages/less/lib/less/functions/function-caller.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var expression_1 = __importDefault(require("../tree/expression")); -var functionCaller = /** @class */ (function () { - function functionCaller(name, context, index, currentFileInfo) { - this.name = name.toLowerCase(); - this.index = index; - this.context = context; - this.currentFileInfo = currentFileInfo; - this.func = context.frames[0].functionRegistry.get(this.name); - } - functionCaller.prototype.isValid = function () { - return Boolean(this.func); - }; - functionCaller.prototype.call = function (args) { - // This code is terrible and should be replaced as per this issue... - // https://github.com/less/less.js/issues/2477 - if (Array.isArray(args)) { - args = args.filter(function (item) { - if (item.type === 'Comment') { - return false; - } - return true; - }) - .map(function (item) { - if (item.type === 'Expression') { - var subNodes = item.value.filter(function (item) { - if (item.type === 'Comment') { - return false; - } - return true; - }); - if (subNodes.length === 1) { - return subNodes[0]; - } - else { - return new expression_1.default(subNodes); - } - } - return item; - }); - } - return this.func.apply(this, args); - }; - return functionCaller; -}()); -exports.default = functionCaller; -//# sourceMappingURL=function-caller.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/function-caller.js.map b/packages/less/lib/less/functions/function-caller.js.map deleted file mode 100644 index 38b0a27c8..000000000 --- a/packages/less/lib/less/functions/function-caller.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function-caller.js","sourceRoot":"","sources":["../../../src/less/functions/function-caller.js"],"names":[],"mappings":";;;;;AAAA,kEAA4C;AAE5C;IACI,wBAAY,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe;QAC7C,IAAI,CAAC,IAA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AAI,EAAS,IAAI,EAAE;IAC9B,CAAC;IACL,qBAAC;AAAD,CAAC,AA5CD,IA4CC;AAED,kBAAe,cAAc,CAAC","sourcesContent":["import Expression from '../tree/expression';\n\nclass functionCaller {\n constructor(name, context, index, currentFileInfo) {\n this.name = name.toLowerCase();\n this.index = index;\n this.context = context;\n this.currentFileInfo = currentFileInfo;\n\n this.func = context.frames[0].functionRegistry.get(this.name);\n }\n\n isValid() {\n return Boolean(this.func);\n }\n\n call(args) {\n // This code is terrible and should be replaced as per this issue...\n // https://github.com/less/less.js/issues/2477\n if (Array.isArray(args)) {\n args = args.filter(item => {\n if (item.type === 'Comment') {\n return false;\n }\n return true;\n })\n .map(item => {\n if (item.type === 'Expression') {\n const subNodes = item.value.filter(item => {\n if (item.type === 'Comment') {\n return false;\n }\n return true;\n });\n if (subNodes.length === 1) {\n return subNodes[0];\n } else {\n return new Expression(subNodes);\n }\n }\n return item;\n });\n }\n\n return this.func(...args);\n }\n}\n\nexport default functionCaller;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/function-registry.js b/packages/less/lib/less/functions/function-registry.js deleted file mode 100644 index e6df9dc1e..000000000 --- a/packages/less/lib/less/functions/function-registry.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function makeRegistry(base) { - return { - _data: {}, - add: function (name, func) { - // precautionary case conversion, as later querying of - // the registry by function-caller uses lower case as well. - name = name.toLowerCase(); - if (this._data.hasOwnProperty(name)) { - // TODO warn - } - this._data[name] = func; - }, - addMultiple: function (functions) { - var _this = this; - Object.keys(functions).forEach(function (name) { - _this.add(name, functions[name]); - }); - }, - get: function (name) { - return this._data[name] || (base && base.get(name)); - }, - getLocalFunctions: function () { - return this._data; - }, - inherit: function () { - return makeRegistry(this); - }, - create: function (base) { - return makeRegistry(base); - } - }; -} -exports.default = makeRegistry(null); -//# sourceMappingURL=function-registry.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/function-registry.js.map b/packages/less/lib/less/functions/function-registry.js.map deleted file mode 100644 index ec0ae6cff..000000000 --- a/packages/less/lib/less/functions/function-registry.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"function-registry.js","sourceRoot":"","sources":["../../../src/less/functions/function-registry.js"],"names":[],"mappings":";;AAAA,SAAS,YAAY,CAAE,IAAI;IACvB,OAAO;QACH,KAAK,EAAE,EAAE;QACT,GAAG,EAAE,UAAS,IAAI,EAAE,IAAI;YACpB,sDAAsD;YACtD,2DAA2D;YAC3D,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAE1B,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;gBACjC,YAAY;aACf;YACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,WAAW,EAAE,UAAS,SAAS;YAAlB,iBAKZ;YAJG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAC1B,UAAA,IAAI;gBACA,KAAI,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACX,CAAC;QACD,GAAG,EAAE,UAAS,IAAI;YACd,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAE,IAAI,CAAE,CAAC,CAAC;QAC3D,CAAC;QACD,iBAAiB,EAAE;YACf,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;QACD,OAAO,EAAE;YACL,OAAO,YAAY,CAAE,IAAI,CAAE,CAAC;QAChC,CAAC;QACD,MAAM,EAAE,UAAS,IAAI;YACjB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;KACJ,CAAC;AACN,CAAC;AAED,kBAAe,YAAY,CAAE,IAAI,CAAE,CAAC","sourcesContent":["function makeRegistry( base ) {\n return {\n _data: {},\n add: function(name, func) {\n // precautionary case conversion, as later querying of\n // the registry by function-caller uses lower case as well.\n name = name.toLowerCase();\n\n if (this._data.hasOwnProperty(name)) {\n // TODO warn\n }\n this._data[name] = func;\n },\n addMultiple: function(functions) {\n Object.keys(functions).forEach(\n name => {\n this.add(name, functions[name]);\n });\n },\n get: function(name) {\n return this._data[name] || ( base && base.get( name ));\n },\n getLocalFunctions: function() {\n return this._data;\n },\n inherit: function() {\n return makeRegistry( this );\n },\n create: function(base) {\n return makeRegistry(base);\n }\n };\n}\n\nexport default makeRegistry( null );"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/index.js b/packages/less/lib/less/functions/index.js deleted file mode 100644 index f7250e245..000000000 --- a/packages/less/lib/less/functions/index.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var function_registry_1 = __importDefault(require("./function-registry")); -var function_caller_1 = __importDefault(require("./function-caller")); -var boolean_1 = __importDefault(require("./boolean")); -var default_1 = __importDefault(require("./default")); -var color_1 = __importDefault(require("./color")); -var color_blending_1 = __importDefault(require("./color-blending")); -var data_uri_1 = __importDefault(require("./data-uri")); -var list_1 = __importDefault(require("./list")); -var math_1 = __importDefault(require("./math")); -var number_1 = __importDefault(require("./number")); -var string_1 = __importDefault(require("./string")); -var svg_1 = __importDefault(require("./svg")); -var types_1 = __importDefault(require("./types")); -exports.default = (function (environment) { - var functions = { functionRegistry: function_registry_1.default, functionCaller: function_caller_1.default }; - // register functions - function_registry_1.default.addMultiple(boolean_1.default); - function_registry_1.default.add('default', default_1.default.eval.bind(default_1.default)); - function_registry_1.default.addMultiple(color_1.default); - function_registry_1.default.addMultiple(color_blending_1.default); - function_registry_1.default.addMultiple(data_uri_1.default(environment)); - function_registry_1.default.addMultiple(list_1.default); - function_registry_1.default.addMultiple(math_1.default); - function_registry_1.default.addMultiple(number_1.default); - function_registry_1.default.addMultiple(string_1.default); - function_registry_1.default.addMultiple(svg_1.default(environment)); - function_registry_1.default.addMultiple(types_1.default); - return functions; -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/index.js.map b/packages/less/lib/less/functions/index.js.map deleted file mode 100644 index 01a53c2e3..000000000 --- a/packages/less/lib/less/functions/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/less/functions/index.js"],"names":[],"mappings":";;;;;AAAA,0EAAmD;AACnD,sEAA+C;AAE/C,sDAAgC;AAChC,sDAAoC;AACpC,kDAA4B;AAC5B,oEAA6C;AAC7C,wDAAiC;AACjC,gDAA0B;AAC1B,gDAA0B;AAC1B,oDAA8B;AAC9B,oDAA8B;AAC9B,8CAAwB;AACxB,kDAA4B;AAE5B,mBAAe,UAAA,WAAW;IACtB,IAAM,SAAS,GAAG,EAAE,gBAAgB,6BAAA,EAAE,cAAc,2BAAA,EAAE,CAAC;IAEvD,qBAAqB;IACrB,2BAAgB,CAAC,WAAW,CAAC,iBAAO,CAAC,CAAC;IACtC,2BAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAW,CAAC,CAAC,CAAC;IACpE,2BAAgB,CAAC,WAAW,CAAC,eAAK,CAAC,CAAC;IACpC,2BAAgB,CAAC,WAAW,CAAC,wBAAa,CAAC,CAAC;IAC5C,2BAAgB,CAAC,WAAW,CAAC,kBAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACnD,2BAAgB,CAAC,WAAW,CAAC,cAAI,CAAC,CAAC;IACnC,2BAAgB,CAAC,WAAW,CAAC,cAAI,CAAC,CAAC;IACnC,2BAAgB,CAAC,WAAW,CAAC,gBAAM,CAAC,CAAC;IACrC,2BAAgB,CAAC,WAAW,CAAC,gBAAM,CAAC,CAAC;IACrC,2BAAgB,CAAC,WAAW,CAAC,aAAG,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/C,2BAAgB,CAAC,WAAW,CAAC,eAAK,CAAC,CAAC;IAEpC,OAAO,SAAS,CAAC;AACrB,CAAC,EAAC","sourcesContent":["import functionRegistry from './function-registry';\nimport functionCaller from './function-caller';\n\nimport boolean from './boolean';\nimport defaultFunc from './default';\nimport color from './color';\nimport colorBlending from './color-blending';\nimport dataUri from './data-uri';\nimport list from './list';\nimport math from './math';\nimport number from './number';\nimport string from './string';\nimport svg from './svg';\nimport types from './types';\n\nexport default environment => {\n const functions = { functionRegistry, functionCaller };\n\n // register functions\n functionRegistry.addMultiple(boolean);\n functionRegistry.add('default', defaultFunc.eval.bind(defaultFunc));\n functionRegistry.addMultiple(color);\n functionRegistry.addMultiple(colorBlending);\n functionRegistry.addMultiple(dataUri(environment));\n functionRegistry.addMultiple(list);\n functionRegistry.addMultiple(math);\n functionRegistry.addMultiple(number);\n functionRegistry.addMultiple(string);\n functionRegistry.addMultiple(svg(environment));\n functionRegistry.addMultiple(types);\n\n return functions;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/list.js b/packages/less/lib/less/functions/list.js deleted file mode 100644 index cc1547dcc..000000000 --- a/packages/less/lib/less/functions/list.js +++ /dev/null @@ -1,128 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var comment_1 = __importDefault(require("../tree/comment")); -var dimension_1 = __importDefault(require("../tree/dimension")); -var declaration_1 = __importDefault(require("../tree/declaration")); -var expression_1 = __importDefault(require("../tree/expression")); -var ruleset_1 = __importDefault(require("../tree/ruleset")); -var selector_1 = __importDefault(require("../tree/selector")); -var element_1 = __importDefault(require("../tree/element")); -var quoted_1 = __importDefault(require("../tree/quoted")); -var getItemsFromNode = function (node) { - // handle non-array values as an array of length 1 - // return 'undefined' if index is invalid - var items = Array.isArray(node.value) ? - node.value : Array(node); - return items; -}; -exports.default = { - _SELF: function (n) { - return n; - }, - extract: function (values, index) { - // (1-based index) - index = index.value - 1; - return getItemsFromNode(values)[index]; - }, - length: function (values) { - return new dimension_1.default(getItemsFromNode(values).length); - }, - /** - * Creates a Less list of incremental values. - * Modeled after Lodash's range function, also exists natively in PHP - * - * @param {Dimension} [start=1] - * @param {Dimension} end - e.g. 10 or 10px - unit is added to output - * @param {Dimension} [step=1] - */ - range: function (start, end, step) { - var from; - var to; - var stepValue = 1; - var list = []; - if (end) { - to = end; - from = start.value; - if (step) { - stepValue = step.value; - } - } - else { - from = 1; - to = start; - } - for (var i = from; i <= to.value; i += stepValue) { - list.push(new dimension_1.default(i, to.unit)); - } - return new expression_1.default(list); - }, - each: function (list, rs) { - var rules = []; - var newRules; - var iterator; - if (list.value && !(list instanceof quoted_1.default)) { - if (Array.isArray(list.value)) { - iterator = list.value; - } - else { - iterator = [list.value]; - } - } - else if (list.ruleset) { - iterator = list.ruleset.rules; - } - else if (list.rules) { - iterator = list.rules; - } - else if (Array.isArray(list)) { - iterator = list; - } - else { - iterator = [list]; - } - var valueName = '@value'; - var keyName = '@key'; - var indexName = '@index'; - if (rs.params) { - valueName = rs.params[0] && rs.params[0].name; - keyName = rs.params[1] && rs.params[1].name; - indexName = rs.params[2] && rs.params[2].name; - rs = rs.rules; - } - else { - rs = rs.ruleset; - } - for (var i = 0; i < iterator.length; i++) { - var key = void 0; - var value = void 0; - var item = iterator[i]; - if (item instanceof declaration_1.default) { - key = typeof item.name === 'string' ? item.name : item.name[0].value; - value = item.value; - } - else { - key = new dimension_1.default(i + 1); - value = item; - } - if (item instanceof comment_1.default) { - continue; - } - newRules = rs.rules.slice(0); - if (valueName) { - newRules.push(new declaration_1.default(valueName, value, false, false, this.index, this.currentFileInfo)); - } - if (indexName) { - newRules.push(new declaration_1.default(indexName, new dimension_1.default(i + 1), false, false, this.index, this.currentFileInfo)); - } - if (keyName) { - newRules.push(new declaration_1.default(keyName, key, false, false, this.index, this.currentFileInfo)); - } - rules.push(new ruleset_1.default([new (selector_1.default)([new element_1.default("", '&')])], newRules, rs.strictImports, rs.visibilityInfo())); - } - return new ruleset_1.default([new (selector_1.default)([new element_1.default("", '&')])], rules, rs.strictImports, rs.visibilityInfo()).eval(this.context); - } -}; -//# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/list.js.map b/packages/less/lib/less/functions/list.js.map deleted file mode 100644 index b1c1df5e2..000000000 --- a/packages/less/lib/less/functions/list.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/less/functions/list.js"],"names":[],"mappings":";;;;;AAAA,4DAAsC;AACtC,gEAA0C;AAC1C,oEAA8C;AAC9C,kEAA4C;AAC5C,4DAAsC;AACtC,8DAAwC;AACxC,4DAAsC;AACtC,0DAAmC;AAEnC,IAAM,gBAAgB,GAAG,UAAA,IAAI;IACzB,kDAAkD;IAClD,yCAAyC;IACzC,IAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE7B,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,kBAAe;IACX,KAAK,EAAE,UAAS,CAAC;QACb,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,EAAE,UAAS,MAAM,EAAE,KAAK;QAC3B,kBAAkB;QAClB,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QAExB,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,EAAE,UAAS,MAAM;QACnB,OAAO,IAAI,mBAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;IACD;;;;;;;OAOG;IACH,KAAK,EAAE,UAAS,KAAK,EAA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AE,CAAC,cAAc,EAAE,CACtB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;CACJ,CAAC","sourcesContent":["import Comment from '../tree/comment';\nimport Dimension from '../tree/dimension';\nimport Declaration from '../tree/declaration';\nimport Expression from '../tree/expression';\nimport Ruleset from '../tree/ruleset';\nimport Selector from '../tree/selector';\nimport Element from '../tree/element';\nimport Quote from '../tree/quoted';\n\nconst getItemsFromNode = node => {\n // handle non-array values as an array of length 1\n // return 'undefined' if index is invalid\n const items = Array.isArray(node.value) ?\n node.value : Array(node);\n\n return items;\n};\n\nexport default {\n _SELF: function(n) {\n return n;\n },\n extract: function(values, index) {\n // (1-based index)\n index = index.value - 1;\n\n return getItemsFromNode(values)[index];\n },\n length: function(values) {\n return new Dimension(getItemsFromNode(values).length);\n },\n /**\n * Creates a Less list of incremental values.\n * Modeled after Lodash's range function, also exists natively in PHP\n * \n * @param {Dimension} [start=1]\n * @param {Dimension} end - e.g. 10 or 10px - unit is added to output\n * @param {Dimension} [step=1] \n */\n range: function(start, end, step) {\n let from;\n let to;\n let stepValue = 1;\n const list = [];\n if (end) {\n to = end;\n from = start.value;\n if (step) {\n stepValue = step.value;\n }\n }\n else {\n from = 1;\n to = start;\n }\n\n for (let i = from; i <= to.value; i += stepValue) {\n list.push(new Dimension(i, to.unit));\n }\n\n return new Expression(list);\n },\n each: function(list, rs) {\n const rules = [];\n let newRules;\n let iterator;\n\n if (list.value && !(list instanceof Quote)) {\n if (Array.isArray(list.value)) {\n iterator = list.value;\n } else {\n iterator = [list.value];\n }\n } else if (list.ruleset) {\n iterator = list.ruleset.rules;\n } else if (list.rules) {\n iterator = list.rules;\n } else if (Array.isArray(list)) {\n iterator = list;\n } else {\n iterator = [list];\n }\n\n let valueName = '@value';\n let keyName = '@key';\n let indexName = '@index';\n\n if (rs.params) {\n valueName = rs.params[0] && rs.params[0].name;\n keyName = rs.params[1] && rs.params[1].name;\n indexName = rs.params[2] && rs.params[2].name;\n rs = rs.rules;\n } else {\n rs = rs.ruleset;\n }\n\n for (let i = 0; i < iterator.length; i++) {\n let key;\n let value;\n const item = iterator[i];\n if (item instanceof Declaration) {\n key = typeof item.name === 'string' ? item.name : item.name[0].value;\n value = item.value;\n } else {\n key = new Dimension(i + 1);\n value = item;\n }\n\n if (item instanceof Comment) {\n continue;\n }\n\n newRules = rs.rules.slice(0);\n if (valueName) {\n newRules.push(new Declaration(valueName,\n value,\n false, false, this.index, this.currentFileInfo));\n }\n if (indexName) {\n newRules.push(new Declaration(indexName,\n new Dimension(i + 1),\n false, false, this.index, this.currentFileInfo));\n }\n if (keyName) {\n newRules.push(new Declaration(keyName,\n key,\n false, false, this.index, this.currentFileInfo));\n }\n\n rules.push(new Ruleset([ new(Selector)([ new Element(\"\", '&') ]) ],\n newRules,\n rs.strictImports,\n rs.visibilityInfo()\n ));\n }\n\n return new Ruleset([ new(Selector)([ new Element(\"\", '&') ]) ],\n rules,\n rs.strictImports,\n rs.visibilityInfo()\n ).eval(this.context);\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/math-helper.js b/packages/less/lib/less/functions/math-helper.js deleted file mode 100644 index c84ffbff4..000000000 --- a/packages/less/lib/less/functions/math-helper.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var dimension_1 = __importDefault(require("../tree/dimension")); -var MathHelper = function (fn, unit, n) { - if (!(n instanceof dimension_1.default)) { - throw { type: 'Argument', message: 'argument must be a number' }; - } - if (unit == null) { - unit = n.unit; - } - else { - n = n.unify(); - } - return new dimension_1.default(fn(parseFloat(n.value)), unit); -}; -exports.default = MathHelper; -//# sourceMappingURL=math-helper.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/math-helper.js.map b/packages/less/lib/less/functions/math-helper.js.map deleted file mode 100644 index 347261907..000000000 --- a/packages/less/lib/less/functions/math-helper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math-helper.js","sourceRoot":"","sources":["../../../src/less/functions/math-helper.js"],"names":[],"mappings":";;;;;AAAA,gEAA0C;AAE1C,IAAM,UAAU,GAAG,UAAC,EAAE,EAAE,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,CAAC,CAAC,YAAY,mBAAS,CAAC,EAAE;QAC3B,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;KACpE;IACD,IAAI,IAAI,IAAI,IAAI,EAAE;QACd,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;KACjB;SAAM;QACH,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;KACjB;IACD,OAAO,IAAI,mBAAS,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["import Dimension from '../tree/dimension';\n\nconst MathHelper = (fn, unit, n) => {\n if (!(n instanceof Dimension)) {\n throw { type: 'Argument', message: 'argument must be a number' };\n }\n if (unit == null) {\n unit = n.unit;\n } else {\n n = n.unify();\n }\n return new Dimension(fn(parseFloat(n.value)), unit);\n};\n\nexport default MathHelper;"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/math.js b/packages/less/lib/less/functions/math.js deleted file mode 100644 index 601ee7953..000000000 --- a/packages/less/lib/less/functions/math.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var math_helper_js_1 = __importDefault(require("./math-helper.js")); -var mathFunctions = { - // name, unit - ceil: null, - floor: null, - sqrt: null, - abs: null, - tan: '', - sin: '', - cos: '', - atan: 'rad', - asin: 'rad', - acos: 'rad' -}; -for (var f in mathFunctions) { - if (mathFunctions.hasOwnProperty(f)) { - mathFunctions[f] = math_helper_js_1.default.bind(null, Math[f], mathFunctions[f]); - } -} -mathFunctions.round = function (n, f) { - var fraction = typeof f === 'undefined' ? 0 : f.value; - return math_helper_js_1.default(function (num) { return num.toFixed(fraction); }, null, n); -}; -exports.default = mathFunctions; -//# sourceMappingURL=math.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/math.js.map b/packages/less/lib/less/functions/math.js.map deleted file mode 100644 index 11d1d4ba5..000000000 --- a/packages/less/lib/less/functions/math.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math.js","sourceRoot":"","sources":["../../../src/less/functions/math.js"],"names":[],"mappings":";;;;;AAAA,oEAA0C;AAE1C,IAAM,aAAa,GAAG;IAClB,cAAc;IACd,IAAI,EAAG,IAAI;IACX,KAAK,EAAE,IAAI;IACX,IAAI,EAAG,IAAI;IACX,GAAG,EAAI,IAAI;IACX,GAAG,EAAI,EAAE;IACT,GAAG,EAAI,EAAE;IACT,GAAG,EAAI,EAAE;IACT,IAAI,EAAG,KAAK;IACZ,IAAI,EAAG,KAAK;IACZ,IAAI,EAAG,KAAK;CACf,CAAC;AAEF,KAAK,IAAM,CAAC,IAAI,aAAa,EAAE;IAC3B,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;QACjC,aAAa,CAAC,CAAC,CAAC,GAAG,wBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;KACvE;CACJ;AAED,aAAa,CAAC,KAAK,GAAG,UAAC,CAAC,EAAE,CAAC;IACvB,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACxD,OAAO,wBAAU,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EAArB,CAAqB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC","sourcesContent":["import mathHelper from './math-helper.js';\n\nconst mathFunctions = {\n // name, unit\n ceil: null,\n floor: null,\n sqrt: null,\n abs: null,\n tan: '',\n sin: '',\n cos: '',\n atan: 'rad',\n asin: 'rad',\n acos: 'rad'\n};\n\nfor (const f in mathFunctions) {\n if (mathFunctions.hasOwnProperty(f)) {\n mathFunctions[f] = mathHelper.bind(null, Math[f], mathFunctions[f]);\n }\n}\n\nmathFunctions.round = (n, f) => {\n const fraction = typeof f === 'undefined' ? 0 : f.value;\n return mathHelper(num => num.toFixed(fraction), null, n);\n};\n\nexport default mathFunctions;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/number.js b/packages/less/lib/less/functions/number.js deleted file mode 100644 index 1325d2fab..000000000 --- a/packages/less/lib/less/functions/number.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var dimension_1 = __importDefault(require("../tree/dimension")); -var anonymous_1 = __importDefault(require("../tree/anonymous")); -var math_helper_js_1 = __importDefault(require("./math-helper.js")); -var minMax = function (isMin, args) { - args = Array.prototype.slice.call(args); - switch (args.length) { - case 0: throw { type: 'Argument', message: 'one or more arguments required' }; - } - var i; // key is the unit.toString() for unified Dimension values, - var j; - var current; - var currentUnified; - var referenceUnified; - var unit; - var unitStatic; - var unitClone; - var // elems only contains original argument values. - order = []; - var values = {}; - // value is the index into the order array. - for (i = 0; i < args.length; i++) { - current = args[i]; - if (!(current instanceof dimension_1.default)) { - if (Array.isArray(args[i].value)) { - Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value)); - } - continue; - } - currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new dimension_1.default(current.value, unitClone).unify() : current.unify(); - unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString(); - unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic; - unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone; - j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit]; - if (j === undefined) { - if (unitStatic !== undefined && unit !== unitStatic) { - throw { type: 'Argument', message: 'incompatible types' }; - } - values[unit] = order.length; - order.push(current); - continue; - } - referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new dimension_1.default(order[j].value, unitClone).unify() : order[j].unify(); - if (isMin && currentUnified.value < referenceUnified.value || - !isMin && currentUnified.value > referenceUnified.value) { - order[j] = current; - } - } - if (order.length == 1) { - return order[0]; - } - args = order.map(function (a) { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', '); - return new anonymous_1.default((isMin ? 'min' : 'max') + "(" + args + ")"); -}; -exports.default = { - min: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return minMax(true, args); - }, - max: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return minMax(false, args); - }, - convert: function (val, unit) { - return val.convertTo(unit.value); - }, - pi: function () { - return new dimension_1.default(Math.PI); - }, - mod: function (a, b) { - return new dimension_1.default(a.value % b.value, a.unit); - }, - pow: function (x, y) { - if (typeof x === 'number' && typeof y === 'number') { - x = new dimension_1.default(x); - y = new dimension_1.default(y); - } - else if (!(x instanceof dimension_1.default) || !(y instanceof dimension_1.default)) { - throw { type: 'Argument', message: 'arguments must be numbers' }; - } - return new dimension_1.default(Math.pow(x.value, y.value), x.unit); - }, - percentage: function (n) { - var result = math_helper_js_1.default(function (num) { return num * 100; }, '%', n); - return result; - } -}; -//# sourceMappingURL=number.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/number.js.map b/packages/less/lib/less/functions/number.js.map deleted file mode 100644 index b695258b7..000000000 --- a/packages/less/lib/less/functions/number.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../src/less/functions/number.js"],"names":[],"mappings":";;;;;AAAA,gEAA0C;AAC1C,gEAA0C;AAC1C,oEAA0C;AAE1C,IAAM,MAAM,GAAG,UAAU,KAAK,EAAE,IAAI;IAChC,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,QAAQ,IAAI,CAAC,MAAM,EAAE;QACjB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC;KACjF;IACD,IAAI,CAAC,CAAC,CAAC,2DAA2D;IAClE,IAAI,CAAC,CAAC;IACN,IAAI,OAAO,CAAC;IACZ,IAAI,cAAc,CAAC;IACnB,IAAI,gBAAgB,CAAC;IACrB,IAAI,IAAI,CAAC;IACT,IAAI,UAAU,CAAC;IACf,IAAI,SAAS,CAAC;IAEd,IAAM,gDAAgD;IAClD,KAAK,GAAI,EAAE,CAAC;IAEhB,IAAM,MAAM,GAAG,EAAE,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC9B,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,OAAO,YAAY,mBAAS,CAAC,EAAE;YACjC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAC9B,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;aA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CAAC;IAClB,CAAC;CACJ,CAAC","sourcesContent":["import Dimension from '../tree/dimension';\nimport Anonymous from '../tree/anonymous';\nimport mathHelper from './math-helper.js';\n\nconst minMax = function (isMin, args) {\n args = Array.prototype.slice.call(args);\n switch (args.length) {\n case 0: throw { type: 'Argument', message: 'one or more arguments required' };\n }\n let i; // key is the unit.toString() for unified Dimension values,\n let j;\n let current;\n let currentUnified;\n let referenceUnified;\n let unit;\n let unitStatic;\n let unitClone;\n\n const // elems only contains original argument values.\n order = [];\n\n const values = {};\n // value is the index into the order array.\n for (i = 0; i < args.length; i++) {\n current = args[i];\n if (!(current instanceof Dimension)) {\n if (Array.isArray(args[i].value)) {\n Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value));\n }\n continue;\n }\n currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify();\n unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();\n unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic;\n unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone;\n j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit];\n if (j === undefined) {\n if (unitStatic !== undefined && unit !== unitStatic) {\n throw { type: 'Argument', message: 'incompatible types' };\n }\n values[unit] = order.length;\n order.push(current);\n continue;\n }\n referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify();\n if ( isMin && currentUnified.value < referenceUnified.value ||\n !isMin && currentUnified.value > referenceUnified.value) {\n order[j] = current;\n }\n }\n if (order.length == 1) {\n return order[0];\n }\n args = order.map(function (a) { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', ');\n return new Anonymous(`${isMin ? 'min' : 'max'}(${args})`);\n};\n\nexport default {\n min: function(...args) {\n return minMax(true, args);\n },\n max: function(...args) {\n return minMax(false, args);\n },\n convert: function (val, unit) {\n return val.convertTo(unit.value);\n },\n pi: function () {\n return new Dimension(Math.PI);\n },\n mod: function(a, b) {\n return new Dimension(a.value % b.value, a.unit);\n },\n pow: function(x, y) {\n if (typeof x === 'number' && typeof y === 'number') {\n x = new Dimension(x);\n y = new Dimension(y);\n } else if (!(x instanceof Dimension) || !(y instanceof Dimension)) {\n throw { type: 'Argument', message: 'arguments must be numbers' };\n }\n\n return new Dimension(Math.pow(x.value, y.value), x.unit);\n },\n percentage: function (n) {\n const result = mathHelper(num => num * 100, '%', n);\n\n return result;\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/string.js b/packages/less/lib/less/functions/string.js deleted file mode 100644 index afa09dd89..000000000 --- a/packages/less/lib/less/functions/string.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var quoted_1 = __importDefault(require("../tree/quoted")); -var anonymous_1 = __importDefault(require("../tree/anonymous")); -var javascript_1 = __importDefault(require("../tree/javascript")); -exports.default = { - e: function (str) { - return new quoted_1.default('"', str instanceof javascript_1.default ? str.evaluated : str.value, true); - }, - escape: function (str) { - return new anonymous_1.default(encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B') - .replace(/\(/g, '%28').replace(/\)/g, '%29')); - }, - replace: function (string, pattern, replacement, flags) { - var result = string.value; - replacement = (replacement.type === 'Quoted') ? - replacement.value : replacement.toCSS(); - result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement); - return new quoted_1.default(string.quote || '', result, string.escaped); - }, - '%': function (string /* arg, arg, ... */) { - var args = Array.prototype.slice.call(arguments, 1); - var result = string.value; - var _loop_1 = function (i) { - /* jshint loopfunc:true */ - result = result.replace(/%[sda]/i, function (token) { - var value = ((args[i].type === 'Quoted') && - token.match(/s/i)) ? args[i].value : args[i].toCSS(); - return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value; - }); - }; - for (var i = 0; i < args.length; i++) { - _loop_1(i); - } - result = result.replace(/%%/g, '%'); - return new quoted_1.default(string.quote || '', result, string.escaped); - } -}; -//# sourceMappingURL=string.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/string.js.map b/packages/less/lib/less/functions/string.js.map deleted file mode 100644 index d522fb958..000000000 --- a/packages/less/lib/less/functions/string.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/less/functions/string.js"],"names":[],"mappings":";;;;;AAAA,0DAAoC;AACpC,gEAA0C;AAC1C,kEAA4C;AAE5C,kBAAe;IACX,CAAC,EAAE,UAAU,GAAG;QACZ,OAAO,IAAI,gBAAM,CAAC,GAAG,EAAE,GAAG,YAAY,oBAAU,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACxF,CAAC;IACD,MAAM,EAAE,UAAU,GAAG;QACjB,OAAO,IAAI,mBAAS,CAChB,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;aACnG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,EAAE,UAAU,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK;QAClD,IAAI,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,WAAW,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC;YAC3C,WAAW,CAAC,KAAK,CA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QACpC,OAAO,IAAI,gBAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;CACJ,CAAC","sourcesContent":["import Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport JavaScript from '../tree/javascript';\n\nexport default {\n e: function (str) {\n return new Quoted('\"', str instanceof JavaScript ? str.evaluated : str.value, true);\n },\n escape: function (str) {\n return new Anonymous(\n encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B')\n .replace(/\\(/g, '%28').replace(/\\)/g, '%29'));\n },\n replace: function (string, pattern, replacement, flags) {\n let result = string.value;\n replacement = (replacement.type === 'Quoted') ?\n replacement.value : replacement.toCSS();\n result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement);\n return new Quoted(string.quote || '', result, string.escaped);\n },\n '%': function (string /* arg, arg, ... */) {\n const args = Array.prototype.slice.call(arguments, 1);\n let result = string.value;\n\n for (let i = 0; i < args.length; i++) {\n /* jshint loopfunc:true */\n result = result.replace(/%[sda]/i, token => {\n const value = ((args[i].type === 'Quoted') &&\n token.match(/s/i)) ? args[i].value : args[i].toCSS();\n return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value;\n });\n }\n result = result.replace(/%%/g, '%');\n return new Quoted(string.quote || '', result, string.escaped);\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/svg.js b/packages/less/lib/less/functions/svg.js deleted file mode 100644 index 5d3b2ecad..000000000 --- a/packages/less/lib/less/functions/svg.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var dimension_1 = __importDefault(require("../tree/dimension")); -var color_1 = __importDefault(require("../tree/color")); -var expression_1 = __importDefault(require("../tree/expression")); -var quoted_1 = __importDefault(require("../tree/quoted")); -var url_1 = __importDefault(require("../tree/url")); -exports.default = (function (environment) { - return { 'svg-gradient': function (direction) { - var stops; - var gradientDirectionSvg; - var gradientType = 'linear'; - var rectangleDimension = 'x="0" y="0" width="1" height="1"'; - var renderEnv = { compress: false }; - var returner; - var directionValue = direction.toCSS(renderEnv); - var i; - var color; - var position; - var positionValue; - var alpha; - function throwArgumentDescriptor() { - throw { type: 'Argument', - message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' + - ' end_color [end_position] or direction, color list' }; - } - if (arguments.length == 2) { - if (arguments[1].value.length < 2) { - throwArgumentDescriptor(); - } - stops = arguments[1].value; - } - else if (arguments.length < 3) { - throwArgumentDescriptor(); - } - else { - stops = Array.prototype.slice.call(arguments, 1); - } - switch (directionValue) { - case 'to bottom': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"'; - break; - case 'to right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="0%"'; - break; - case 'to bottom right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="100%"'; - break; - case 'to top right': - gradientDirectionSvg = 'x1="0%" y1="100%" x2="100%" y2="0%"'; - break; - case 'ellipse': - case 'ellipse at center': - gradientType = 'radial'; - gradientDirectionSvg = 'cx="50%" cy="50%" r="75%"'; - rectangleDimension = 'x="-50" y="-50" width="101" height="101"'; - break; - default: - throw { type: 'Argument', message: 'svg-gradient direction must be \'to bottom\', \'to right\',' + - ' \'to bottom right\', \'to top right\' or \'ellipse at center\'' }; - } - returner = "<" + gradientType + "Gradient id=\"g\" " + gradientDirectionSvg + ">"; - for (i = 0; i < stops.length; i += 1) { - if (stops[i] instanceof expression_1.default) { - color = stops[i].value[0]; - position = stops[i].value[1]; - } - else { - color = stops[i]; - position = undefined; - } - if (!(color instanceof color_1.default) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof dimension_1.default))) { - throwArgumentDescriptor(); - } - positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%'; - alpha = color.alpha; - returner += ""; - } - returner += ""; - returner = encodeURIComponent(returner); - returner = "data:image/svg+xml," + returner; - return new url_1.default(new quoted_1.default("'" + returner + "'", returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - } }; -}); -//# sourceMappingURL=svg.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/svg.js.map b/packages/less/lib/less/functions/svg.js.map deleted file mode 100644 index 7be97bb15..000000000 --- a/packages/less/lib/less/functions/svg.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../../src/less/functions/svg.js"],"names":[],"mappings":";;;;;AAAA,gEAA0C;AAC1C,wDAAkC;AAClC,kEAA4C;AAC5C,0DAAoC;AACpC,oDAA8B;AAE9B,mBAAe,UAAA,WAAW;IACtB,OAAO,EAAE,cAAc,EAAE,UAAS,SAAS;YACvC,IAAI,KAAK,CAAC;YACV,IAAI,oBAAoB,CAAC;YACzB,IAAI,YAAY,GAAG,QAAQ,CAAC;YAC5B,IAAI,kBAAkB,GAAG,kCAAkC,CAAC;YAC5D,IAAM,SAAS,GAAG,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;YACpC,IAAI,QAAQ,CAAC;YACb,IAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAClD,IAAI,CAAC,CAAC;YACN,IAAI,KAAK,CAAC;YACV,IAAI,QAAQ,CAAC;YACb,IAAI,aAAa,CAAC;YAClB,IAAI,KAAK,CAAC;YAEV,SAAS,uBAAuB;gBAC5B,MAAM,EAAE,IAAI,EAAE,UAAU;oBACpB,OAAO,EAAE,qFAAqF;wBAClF,oDAAoD,EAAE,CAAC;YAC3E,CAAC;YAED,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE;gBACvB,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC/B,uBAAu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nimport Quoted from '../tree/quoted';\nimport URL from '../tree/url';\n\nexport default environment => {\n return { 'svg-gradient': function(direction) {\n let stops;\n let gradientDirectionSvg;\n let gradientType = 'linear';\n let rectangleDimension = 'x=\"0\" y=\"0\" width=\"1\" height=\"1\"';\n const renderEnv = {compress: false};\n let returner;\n const directionValue = direction.toCSS(renderEnv);\n let i;\n let color;\n let position;\n let positionValue;\n let alpha;\n\n function throwArgumentDescriptor() {\n throw { type: 'Argument',\n message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' +\n ' end_color [end_position] or direction, color list' };\n }\n\n if (arguments.length == 2) {\n if (arguments[1].value.length < 2) {\n throwArgumentDescriptor();\n }\n stops = arguments[1].value;\n } else if (arguments.length < 3) {\n throwArgumentDescriptor();\n } else {\n stops = Array.prototype.slice.call(arguments, 1);\n }\n\n switch (directionValue) {\n case 'to bottom':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"';\n break;\n case 'to right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\"';\n break;\n case 'to bottom right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\"';\n break;\n case 'to top right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"100%\" x2=\"100%\" y2=\"0%\"';\n break;\n case 'ellipse':\n case 'ellipse at center':\n gradientType = 'radial';\n gradientDirectionSvg = 'cx=\"50%\" cy=\"50%\" r=\"75%\"';\n rectangleDimension = 'x=\"-50\" y=\"-50\" width=\"101\" height=\"101\"';\n break;\n default:\n throw { type: 'Argument', message: 'svg-gradient direction must be \\'to bottom\\', \\'to right\\',' +\n ' \\'to bottom right\\', \\'to top right\\' or \\'ellipse at center\\'' };\n }\n returner = `<${gradientType}Gradient id=\"g\" ${gradientDirectionSvg}>`;\n\n for (i = 0; i < stops.length; i += 1) {\n if (stops[i] instanceof Expression) {\n color = stops[i].value[0];\n position = stops[i].value[1];\n } else {\n color = stops[i];\n position = undefined;\n }\n\n if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {\n throwArgumentDescriptor();\n }\n positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%';\n alpha = color.alpha;\n returner += ``;\n }\n returner += ``;\n\n returner = encodeURIComponent(returner);\n\n returner = `data:image/svg+xml,${returner}`;\n return new URL(new Quoted(`'${returner}'`, returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo);\n }};\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/functions/types.js b/packages/less/lib/less/functions/types.js deleted file mode 100644 index be9c58887..000000000 --- a/packages/less/lib/less/functions/types.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var keyword_1 = __importDefault(require("../tree/keyword")); -var detached_ruleset_1 = __importDefault(require("../tree/detached-ruleset")); -var dimension_1 = __importDefault(require("../tree/dimension")); -var color_1 = __importDefault(require("../tree/color")); -var quoted_1 = __importDefault(require("../tree/quoted")); -var anonymous_1 = __importDefault(require("../tree/anonymous")); -var url_1 = __importDefault(require("../tree/url")); -var operation_1 = __importDefault(require("../tree/operation")); -var isa = function (n, Type) { return (n instanceof Type) ? keyword_1.default.True : keyword_1.default.False; }; -var isunit = function (n, unit) { - if (unit === undefined) { - throw { type: 'Argument', message: 'missing the required second argument to isunit.' }; - } - unit = typeof unit.value === 'string' ? unit.value : unit; - if (typeof unit !== 'string') { - throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' }; - } - return (n instanceof dimension_1.default) && n.unit.is(unit) ? keyword_1.default.True : keyword_1.default.False; -}; -exports.default = { - isruleset: function (n) { - return isa(n, detached_ruleset_1.default); - }, - iscolor: function (n) { - return isa(n, color_1.default); - }, - isnumber: function (n) { - return isa(n, dimension_1.default); - }, - isstring: function (n) { - return isa(n, quoted_1.default); - }, - iskeyword: function (n) { - return isa(n, keyword_1.default); - }, - isurl: function (n) { - return isa(n, url_1.default); - }, - ispixel: function (n) { - return isunit(n, 'px'); - }, - ispercentage: function (n) { - return isunit(n, '%'); - }, - isem: function (n) { - return isunit(n, 'em'); - }, - isunit: isunit, - unit: function (val, unit) { - if (!(val instanceof dimension_1.default)) { - throw { type: 'Argument', message: "the first argument to unit must be a number" + (val instanceof operation_1.default ? '. Have you forgotten parenthesis?' : '') }; - } - if (unit) { - if (unit instanceof keyword_1.default) { - unit = unit.value; - } - else { - unit = unit.toCSS(); - } - } - else { - unit = ''; - } - return new dimension_1.default(val.value, unit); - }, - 'get-unit': function (n) { - return new anonymous_1.default(n.unit); - } -}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/less/lib/less/functions/types.js.map b/packages/less/lib/less/functions/types.js.map deleted file mode 100644 index 7e1e38cb7..000000000 --- a/packages/less/lib/less/functions/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/less/functions/types.js"],"names":[],"mappings":";;;;;AAAA,4DAAsC;AACtC,8EAAuD;AACvD,gEAA0C;AAC1C,wDAAkC;AAClC,0DAAoC;AACpC,gEAA0C;AAC1C,oDAA8B;AAC9B,gEAA0C;AAE1C,IAAM,GAAG,GAAG,UAAC,CAAC,EAAE,IAAI,IAAK,OAAA,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAO,CAAC,KAAK,EAAlD,CAAkD,CAAC;AAC5E,IAAM,MAAM,GAAG,UAAC,CAAC,EAAE,IAAI;IACnB,IAAI,IAAI,KAAK,SAAS,EAAE;QACpB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,iDAAiD,EAAE,CAAC;KAC1F;IACD,IAAI,GAAG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ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,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,QAAA;IACN,IAAI,EAAE,UAAU,GAAG,EAAE,IAAI;QACrB,IAAI,CAAC,CAAC,GAAG,YAAY,mBAAS,CAAC,EAAE;YAC7B,MAAM,EAAE,IAAI,EAAE,UAAU,EACpB,OAAO,EAAE,iDAA8C,GAAG,YAAY,mBAAS,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,EAAE,CAAE,EAAE,CAAC;SACtI;QACD,IAAI,IAAI,EAAE;YACN,IAAI,IAAI,YAAY,iBAAO,EAAE;gBACzB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;aACrB;iBAAM;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;aACvB;SACJ;aAAM;YACH,IAAI,GAAG,EAAE,CAAC;SACb;QACD,OAAO,IAAI,mBAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IACD,UAAU,EAAE,UAAU,CAAC;QACnB,OAAO,IAAI,mBAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ,CAAC","sourcesContent":["import Keyword from '../tree/keyword';\nimport DetachedRuleset from '../tree/detached-ruleset';\nimport Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport URL from '../tree/url';\nimport Operation from '../tree/operation';\n\nconst isa = (n, Type) => (n instanceof Type) ? Keyword.True : Keyword.False;\nconst isunit = (n, unit) => {\n if (unit === undefined) {\n throw { type: 'Argument', message: 'missing the required second argument to isunit.' };\n }\n unit = typeof unit.value === 'string' ? unit.value : unit;\n if (typeof unit !== 'string') {\n throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' };\n }\n return (n instanceof Dimension) && n.unit.is(unit) ? Keyword.True : Keyword.False;\n};\n\nexport default {\n isruleset: function (n) {\n return isa(n, DetachedRuleset);\n },\n iscolor: function (n) {\n return isa(n, Color);\n },\n isnumber: function (n) {\n return isa(n, Dimension);\n },\n isstring: function (n) {\n return isa(n, Quoted);\n },\n iskeyword: function (n) {\n return isa(n, Keyword);\n },\n isurl: function (n) {\n return isa(n, URL);\n },\n ispixel: function (n) {\n return isunit(n, 'px');\n },\n ispercentage: function (n) {\n return isunit(n, '%');\n },\n isem: function (n) {\n return isunit(n, 'em');\n },\n isunit,\n unit: function (val, unit) {\n if (!(val instanceof Dimension)) {\n throw { type: 'Argument',\n message: `the first argument to unit must be a number${val instanceof Operation ? '. Have you forgotten parenthesis?' : ''}` };\n }\n if (unit) {\n if (unit instanceof Keyword) {\n unit = unit.value;\n } else {\n unit = unit.toCSS();\n }\n } else {\n unit = '';\n }\n return new Dimension(val.value, unit);\n },\n 'get-unit': function (n) {\n return new Anonymous(n.unit);\n }\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/import-manager.js b/packages/less/lib/less/import-manager.js deleted file mode 100644 index 04a6bfbe7..000000000 --- a/packages/less/lib/less/import-manager.js +++ /dev/null @@ -1,184 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var contexts_1 = __importDefault(require("./contexts")); -var parser_1 = __importDefault(require("./parser/parser")); -var less_error_1 = __importDefault(require("./less-error")); -var utils = __importStar(require("./utils")); -var logger_1 = __importDefault(require("./logger")); -exports.default = (function (environment) { - // FileInfo = { - // 'rewriteUrls' - option - whether to adjust URL's to be relative - // 'filename' - full resolved filename of current file - // 'rootpath' - path to append to normal URLs for this node - // 'currentDirectory' - path to the current file, absolute - // 'rootFilename' - filename of the base file - // 'entryPath' - absolute path to the entry file - // 'reference' - whether the file should not be output and only output parts that are referenced - var ImportManager = /** @class */ (function () { - function ImportManager(less, context, rootFileInfo) { - this.less = less; - this.rootFilename = rootFileInfo.filename; - this.paths = context.paths || []; // Search paths, when importing - this.contents = {}; // map - filename to contents of all the files - this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore - this.mime = context.mime; - this.error = null; - this.context = context; - // Deprecated? Unused outside of here, could be useful. - this.queue = []; // Files which haven't been imported yet - this.files = []; // List of files imported - } - /** - * Add an import to be imported - * @param path - the raw path - * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension) - * @param currentFileInfo - the current file info (used for instance to work out relative paths) - * @param importOptions - import options - * @param callback - callback for when it is imported - */ - ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) { - var importManager = this; - var pluginLoader = this.context.pluginManager.Loader; - this.queue.push(path); - var fileParsedFunc = function (e, root, fullPath) { - importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue - var importedEqualsRoot = fullPath === importManager.rootFilename; - if (importOptions.optional && e) { - callback(null, { rules: [] }, false, null); - logger_1.default.info("The file " + fullPath + " was skipped because it was not found and the import was marked optional."); - } - else { - var files = importManager.files; - if (files.indexOf(fullPath) === -1) { - files.push(fullPath); - } - if (e && !importManager.error) { - importManager.error = e; - } - callback(e, root, importedEqualsRoot, fullPath); - } - }; - var newFileInfo = { - rewriteUrls: this.context.rewriteUrls, - entryPath: currentFileInfo.entryPath, - rootpath: currentFileInfo.rootpath, - rootFilename: currentFileInfo.rootFilename - }; - var fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment); - if (!fileManager) { - fileParsedFunc({ message: "Could not find a file-manager for " + path }); - return; - } - var loadFileCallback = function (loadedFile) { - var plugin; - var resolvedFilename = loadedFile.filename; - var contents = loadedFile.contents.replace(/^\uFEFF/, ''); - // Pass on an updated rootpath if path of imported file is relative and file - // is in a (sub|sup) directory - // - // Examples: - // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/', - // then rootpath should become 'less/module/nav/' - // - If path of imported file is '../mixins.less' and rootpath is 'less/', - // then rootpath should become 'less/../' - newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename); - if (newFileInfo.rewriteUrls) { - newFileInfo.rootpath = fileManager.join((importManager.context.rootpath || ''), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath)); - if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) { - newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath); - } - } - newFileInfo.filename = resolvedFilename; - var newEnv = new contexts_1.default.Parse(importManager.context); - newEnv.processImports = false; - importManager.contents[resolvedFilename] = contents; - if (currentFileInfo.reference || importOptions.reference) { - newFileInfo.reference = true; - } - if (importOptions.isPlugin) { - plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo); - if (plugin instanceof less_error_1.default) { - fileParsedFunc(plugin, null, resolvedFilename); - } - else { - fileParsedFunc(null, plugin, resolvedFilename); - } - } - else if (importOptions.inline) { - fileParsedFunc(null, contents, resolvedFilename); - } - else { - new parser_1.default(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); - } - }; - var loadedFile; - var promise; - var context = utils.clone(this.context); - if (tryAppendExtension) { - context.ext = importOptions.isPlugin ? '.js' : '.less'; - } - if (importOptions.isPlugin) { - context.mime = 'application/javascript'; - if (context.syncImport) { - loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } - else { - promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } - } - else { - if (context.syncImport) { - loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment); - } - else { - promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment, function (err, loadedFile) { - if (err) { - fileParsedFunc(err); - } - else { - loadFileCallback(loadedFile); - } - }); - } - } - if (loadedFile) { - if (!loadedFile.filename) { - fileParsedFunc(loadedFile); - } - else { - loadFileCallback(loadedFile); - } - } - else if (promise) { - promise.then(loadFileCallback, fileParsedFunc); - } - }; - return ImportManager; - }()); - return ImportManager; -}); -//# sourceMappingURL=import-manager.js.map \ No newline at end of file diff --git a/packages/less/lib/less/import-manager.js.map b/packages/less/lib/less/import-manager.js.map deleted file mode 100644 index fc9f23b53..000000000 --- a/packages/less/lib/less/import-manager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"import-manager.js","sourceRoot":"","sources":["../../src/less/import-manager.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,2DAAqC;AACrC,4DAAqC;AACrC,6CAAiC;AACjC,oDAA8B;AAE9B,mBAAe,UAAA,WAAW;IACtB,eAAe;IACf,mEAAmE;IACnE,uDAAuD;IACvD,4DAA4D;IAC5D,2DAA2D;IAC3D,8CAA8C;IAC9C,iDAAiD;IACjD,iGAAiG;IAEjG;QACI,uBAAY,IAAI,EAAE,OAAO,EAAE,YAAY;YACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC;YAC1C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAE,+BAA+B;YAClE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAa,8CAA8C;YAC9E,IA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AC,UAAU,CAAC,CAAC;yBAChC;oBACL,CAAC,CAAC,CAAC;iBACV;aACJ;YACD,IAAI,UAAU,EAAE;gBACZ,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;oBACtB,cAAc,CAAC,UAAU,CAAC,CAAC;iBAC9B;qBAAM;oBACH,gBAAgB,CAAC,UAAU,CAAC,CAAC;iBAChC;aACJ;iBAAM,IAAI,OAAO,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;aAClD;QACL,CAAC;QACL,oBAAC;IAAD,CAAC,AAxJD,IAwJC;IAED,OAAO,aAAa,CAAC;AACzB,CAAC,EAAC","sourcesContent":["import contexts from './contexts';\nimport Parser from './parser/parser';\nimport LessError from './less-error';\nimport * as utils from './utils';\nimport logger from './logger';\n\nexport default environment => {\n // FileInfo = {\n // 'rewriteUrls' - option - whether to adjust URL's to be relative\n // 'filename' - full resolved filename of current file\n // 'rootpath' - path to append to normal URLs for this node\n // 'currentDirectory' - path to the current file, absolute\n // 'rootFilename' - filename of the base file\n // 'entryPath' - absolute path to the entry file\n // 'reference' - whether the file should not be output and only output parts that are referenced\n\n class ImportManager {\n constructor(less, context, rootFileInfo) {\n this.less = less;\n this.rootFilename = rootFileInfo.filename;\n this.paths = context.paths || []; // Search paths, when importing\n this.contents = {}; // map - filename to contents of all the files\n this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore\n this.mime = context.mime;\n this.error = null;\n this.context = context;\n // Deprecated? Unused outside of here, could be useful.\n this.queue = []; // Files which haven't been imported yet\n this.files = []; // List of files imported\n }\n\n /**\n * Add an import to be imported\n * @param path - the raw path\n * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension)\n * @param currentFileInfo - the current file info (used for instance to work out relative paths)\n * @param importOptions - import options\n * @param callback - callback for when it is imported\n */\n push(path, tryAppendExtension, currentFileInfo, importOptions, callback) {\n const importManager = this;\n const pluginLoader = this.context.pluginManager.Loader;\n\n this.queue.push(path);\n\n const fileParsedFunc = (e, root, fullPath) => {\n importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue\n\n const importedEqualsRoot = fullPath === importManager.rootFilename;\n if (importOptions.optional && e) {\n callback(null, {rules:[]}, false, null);\n logger.info(`The file ${fullPath} was skipped because it was not found and the import was marked optional.`);\n }\n else {\n const files = importManager.files\n if (files.indexOf(fullPath) === -1) {\n files.push(fullPath)\n }\n if (e && !importManager.error) { importManager.error = e; }\n callback(e, root, importedEqualsRoot, fullPath);\n }\n };\n\n const newFileInfo = {\n rewriteUrls: this.context.rewriteUrls,\n entryPath: currentFileInfo.entryPath,\n rootpath: currentFileInfo.rootpath,\n rootFilename: currentFileInfo.rootFilename\n };\n\n const fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment);\n\n if (!fileManager) {\n fileParsedFunc({ message: `Could not find a file-manager for ${path}` });\n return;\n }\n\n const loadFileCallback = loadedFile => {\n let plugin;\n const resolvedFilename = loadedFile.filename;\n const contents = loadedFile.contents.replace(/^\\uFEFF/, '');\n\n // Pass on an updated rootpath if path of imported file is relative and file\n // is in a (sub|sup) directory\n //\n // Examples:\n // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/',\n // then rootpath should become 'less/module/nav/'\n // - If path of imported file is '../mixins.less' and rootpath is 'less/',\n // then rootpath should become 'less/../'\n newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);\n if (newFileInfo.rewriteUrls) {\n newFileInfo.rootpath = fileManager.join(\n (importManager.context.rootpath || ''),\n fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));\n\n if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {\n newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);\n }\n }\n newFileInfo.filename = resolvedFilename;\n\n const newEnv = new contexts.Parse(importManager.context);\n\n newEnv.processImports = false;\n importManager.contents[resolvedFilename] = contents;\n\n if (currentFileInfo.reference || importOptions.reference) {\n newFileInfo.reference = true;\n }\n\n if (importOptions.isPlugin) {\n plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo);\n if (plugin instanceof LessError) {\n fileParsedFunc(plugin, null, resolvedFilename);\n }\n else {\n fileParsedFunc(null, plugin, resolvedFilename);\n }\n } else if (importOptions.inline) {\n fileParsedFunc(null, contents, resolvedFilename);\n } else {\n new Parser(newEnv, importManager, newFileInfo).parse(contents, (e, root) => {\n fileParsedFunc(e, root, resolvedFilename);\n });\n }\n };\n let loadedFile;\n let promise;\n const context = utils.clone(this.context);\n\n if (tryAppendExtension) {\n context.ext = importOptions.isPlugin ? '.js' : '.less';\n }\n\n if (importOptions.isPlugin) {\n context.mime = 'application/javascript';\n\n if (context.syncImport) {\n loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager);\n } else {\n promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager);\n }\n }\n else {\n if (context.syncImport) {\n loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment);\n } else {\n promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment,\n (err, loadedFile) => {\n if (err) {\n fileParsedFunc(err);\n } else {\n loadFileCallback(loadedFile);\n }\n });\n }\n }\n if (loadedFile) {\n if (!loadedFile.filename) {\n fileParsedFunc(loadedFile);\n } else {\n loadFileCallback(loadedFile);\n }\n } else if (promise) {\n promise.then(loadFileCallback, fileParsedFunc);\n }\n }\n }\n\n return ImportManager;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/index.js b/packages/less/lib/less/index.js deleted file mode 100644 index 502566a33..000000000 --- a/packages/less/lib/less/index.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __spreadArrays = (this && this.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var data_1 = __importDefault(require("./data")); -var tree_1 = __importDefault(require("./tree")); -var environment_1 = __importDefault(require("./environment/environment")); -var abstract_file_manager_1 = __importDefault(require("./environment/abstract-file-manager")); -var abstract_plugin_loader_1 = __importDefault(require("./environment/abstract-plugin-loader")); -var visitors_1 = __importDefault(require("./visitors")); -var parser_1 = __importDefault(require("./parser/parser")); -var functions_1 = __importDefault(require("./functions")); -var contexts_1 = __importDefault(require("./contexts")); -var source_map_output_1 = __importDefault(require("./source-map-output")); -var source_map_builder_1 = __importDefault(require("./source-map-builder")); -var parse_tree_1 = __importDefault(require("./parse-tree")); -var import_manager_1 = __importDefault(require("./import-manager")); -var render_1 = __importDefault(require("./render")); -var parse_1 = __importDefault(require("./parse")); -var less_error_1 = __importDefault(require("./less-error")); -var transform_tree_1 = __importDefault(require("./transform-tree")); -var utils = __importStar(require("./utils")); -var plugin_manager_1 = __importDefault(require("./plugin-manager")); -var logger_1 = __importDefault(require("./logger")); -exports.default = (function (environment, fileManagers) { - /** - * @todo - * This original code could be improved quite a bit. - * Many classes / modules currently add side-effects / mutations to passed in objects, - * which makes it hard to refactor and reason about. - */ - environment = new environment_1.default(environment, fileManagers); - var SourceMapOutput = source_map_output_1.default(environment); - var SourceMapBuilder = source_map_builder_1.default(SourceMapOutput, environment); - var ParseTree = parse_tree_1.default(SourceMapBuilder); - var ImportManager = import_manager_1.default(environment); - var render = render_1.default(environment, ParseTree, ImportManager); - var parse = parse_1.default(environment, ParseTree, ImportManager); - var functions = functions_1.default(environment); - /** - * @todo - * This root properties / methods need to be organized. - * It's not clear what should / must be public and why. - */ - var initial = { - version: [3, 12, 0], - data: data_1.default, - tree: tree_1.default, - Environment: environment_1.default, - AbstractFileManager: abstract_file_manager_1.default, - AbstractPluginLoader: abstract_plugin_loader_1.default, - environment: environment, - visitors: visitors_1.default, - Parser: parser_1.default, - functions: functions, - contexts: contexts_1.default, - SourceMapOutput: SourceMapOutput, - SourceMapBuilder: SourceMapBuilder, - ParseTree: ParseTree, - ImportManager: ImportManager, - render: render, - parse: parse, - LessError: less_error_1.default, - transformTree: transform_tree_1.default, - utils: utils, - PluginManager: plugin_manager_1.default, - logger: logger_1.default - }; - // Create a public API - var ctor = function (t) { return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return new (t.bind.apply(t, __spreadArrays([void 0], args)))(); - }; }; - var t; - var api = Object.create(initial); - for (var n in initial.tree) { - /* eslint guard-for-in: 0 */ - t = initial.tree[n]; - if (typeof t === 'function') { - api[n.toLowerCase()] = ctor(t); - } - else { - api[n] = Object.create(null); - for (var o in t) { - /* eslint guard-for-in: 0 */ - api[n][o.toLowerCase()] = ctor(t[o]); - } - } - } - return api; -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/less/lib/less/index.js.map b/packages/less/lib/less/index.js.map deleted file mode 100644 index a58598e79..000000000 --- a/packages/less/lib/less/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceR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,oBAAA;QACR,eAAe,iBAAA;QACf,gBAAgB,kBAAA;QAChB,SAAS,WAAA;QACT,aAAa,eAAA;QACb,MAAM,QAAA;QACN,KAAK,OAAA;QACL,SAAS,sBAAA;QACT,aAAa,0BAAA;QACb,KAAK,OAAA;QACL,aAAa,0BAAA;QACb,MAAM,kBAAA;KACT,CAAC;IAEF,sBAAsB;IACtB,IAAM,IAAI,GAAG,UAAA,CAAC,IAAI,OAAA;QAAU,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QAC/B,YAAW,CAAC,YAAD,CAAC,2BAAI,IAAI,MAAE;IAC1B,CAAC,EAFiB,CAEjB,CAAC;IAEF,IAAI,CAAC,CAAC;IACN,IAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,KAAK,IAAM,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE;QAC1B,4BAA4B;QAC5B,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE;YACzB,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;SAClC;aACI;YACD,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7B,KAAK,IAAM,CAAC,IAAI,CAAC,EAAE;gBACf,4BAA4B;gBAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACxC;SACJ;KACJ;IAED,OAAO,GAAG,CAAC;AACf,CAAC,EAAC","sourcesContent":["import data from './data';\nimport tree from './tree';\nimport Environment from './environment/environment';\nimport AbstractFileManager from './environment/abstract-file-manager';\nimport AbstractPluginLoader from './environment/abstract-plugin-loader';\nimport visitors from './visitors';\nimport Parser from './parser/parser';\nimport Functions from './functions';\nimport contexts from './contexts';\nimport sourceMapOutput from './source-map-output';\nimport sourceMapBuilder from './source-map-builder';\nimport parseTree from './parse-tree';\nimport importManager from './import-manager';\nimport Render from './render';\nimport Parse from './parse';\nimport LessError from './less-error';\nimport transformTree from './transform-tree';\nimport * as utils from './utils';\nimport PluginManager from './plugin-manager';\nimport logger from './logger';\n\nexport default (environment, fileManagers) => {\n /**\n * @todo\n * This original code could be improved quite a bit.\n * Many classes / modules currently add side-effects / mutations to passed in objects,\n * which makes it hard to refactor and reason about. \n */\n environment = new Environment(environment, fileManagers);\n\n const SourceMapOutput = sourceMapOutput(environment);\n const SourceMapBuilder = sourceMapBuilder(SourceMapOutput, environment);\n const ParseTree = parseTree(SourceMapBuilder);\n const ImportManager = importManager(environment);\n const render = Render(environment, ParseTree, ImportManager);\n const parse = Parse(environment, ParseTree, ImportManager);\n const functions = Functions(environment);\n\n /**\n * @todo\n * This root properties / methods need to be organized.\n * It's not clear what should / must be public and why.\n */\n const initial = {\n version: [3, 12, 0],\n data,\n tree,\n Environment,\n AbstractFileManager,\n AbstractPluginLoader,\n environment,\n visitors,\n Parser,\n functions,\n contexts,\n SourceMapOutput,\n SourceMapBuilder,\n ParseTree,\n ImportManager,\n render,\n parse,\n LessError,\n transformTree,\n utils,\n PluginManager,\n logger\n };\n\n // Create a public API\n const ctor = t => function (...args) {\n return new t(...args);\n };\n\n let t;\n const api = Object.create(initial);\n for (const n in initial.tree) {\n /* eslint guard-for-in: 0 */\n t = initial.tree[n];\n if (typeof t === 'function') {\n api[n.toLowerCase()] = ctor(t);\n }\n else {\n api[n] = Object.create(null);\n for (const o in t) {\n /* eslint guard-for-in: 0 */\n api[n][o.toLowerCase()] = ctor(t[o]);\n }\n }\n }\n\n return api;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/less-error.js b/packages/less/lib/less/less-error.js deleted file mode 100644 index c8b448eb1..000000000 --- a/packages/less/lib/less/less-error.js +++ /dev/null @@ -1,162 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var utils = __importStar(require("./utils")); -var anonymousFunc = /(|Function):(\d+):(\d+)/; -/** - * This is a centralized class of any error that could be thrown internally (mostly by the parser). - * Besides standard .message it keeps some additional data like a path to the file where the error - * occurred along with line and column numbers. - * - * @class - * @extends Error - * @type {module.LessError} - * - * @prop {string} type - * @prop {string} filename - * @prop {number} index - * @prop {number} line - * @prop {number} column - * @prop {number} callLine - * @prop {number} callExtract - * @prop {string[]} extract - * - * @param {Object} e - An error object to wrap around or just a descriptive object - * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager? - * @param {string} [currentFilename] - */ -var LessError = function LessError(e, fileContentMap, currentFilename) { - Error.call(this); - var filename = e.filename || currentFilename; - this.message = e.message; - this.stack = e.stack; - if (fileContentMap && filename) { - var input = fileContentMap.contents[filename]; - var loc = utils.getLocation(e.index, input); - var line = loc.line; - var col = loc.column; - var callLine = e.call && utils.getLocation(e.call, input).line; - var lines = input ? input.split('\n') : ''; - this.type = e.type || 'Syntax'; - this.filename = filename; - this.index = e.index; - this.line = typeof line === 'number' ? line + 1 : null; - this.column = col; - if (!this.line && this.stack) { - var found = this.stack.match(anonymousFunc); - /** - * We have to figure out how this environment stringifies anonymous functions - * so we can correctly map plugin errors. - * - * Note, in Node 8, the output of anonymous funcs varied based on parameters - * being present or not, so we inject dummy params. - */ - var func = new Function('a', 'throw new Error()'); - var lineAdjust = 0; - try { - func(); - } - catch (e) { - var match = e.stack.match(anonymousFunc); - var line_1 = parseInt(match[2]); - lineAdjust = 1 - line_1; - } - if (found) { - if (found[2]) { - this.line = parseInt(found[2]) + lineAdjust; - } - if (found[3]) { - this.column = parseInt(found[3]); - } - } - } - this.callLine = callLine + 1; - this.callExtract = lines[callLine]; - this.extract = [ - lines[this.line - 2], - lines[this.line - 1], - lines[this.line] - ]; - } -}; -if (typeof Object.create === 'undefined') { - var F = function () { }; - F.prototype = Error.prototype; - LessError.prototype = new F(); -} -else { - LessError.prototype = Object.create(Error.prototype); -} -LessError.prototype.constructor = LessError; -/** - * An overridden version of the default Object.prototype.toString - * which uses additional information to create a helpful message. - * - * @param {Object} options - * @returns {string} - */ -LessError.prototype.toString = function (options) { - if (options === void 0) { options = {}; } - var message = ''; - var extract = this.extract || []; - var error = []; - var stylize = function (str) { return str; }; - if (options.stylize) { - var type = typeof options.stylize; - if (type !== 'function') { - throw Error("options.stylize should be a function, got a " + type + "!"); - } - stylize = options.stylize; - } - if (this.line !== null) { - if (typeof extract[0] === 'string') { - error.push(stylize(this.line - 1 + " " + extract[0], 'grey')); - } - if (typeof extract[1] === 'string') { - var errorTxt = this.line + " "; - if (extract[1]) { - errorTxt += extract[1].slice(0, this.column) + - stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + - extract[1].slice(this.column + 1), 'red'), 'inverse'); - } - error.push(errorTxt); - } - if (typeof extract[2] === 'string') { - error.push(stylize(this.line + 1 + " " + extract[2], 'grey')); - } - error = error.join('\n') + stylize('', 'reset') + "\n"; - } - message += stylize(this.type + "Error: " + this.message, 'red'); - if (this.filename) { - message += stylize(' in ', 'red') + this.filename; - } - if (this.line) { - message += stylize(" on line " + this.line + ", column " + (this.column + 1) + ":", 'grey'); - } - message += "\n" + error; - if (this.callLine) { - message += stylize('from ', 'red') + (this.filename || '') + "/n"; - message += stylize(this.callLine, 'grey') + " " + this.callExtract + "/n"; - } - return message; -}; -exports.default = LessError; -//# sourceMappingURL=less-error.js.map \ No newline at end of file diff --git a/packages/less/lib/less/less-error.js.map b/packages/less/lib/less/less-error.js.map deleted file mode 100644 index 970491ec9..000000000 --- a/packages/less/lib/less/less-error.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"less-error.js","sourceRoot":"","sources":["../../src/less/less-error.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiC;AAEjC,IAAM,aAAa,GAAG,oCAAoC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,IAAM,SAAS,GAAG,SAAS,SAAS,CAAC,CAAC,EAAE,cAAc,EAAE,eAAe;IACnE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjB,IAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,IAAI,eAAe,CAAC;IAE/C,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;IACzB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IAErB,IAAI,cAAc,IAAI,QAAQ,EAAE;QAC5B,IAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAM,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC9C,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACtB,IAAM,GAAG,GAAI,GAAG,CAAC,MAAM,CAAC;QACxB,IAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC;QACjE,IAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK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E,KAAK,CAAC,CAAC;IAChE,IAAI,IAAI,CAAC,QAAQ,EAAE;QACf,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;KACrD;IACD,IAAI,IAAI,CAAC,IAAI,EAAE;QACX,OAAO,IAAI,OAAO,CAAC,cAAY,IAAI,CAAC,IAAI,kBAAY,IAAI,CAAC,MAAM,GAAG,CAAC,OAAG,EAAE,MAAM,CAAC,CAAC;KACnF;IAED,OAAO,IAAI,OAAK,KAAO,CAAC;IAExB,IAAI,IAAI,CAAC,QAAQ,EAAE;QACf,OAAO,IAAO,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,OAAI,CAAC;QAClE,OAAO,IAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAI,IAAI,CAAC,WAAW,OAAI,CAAC;KACxE;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["import * as utils from './utils';\n\nconst anonymousFunc = /(|Function):(\\d+):(\\d+)/;\n\n/**\n * This is a centralized class of any error that could be thrown internally (mostly by the parser).\n * Besides standard .message it keeps some additional data like a path to the file where the error\n * occurred along with line and column numbers.\n *\n * @class\n * @extends Error\n * @type {module.LessError}\n *\n * @prop {string} type\n * @prop {string} filename\n * @prop {number} index\n * @prop {number} line\n * @prop {number} column\n * @prop {number} callLine\n * @prop {number} callExtract\n * @prop {string[]} extract\n *\n * @param {Object} e - An error object to wrap around or just a descriptive object\n * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager?\n * @param {string} [currentFilename]\n */\nconst LessError = function LessError(e, fileContentMap, currentFilename) {\n Error.call(this);\n\n const filename = e.filename || currentFilename;\n\n this.message = e.message;\n this.stack = e.stack;\n\n if (fileContentMap && filename) {\n const input = fileContentMap.contents[filename];\n const loc = utils.getLocation(e.index, input);\n const line = loc.line;\n const col = loc.column;\n const callLine = e.call && utils.getLocation(e.call, input).line;\n const lines = input ? input.split('\\n') : '';\n\n this.type = e.type || 'Syntax';\n this.filename = filename;\n this.index = e.index;\n this.line = typeof line === 'number' ? line + 1 : null;\n this.column = col;\n\n if (!this.line && this.stack) {\n const found = this.stack.match(anonymousFunc);\n\n /**\n * We have to figure out how this environment stringifies anonymous functions\n * so we can correctly map plugin errors.\n * \n * Note, in Node 8, the output of anonymous funcs varied based on parameters\n * being present or not, so we inject dummy params.\n */\n const func = new Function('a', 'throw new Error()');\n let lineAdjust = 0;\n try {\n func();\n } catch (e) {\n const match = e.stack.match(anonymousFunc);\n const line = parseInt(match[2]);\n lineAdjust = 1 - line;\n }\n\n if (found) {\n if (found[2]) {\n this.line = parseInt(found[2]) + lineAdjust;\n }\n if (found[3]) {\n this.column = parseInt(found[3]);\n }\n }\n }\n\n this.callLine = callLine + 1;\n this.callExtract = lines[callLine];\n\n this.extract = [\n lines[this.line - 2],\n lines[this.line - 1],\n lines[this.line]\n ];\n }\n\n};\n\nif (typeof Object.create === 'undefined') {\n const F = () => {};\n F.prototype = Error.prototype;\n LessError.prototype = new F();\n} else {\n LessError.prototype = Object.create(Error.prototype);\n}\n\nLessError.prototype.constructor = LessError;\n\n/**\n * An overridden version of the default Object.prototype.toString\n * which uses additional information to create a helpful message.\n *\n * @param {Object} options\n * @returns {string}\n */\nLessError.prototype.toString = function(options = {}) {\n let message = '';\n const extract = this.extract || [];\n let error = [];\n let stylize = str => str;\n if (options.stylize) {\n const type = typeof options.stylize;\n if (type !== 'function') {\n throw Error(`options.stylize should be a function, got a ${type}!`);\n }\n stylize = options.stylize;\n }\n\n if (this.line !== null) {\n if (typeof extract[0] === 'string') {\n error.push(stylize(`${this.line - 1} ${extract[0]}`, 'grey'));\n }\n\n if (typeof extract[1] === 'string') {\n let errorTxt = `${this.line} `;\n if (extract[1]) {\n errorTxt += extract[1].slice(0, this.column) +\n stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') +\n extract[1].slice(this.column + 1), 'red'), 'inverse');\n }\n error.push(errorTxt);\n }\n\n if (typeof extract[2] === 'string') {\n error.push(stylize(`${this.line + 1} ${extract[2]}`, 'grey'));\n }\n error = `${error.join('\\n') + stylize('', 'reset')}\\n`;\n }\n\n message += stylize(`${this.type}Error: ${this.message}`, 'red');\n if (this.filename) {\n message += stylize(' in ', 'red') + this.filename;\n }\n if (this.line) {\n message += stylize(` on line ${this.line}, column ${this.column + 1}:`, 'grey');\n }\n\n message += `\\n${error}`;\n\n if (this.callLine) {\n message += `${stylize('from ', 'red') + (this.filename || '')}/n`;\n message += `${stylize(this.callLine, 'grey')} ${this.callExtract}/n`;\n }\n\n return message;\n};\n\nexport default LessError;"]} \ No newline at end of file diff --git a/packages/less/lib/less/logger.js b/packages/less/lib/less/logger.js deleted file mode 100644 index a6ceccd1c..000000000 --- a/packages/less/lib/less/logger.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = { - error: function (msg) { - this._fireEvent('error', msg); - }, - warn: function (msg) { - this._fireEvent('warn', msg); - }, - info: function (msg) { - this._fireEvent('info', msg); - }, - debug: function (msg) { - this._fireEvent('debug', msg); - }, - addListener: function (listener) { - this._listeners.push(listener); - }, - removeListener: function (listener) { - for (var i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] === listener) { - this._listeners.splice(i, 1); - return; - } - } - }, - _fireEvent: function (type, msg) { - for (var i = 0; i < this._listeners.length; i++) { - var logFunction = this._listeners[i][type]; - if (logFunction) { - logFunction(msg); - } - } - }, - _listeners: [] -}; -//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/packages/less/lib/less/logger.js.map b/packages/less/lib/less/logger.js.map deleted file mode 100644 index 4d6df13ac..000000000 --- a/packages/less/lib/less/logger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/less/logger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) {\n this._fireEvent('error', msg);\n },\n warn: function(msg) {\n this._fireEvent('warn', msg);\n },\n info: function(msg) {\n this._fireEvent('info', msg);\n },\n debug: function(msg) {\n this._fireEvent('debug', msg);\n },\n addListener: function(listener) {\n this._listeners.push(listener);\n },\n removeListener: function(listener) {\n for (let i = 0; i < this._listeners.length; i++) {\n if (this._listeners[i] === listener) {\n this._listeners.splice(i, 1);\n return;\n }\n }\n },\n _fireEvent: function(type, msg) {\n for (let i = 0; i < this._listeners.length; i++) {\n const logFunction = this._listeners[i][type];\n if (logFunction) {\n logFunction(msg);\n }\n }\n },\n _listeners: []\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/parse-tree.js b/packages/less/lib/less/parse-tree.js deleted file mode 100644 index b69b22a50..000000000 --- a/packages/less/lib/less/parse-tree.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var less_error_1 = __importDefault(require("./less-error")); -var transform_tree_1 = __importDefault(require("./transform-tree")); -var logger_1 = __importDefault(require("./logger")); -exports.default = (function (SourceMapBuilder) { - var ParseTree = /** @class */ (function () { - function ParseTree(root, imports) { - this.root = root; - this.imports = imports; - } - ParseTree.prototype.toCSS = function (options) { - var evaldRoot; - var result = {}; - var sourceMapBuilder; - try { - evaldRoot = transform_tree_1.default(this.root, options); - } - catch (e) { - throw new less_error_1.default(e, this.imports); - } - try { - var compress = Boolean(options.compress); - if (compress) { - logger_1.default.warn('The compress option has been deprecated. ' + - 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.'); - } - var toCSSOptions = { - compress: compress, - dumpLineNumbers: options.dumpLineNumbers, - strictUnits: Boolean(options.strictUnits), - numPrecision: 8 - }; - if (options.sourceMap) { - sourceMapBuilder = new SourceMapBuilder(options.sourceMap); - result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports); - } - else { - result.css = evaldRoot.toCSS(toCSSOptions); - } - } - catch (e) { - throw new less_error_1.default(e, this.imports); - } - if (options.pluginManager) { - var postProcessors = options.pluginManager.getPostProcessors(); - for (var i = 0; i < postProcessors.length; i++) { - result.css = postProcessors[i].process(result.css, { sourceMap: sourceMapBuilder, options: options, imports: this.imports }); - } - } - if (options.sourceMap) { - result.map = sourceMapBuilder.getExternalSourceMap(); - } - var rootFilename = this.imports.rootFilename; - result.imports = this.imports.files.filter(function (file) { return file !== rootFilename; }); - return result; - }; - return ParseTree; - }()); - return ParseTree; -}); -//# sourceMappingURL=parse-tree.js.map \ No newline at end of file diff --git a/packages/less/lib/less/parse-tree.js.map b/packages/less/lib/less/parse-tree.js.map deleted file mode 100644 index c7de2c670..000000000 --- a/packages/less/lib/less/parse-tree.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse-tree.js","sourceRoot":"","sources":["../../src/less/parse-tree.js"],"names":[],"mappings":";;;;;AAAA,4DAAqC;AACrC,oEAA6C;AAC7C,oDAA8B;AAE9B,mBAAe,UAAA,gBAAgB;IAC3B;QACI,mBAAY,IAAI,EAAE,OAAO;YACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAC3B,CAAC;QAED,yBAAK,GAAL,UAAM,OAAO;YACT,IAAI,SAAS,CAAC;YACd,IAAM,MAAM,GAAG,EAAE,CAAC;YAClB,IAAI,gBAAgB,CAAC;YACrB,IAAI;gBACA,SAAS,GAAG,wBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aACjD;YAAC,OAAO,CAAC,EAAE;gBACR,MAAM,IAAI,oBAAS,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;aACxC;YAED,IAAI;gBACA,IAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC3C,IAAI,QAAQ,EAAE;oBACV,gB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AC,YAAY,CAAA;YAC9C,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,KAAK,YAAY,EAArB,CAAqB,CAAC,CAAC;YAC1E,OAAO,MAAM,CAAC;QAClB,CAAC;QACL,gBAAC;IAAD,CAAC,AArDD,IAqDC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC,EAAC","sourcesContent":["import LessError from './less-error';\nimport transformTree from './transform-tree';\nimport logger from './logger';\n\nexport default SourceMapBuilder => {\n class ParseTree {\n constructor(root, imports) {\n this.root = root;\n this.imports = imports;\n }\n\n toCSS(options) {\n let evaldRoot;\n const result = {};\n let sourceMapBuilder;\n try {\n evaldRoot = transformTree(this.root, options);\n } catch (e) {\n throw new LessError(e, this.imports);\n }\n\n try {\n const compress = Boolean(options.compress);\n if (compress) {\n logger.warn('The compress option has been deprecated. ' + \n 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.');\n }\n\n const toCSSOptions = {\n compress,\n dumpLineNumbers: options.dumpLineNumbers,\n strictUnits: Boolean(options.strictUnits),\n numPrecision: 8};\n\n if (options.sourceMap) {\n sourceMapBuilder = new SourceMapBuilder(options.sourceMap);\n result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports);\n } else {\n result.css = evaldRoot.toCSS(toCSSOptions);\n }\n } catch (e) {\n throw new LessError(e, this.imports);\n }\n\n if (options.pluginManager) {\n const postProcessors = options.pluginManager.getPostProcessors();\n for (let i = 0; i < postProcessors.length; i++) {\n result.css = postProcessors[i].process(result.css, { sourceMap: sourceMapBuilder, options, imports: this.imports });\n }\n }\n if (options.sourceMap) {\n result.map = sourceMapBuilder.getExternalSourceMap();\n }\n\n const rootFilename = this.imports.rootFilename\n result.imports = this.imports.files.filter(file => file !== rootFilename);\n return result;\n }\n }\n\n return ParseTree;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/parse.js b/packages/less/lib/less/parse.js deleted file mode 100644 index 3fefb193a..000000000 --- a/packages/less/lib/less/parse.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var PromiseConstructor; -var contexts_1 = __importDefault(require("./contexts")); -var parser_1 = __importDefault(require("./parser/parser")); -var plugin_manager_1 = __importDefault(require("./plugin-manager")); -var less_error_1 = __importDefault(require("./less-error")); -var utils = __importStar(require("./utils")); -exports.default = (function (environment, ParseTree, ImportManager) { - var parse = function (input, options, callback) { - if (typeof options === 'function') { - callback = options; - options = utils.copyOptions(this.options, {}); - } - else { - options = utils.copyOptions(this.options, options || {}); - } - if (!callback) { - var self_1 = this; - return new Promise(function (resolve, reject) { - parse.call(self_1, input, options, function (err, output) { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - else { - var context_1; - var rootFileInfo = void 0; - var pluginManager_1 = new plugin_manager_1.default(this, !options.reUsePluginManager); - options.pluginManager = pluginManager_1; - context_1 = new contexts_1.default.Parse(options); - if (options.rootFileInfo) { - rootFileInfo = options.rootFileInfo; - } - else { - var filename = options.filename || 'input'; - var entryPath = filename.replace(/[^\/\\]*$/, ''); - rootFileInfo = { - filename: filename, - rewriteUrls: context_1.rewriteUrls, - rootpath: context_1.rootpath || '', - currentDirectory: entryPath, - entryPath: entryPath, - rootFilename: filename - }; - // add in a missing trailing slash - if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') { - rootFileInfo.rootpath += '/'; - } - } - var imports_1 = new ImportManager(this, context_1, rootFileInfo); - this.importManager = imports_1; - // TODO: allow the plugins to be just a list of paths or names - // Do an async plugin queue like lessc - if (options.plugins) { - options.plugins.forEach(function (plugin) { - var evalResult; - var contents; - if (plugin.fileContent) { - contents = plugin.fileContent.replace(/^\uFEFF/, ''); - evalResult = pluginManager_1.Loader.evalPlugin(contents, context_1, imports_1, plugin.options, plugin.filename); - if (evalResult instanceof less_error_1.default) { - return callback(evalResult); - } - } - else { - pluginManager_1.addPlugin(plugin); - } - }); - } - new parser_1.default(context_1, imports_1, rootFileInfo) - .parse(input, function (e, root) { - if (e) { - return callback(e); - } - callback(null, root, imports_1, options); - }, options); - } - }; - return parse; -}); -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/packages/less/lib/less/parse.js.map b/packages/less/lib/less/parse.js.map deleted file mode 100644 index 8452f366f..000000000 --- a/packages/less/lib/less/parse.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/less/parse.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,kBAAkB,CAAC;AACvB,wDAAkC;AAClC,2DAAqC;AACrC,oEAA6C;AAC7C,4DAAqC;AACrC,6CAAiC;AAEjC,mBAAe,UAAC,WAAW,EAAE,SAAS,EAAE,aAAa;IACjD,IAAM,KAAK,GAAG,UAAU,KAAK,EAAE,OAAO,EAAE,QAAQ;QAE5C,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YAC/B,QAAQ,GAAG,OAAO,CAAC;YACnB,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE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,OAAO,CAAC,CAAC;SACnB;IACL,CAAC,CAAC;IACF,OAAO,KAAK,CAAC;AACjB,CAAC,EAAC","sourcesContent":["let PromiseConstructor;\nimport contexts from './contexts';\nimport Parser from './parser/parser';\nimport PluginManager from './plugin-manager';\nimport LessError from './less-error';\nimport * as utils from './utils';\n\nexport default (environment, ParseTree, ImportManager) => {\n const parse = function (input, options, callback) {\n\n if (typeof options === 'function') {\n callback = options;\n options = utils.copyOptions(this.options, {});\n }\n else {\n options = utils.copyOptions(this.options, options || {});\n }\n\n if (!callback) {\n const self = this;\n return new Promise((resolve, reject) => {\n parse.call(self, input, options, (err, output) => {\n if (err) {\n reject(err);\n } else {\n resolve(output);\n }\n });\n });\n } else {\n let context;\n let rootFileInfo;\n const pluginManager = new PluginManager(this, !options.reUsePluginManager);\n\n options.pluginManager = pluginManager;\n\n context = new contexts.Parse(options);\n\n if (options.rootFileInfo) {\n rootFileInfo = options.rootFileInfo;\n } else {\n const filename = options.filename || 'input';\n const entryPath = filename.replace(/[^\\/\\\\]*$/, '');\n rootFileInfo = {\n filename,\n rewriteUrls: context.rewriteUrls,\n rootpath: context.rootpath || '',\n currentDirectory: entryPath,\n entryPath,\n rootFilename: filename\n };\n // add in a missing trailing slash\n if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') {\n rootFileInfo.rootpath += '/';\n }\n }\n\n const imports = new ImportManager(this, context, rootFileInfo);\n this.importManager = imports;\n\n // TODO: allow the plugins to be just a list of paths or names\n // Do an async plugin queue like lessc\n\n if (options.plugins) {\n options.plugins.forEach(plugin => {\n let evalResult;\n let contents;\n if (plugin.fileContent) {\n contents = plugin.fileContent.replace(/^\\uFEFF/, '');\n evalResult = pluginManager.Loader.evalPlugin(contents, context, imports, plugin.options, plugin.filename);\n if (evalResult instanceof LessError) {\n return callback(evalResult);\n }\n }\n else {\n pluginManager.addPlugin(plugin);\n }\n });\n }\n\n new Parser(context, imports, rootFileInfo)\n .parse(input, (e, root) => {\n if (e) { return callback(e); }\n callback(null, root, imports, options);\n }, options);\n }\n };\n return parse;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/parser/chunker.js b/packages/less/lib/less/parser/chunker.js deleted file mode 100644 index c6ee0e4b4..000000000 --- a/packages/less/lib/less/parser/chunker.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// Split the input into chunks. -exports.default = (function (input, fail) { - var len = input.length; - var level = 0; - var parenLevel = 0; - var lastOpening; - var lastOpeningParen; - var lastMultiComment; - var lastMultiCommentEndBrace; - var chunks = []; - var emitFrom = 0; - var chunkerCurrentIndex; - var currentChunkStartIndex; - var cc; - var cc2; - var matched; - function emitChunk(force) { - var len = chunkerCurrentIndex - emitFrom; - if (((len < 512) && !force) || !len) { - return; - } - chunks.push(input.slice(emitFrom, chunkerCurrentIndex + 1)); - emitFrom = chunkerCurrentIndex + 1; - } - for (chunkerCurrentIndex = 0; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc = input.charCodeAt(chunkerCurrentIndex); - if (((cc >= 97) && (cc <= 122)) || (cc < 34)) { - // a-z or whitespace - continue; - } - switch (cc) { - case 40: // ( - parenLevel++; - lastOpeningParen = chunkerCurrentIndex; - continue; - case 41: // ) - if (--parenLevel < 0) { - return fail('missing opening `(`', chunkerCurrentIndex); - } - continue; - case 59: // ; - if (!parenLevel) { - emitChunk(); - } - continue; - case 123: // { - level++; - lastOpening = chunkerCurrentIndex; - continue; - case 125: // } - if (--level < 0) { - return fail('missing opening `{`', chunkerCurrentIndex); - } - if (!level && !parenLevel) { - emitChunk(); - } - continue; - case 92: // \ - if (chunkerCurrentIndex < len - 1) { - chunkerCurrentIndex++; - continue; - } - return fail('unescaped `\\`', chunkerCurrentIndex); - case 34: - case 39: - case 96: // ", ' and ` - matched = 0; - currentChunkStartIndex = chunkerCurrentIndex; - for (chunkerCurrentIndex = chunkerCurrentIndex + 1; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if (cc2 > 96) { - continue; - } - if (cc2 == cc) { - matched = 1; - break; - } - if (cc2 == 92) { // \ - if (chunkerCurrentIndex == len - 1) { - return fail('unescaped `\\`', chunkerCurrentIndex); - } - chunkerCurrentIndex++; - } - } - if (matched) { - continue; - } - return fail("unmatched `" + String.fromCharCode(cc) + "`", currentChunkStartIndex); - case 47: // /, check for comment - if (parenLevel || (chunkerCurrentIndex == len - 1)) { - continue; - } - cc2 = input.charCodeAt(chunkerCurrentIndex + 1); - if (cc2 == 47) { - // //, find lnfeed - for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { - break; - } - } - } - else if (cc2 == 42) { - // /*, find */ - lastMultiComment = currentChunkStartIndex = chunkerCurrentIndex; - for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len - 1; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if (cc2 == 125) { - lastMultiCommentEndBrace = chunkerCurrentIndex; - } - if (cc2 != 42) { - continue; - } - if (input.charCodeAt(chunkerCurrentIndex + 1) == 47) { - break; - } - } - if (chunkerCurrentIndex == len - 1) { - return fail('missing closing `*/`', currentChunkStartIndex); - } - chunkerCurrentIndex++; - } - continue; - case 42: // *, check for unmatched */ - if ((chunkerCurrentIndex < len - 1) && (input.charCodeAt(chunkerCurrentIndex + 1) == 47)) { - return fail('unmatched `/*`', chunkerCurrentIndex); - } - continue; - } - } - if (level !== 0) { - if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) { - return fail('missing closing `}` or `*/`', lastOpening); - } - else { - return fail('missing closing `}`', lastOpening); - } - } - else if (parenLevel !== 0) { - return fail('missing closing `)`', lastOpeningParen); - } - emitChunk(true); - return chunks; -}); -//# sourceMappingURL=chunker.js.map \ No newline at end of file diff --git a/packages/less/lib/less/parser/chunker.js.map b/packages/less/lib/less/parser/chunker.js.map deleted file mode 100644 index 251948bf7..000000000 --- a/packages/less/lib/less/parser/chunker.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"chunker.js","sourceRoot":"","sources":["../../../src/less/parser/chunker.js"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,mBAAe,UAAC,KAAK,EAAE,IAAI;IACvB,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IACzB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,WAAW,CAAC;IAChB,IAAI,gBAAgB,CAAC;IACrB,IAAI,gBAAgB,CAAC;IACrB,IAAI,wBAAwB,CAAC;IAC7B,IAAM,MAAM,GAAG,EAAE,CAAC;IAClB,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,mBAAmB,CAAC;IACxB,IAAI,sBAAsB,CAAC;IAC3B,IAAI,EAAE,CAAC;IACP,IAAI,GAAG,CAAC;IACR,IAAI,OAAO,CAAC;IAEZ,SAAS,SAAS,CAAC,KAAK;QACpB,IAAM,GAAG,GAAG,mBAAmB,GAAG,QAAQ,CAAC;QAC3C,IAAI,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACjC,OAAO;SACV;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,mBAAmB,GAAG,CAAC,CAAC,CAAC,CAAC;QAC5D,QAAQ,GAAG,mBAAmB,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,mBAAmB,GAAG,CAAC,EAAE,mBAAmB,GAAG,GAAG,EAAE,mBAAmB,EAAE,EAAE;QAC5E,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAC3C,IAAI,CAAC,CAAC,E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AI,UAAU,KAAK,CAAC,EAAE;QACzB,OAAO,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAC;KACxD;IAED,SAAS,CAAC,IAAI,CAAC,CAAC;IAChB,OAAO,MAAM,CAAC;AAClB,CAAC,EAAC","sourcesContent":["// Split the input into chunks.\nexport default (input, fail) => {\n const len = input.length;\n let level = 0;\n let parenLevel = 0;\n let lastOpening;\n let lastOpeningParen;\n let lastMultiComment;\n let lastMultiCommentEndBrace;\n const chunks = [];\n let emitFrom = 0;\n let chunkerCurrentIndex;\n let currentChunkStartIndex;\n let cc;\n let cc2;\n let matched;\n\n function emitChunk(force) {\n const len = chunkerCurrentIndex - emitFrom;\n if (((len < 512) && !force) || !len) {\n return;\n }\n chunks.push(input.slice(emitFrom, chunkerCurrentIndex + 1));\n emitFrom = chunkerCurrentIndex + 1;\n }\n\n for (chunkerCurrentIndex = 0; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc = input.charCodeAt(chunkerCurrentIndex);\n if (((cc >= 97) && (cc <= 122)) || (cc < 34)) {\n // a-z or whitespace\n continue;\n }\n\n switch (cc) {\n case 40: // (\n parenLevel++;\n lastOpeningParen = chunkerCurrentIndex;\n continue;\n case 41: // )\n if (--parenLevel < 0) {\n return fail('missing opening `(`', chunkerCurrentIndex);\n }\n continue;\n case 59: // ;\n if (!parenLevel) { emitChunk(); }\n continue;\n case 123: // {\n level++;\n lastOpening = chunkerCurrentIndex;\n continue;\n case 125: // }\n if (--level < 0) {\n return fail('missing opening `{`', chunkerCurrentIndex);\n }\n if (!level && !parenLevel) { emitChunk(); }\n continue;\n case 92: // \\\n if (chunkerCurrentIndex < len - 1) { chunkerCurrentIndex++; continue; }\n return fail('unescaped `\\\\`', chunkerCurrentIndex);\n case 34:\n case 39:\n case 96: // \", ' and `\n matched = 0;\n currentChunkStartIndex = chunkerCurrentIndex;\n for (chunkerCurrentIndex = chunkerCurrentIndex + 1; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if (cc2 > 96) { continue; }\n if (cc2 == cc) { matched = 1; break; }\n if (cc2 == 92) { // \\\n if (chunkerCurrentIndex == len - 1) {\n return fail('unescaped `\\\\`', chunkerCurrentIndex);\n }\n chunkerCurrentIndex++;\n }\n }\n if (matched) { continue; }\n return fail(`unmatched \\`${String.fromCharCode(cc)}\\``, currentChunkStartIndex);\n case 47: // /, check for comment\n if (parenLevel || (chunkerCurrentIndex == len - 1)) { continue; }\n cc2 = input.charCodeAt(chunkerCurrentIndex + 1);\n if (cc2 == 47) {\n // //, find lnfeed\n for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { break; }\n }\n } else if (cc2 == 42) {\n // /*, find */\n lastMultiComment = currentChunkStartIndex = chunkerCurrentIndex;\n for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len - 1; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if (cc2 == 125) { lastMultiCommentEndBrace = chunkerCurrentIndex; }\n if (cc2 != 42) { continue; }\n if (input.charCodeAt(chunkerCurrentIndex + 1) == 47) { break; }\n }\n if (chunkerCurrentIndex == len - 1) {\n return fail('missing closing `*/`', currentChunkStartIndex);\n }\n chunkerCurrentIndex++;\n }\n continue;\n case 42: // *, check for unmatched */\n if ((chunkerCurrentIndex < len - 1) && (input.charCodeAt(chunkerCurrentIndex + 1) == 47)) {\n return fail('unmatched `/*`', chunkerCurrentIndex);\n }\n continue;\n }\n }\n\n if (level !== 0) {\n if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) {\n return fail('missing closing `}` or `*/`', lastOpening);\n } else {\n return fail('missing closing `}`', lastOpening);\n }\n } else if (parenLevel !== 0) {\n return fail('missing closing `)`', lastOpeningParen);\n }\n\n emitChunk(true);\n return chunks;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/parser/parser-input.js b/packages/less/lib/less/parser/parser-input.js deleted file mode 100644 index 4133fd48a..000000000 --- a/packages/less/lib/less/parser/parser-input.js +++ /dev/null @@ -1,355 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var chunker_1 = __importDefault(require("./chunker")); -exports.default = (function () { - var // Less input string - input; - var // current chunk - j; - var // holds state for backtracking - saveStack = []; - var // furthest index the parser has gone to - furthest; - var // if this is furthest we got to, this is the probably cause - furthestPossibleErrorMessage; - var // chunkified input - chunks; - var // current chunk - current; - var // index of current chunk, in `input` - currentPos; - var parserInput = {}; - var CHARCODE_SPACE = 32; - var CHARCODE_TAB = 9; - var CHARCODE_LF = 10; - var CHARCODE_CR = 13; - var CHARCODE_PLUS = 43; - var CHARCODE_COMMA = 44; - var CHARCODE_FORWARD_SLASH = 47; - var CHARCODE_9 = 57; - function skipWhitespace(length) { - var oldi = parserInput.i; - var oldj = j; - var curr = parserInput.i - currentPos; - var endIndex = parserInput.i + current.length - curr; - var mem = (parserInput.i += length); - var inp = input; - var c; - var nextChar; - var comment; - for (; parserInput.i < endIndex; parserInput.i++) { - c = inp.charCodeAt(parserInput.i); - if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) { - nextChar = inp.charAt(parserInput.i + 1); - if (nextChar === '/') { - comment = { index: parserInput.i, isLineComment: true }; - var nextNewLine = inp.indexOf('\n', parserInput.i + 2); - if (nextNewLine < 0) { - nextNewLine = endIndex; - } - parserInput.i = nextNewLine; - comment.text = inp.substr(comment.index, parserInput.i - comment.index); - parserInput.commentStore.push(comment); - continue; - } - else if (nextChar === '*') { - var nextStarSlash = inp.indexOf('*/', parserInput.i + 2); - if (nextStarSlash >= 0) { - comment = { - index: parserInput.i, - text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i), - isLineComment: false - }; - parserInput.i += comment.text.length - 1; - parserInput.commentStore.push(comment); - continue; - } - } - break; - } - if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) { - break; - } - } - current = current.slice(length + parserInput.i - mem + curr); - currentPos = parserInput.i; - if (!current.length) { - if (j < chunks.length - 1) { - current = chunks[++j]; - skipWhitespace(0); // skip space at the beginning of a chunk - return true; // things changed - } - parserInput.finished = true; - } - return oldi !== parserInput.i || oldj !== j; - } - parserInput.save = function () { - currentPos = parserInput.i; - saveStack.push({ current: current, i: parserInput.i, j: j }); - }; - parserInput.restore = function (possibleErrorMessage) { - if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) { - furthest = parserInput.i; - furthestPossibleErrorMessage = possibleErrorMessage; - } - var state = saveStack.pop(); - current = state.current; - currentPos = parserInput.i = state.i; - j = state.j; - }; - parserInput.forget = function () { - saveStack.pop(); - }; - parserInput.isWhitespace = function (offset) { - var pos = parserInput.i + (offset || 0); - var code = input.charCodeAt(pos); - return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF); - }; - // Specialization of $(tok) - parserInput.$re = function (tok) { - if (parserInput.i > currentPos) { - current = current.slice(parserInput.i - currentPos); - currentPos = parserInput.i; - } - var m = tok.exec(current); - if (!m) { - return null; - } - skipWhitespace(m[0].length); - if (typeof m === 'string') { - return m; - } - return m.length === 1 ? m[0] : m; - }; - parserInput.$char = function (tok) { - if (input.charAt(parserInput.i) !== tok) { - return null; - } - skipWhitespace(1); - return tok; - }; - parserInput.$str = function (tok) { - var tokLength = tok.length; - // https://jsperf.com/string-startswith/21 - for (var i = 0; i < tokLength; i++) { - if (input.charAt(parserInput.i + i) !== tok.charAt(i)) { - return null; - } - } - skipWhitespace(tokLength); - return tok; - }; - parserInput.$quoted = function (loc) { - var pos = loc || parserInput.i; - var startChar = input.charAt(pos); - if (startChar !== '\'' && startChar !== '"') { - return; - } - var length = input.length; - var currentPosition = pos; - for (var i = 1; i + currentPosition < length; i++) { - var nextChar = input.charAt(i + currentPosition); - switch (nextChar) { - case '\\': - i++; - continue; - case '\r': - case '\n': - break; - case startChar: - var str = input.substr(currentPosition, i + 1); - if (!loc && loc !== 0) { - skipWhitespace(i + 1); - return str; - } - return [startChar, str]; - default: - } - } - return null; - }; - /** - * Permissive parsing. Ignores everything except matching {} [] () and quotes - * until matching token (outside of blocks) - */ - parserInput.$parseUntil = function (tok) { - var quote = ''; - var returnVal = null; - var inComment = false; - var blockDepth = 0; - var blockStack = []; - var parseGroups = []; - var length = input.length; - var startPos = parserInput.i; - var lastPos = parserInput.i; - var i = parserInput.i; - var loop = true; - var testChar; - if (typeof tok === 'string') { - testChar = function (char) { return char === tok; }; - } - else { - testChar = function (char) { return tok.test(char); }; - } - do { - var prevChar = void 0; - var nextChar = input.charAt(i); - if (blockDepth === 0 && testChar(nextChar)) { - returnVal = input.substr(lastPos, i - lastPos); - if (returnVal) { - parseGroups.push(returnVal); - } - else { - parseGroups.push(' '); - } - returnVal = parseGroups; - skipWhitespace(i - startPos); - loop = false; - } - else { - if (inComment) { - if (nextChar === '*' && - input.charAt(i + 1) === '/') { - i++; - blockDepth--; - inComment = false; - } - i++; - continue; - } - switch (nextChar) { - case '\\': - i++; - nextChar = input.charAt(i); - parseGroups.push(input.substr(lastPos, i - lastPos + 1)); - lastPos = i + 1; - break; - case '/': - if (input.charAt(i + 1) === '*') { - i++; - inComment = true; - blockDepth++; - } - break; - case '\'': - case '"': - quote = parserInput.$quoted(i); - if (quote) { - parseGroups.push(input.substr(lastPos, i - lastPos), quote); - i += quote[1].length - 1; - lastPos = i + 1; - } - else { - skipWhitespace(i - startPos); - returnVal = nextChar; - loop = false; - } - break; - case '{': - blockStack.push('}'); - blockDepth++; - break; - case '(': - blockStack.push(')'); - blockDepth++; - break; - case '[': - blockStack.push(']'); - blockDepth++; - break; - case '}': - case ')': - case ']': - var expected = blockStack.pop(); - if (nextChar === expected) { - blockDepth--; - } - else { - // move the parser to the error and return expected - skipWhitespace(i - startPos); - returnVal = expected; - loop = false; - } - } - i++; - if (i > length) { - loop = false; - } - } - prevChar = nextChar; - } while (loop); - return returnVal ? returnVal : null; - }; - parserInput.autoCommentAbsorb = true; - parserInput.commentStore = []; - parserInput.finished = false; - // Same as $(), but don't change the state of the parser, - // just return the match. - parserInput.peek = function (tok) { - if (typeof tok === 'string') { - // https://jsperf.com/string-startswith/21 - for (var i = 0; i < tok.length; i++) { - if (input.charAt(parserInput.i + i) !== tok.charAt(i)) { - return false; - } - } - return true; - } - else { - return tok.test(current); - } - }; - // Specialization of peek() - // TODO remove or change some currentChar calls to peekChar - parserInput.peekChar = function (tok) { return input.charAt(parserInput.i) === tok; }; - parserInput.currentChar = function () { return input.charAt(parserInput.i); }; - parserInput.prevChar = function () { return input.charAt(parserInput.i - 1); }; - parserInput.getInput = function () { return input; }; - parserInput.peekNotNumeric = function () { - var c = input.charCodeAt(parserInput.i); - // Is the first char of the dimension 0-9, '.', '+' or '-' - return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA; - }; - parserInput.start = function (str, chunkInput, failFunction) { - input = str; - parserInput.i = j = currentPos = furthest = 0; - // chunking apparently makes things quicker (but my tests indicate - // it might actually make things slower in node at least) - // and it is a non-perfect parse - it can't recognise - // unquoted urls, meaning it can't distinguish comments - // meaning comments with quotes or {}() in them get 'counted' - // and then lead to parse errors. - // In addition if the chunking chunks in the wrong place we might - // not be able to parse a parser statement in one go - // this is officially deprecated but can be switched on via an option - // in the case it causes too much performance issues. - if (chunkInput) { - chunks = chunker_1.default(str, failFunction); - } - else { - chunks = [str]; - } - current = chunks[0]; - skipWhitespace(0); - }; - parserInput.end = function () { - var message; - var isFinished = parserInput.i >= input.length; - if (parserInput.i < furthest) { - message = furthestPossibleErrorMessage; - parserInput.i = furthest; - } - return { - isFinished: isFinished, - furthest: parserInput.i, - furthestPossibleErrorMessage: message, - furthestReachedEnd: parserInput.i >= input.length - 1, - furthestChar: input[parserInput.i] - }; - }; - return parserInput; -}); -//# sourceMappingURL=parser-input.js.map \ No newline at end of file diff --git a/packages/less/lib/less/parser/parser-input.js.map b/packages/less/lib/less/parser/parser-input.js.map deleted file mode 100644 index 7571eb290..000000000 --- a/packages/less/lib/less/parser/parser-input.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parser-input.js","sourceRoot":"","sources":["../../../src/less/parser/parser-input.js"],"names":[],"mappings":";;;;;AAAA,sDAAgC;AAEhC,mBAAe;IACX,IAAI,oBAAoB;IACpB,KAAK,CAAC;IAEV,IAAI,gBAAgB;IAChB,CAAC,CAAC;IAEN,IAAM,+BAA+B;IACjC,SAAS,GAAG,EAAE,CAAC;IAEnB,IAAI,wCAAwC;IACxC,QAAQ,CAAC;IAEb,IAAI,4DAA4D;IAC5D,4BAA4B,CAAC;IAEjC,IAAI,mBAAmB;IACnB,MAAM,CAAC;IAEX,IAAI,gBAAgB;IAChB,OAAO,CAAC;IAEZ,IAAI,qCAAqC;IACrC,UAAU,CAAC;IAEf,IAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,IAAM,YAAY,GAAG,CAAC,CAAC;IACvB,IAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAM,aAAa,GAAG,EAAE,CAAC;IACzB,IAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,IAAM,sBAAsB,GAAG,EAAE,CAAC;IAClC,IAAM,UAAU,GAAG,EAAE,CAAC;IAEtB,SAAS,cAAc,CAAC,MAAM;QAC1B,IAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC;QAC3B,IAAM,IAAI,GAAG,CAAC,CAAC;QACf,IAAM,IAAI,GAAG,WAAW,CAAC,CAAC,GAAG,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EAAE,YAAY,CAAC,CAAC;SACvC;aAAM;YACH,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;SAClB;QAED,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAEpB,cAAc,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,WAAW,CAAC,GAAG,GAAG;QACd,IAAI,OAAO,CAAC;QACZ,IAAM,UAAU,GAAG,WAAW,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC;QAEjD,IAAI,WAAW,CAAC,CAAC,GAAG,QAAQ,EAAE;YAC1B,OAAO,GAAG,4BAA4B,CAAC;YACvC,WAAW,CAAC,CAAC,GAAG,QAAQ,CAAC;SAC5B;QACD,OAAO;YACH,UAAU,YAAA;YACV,QAAQ,EAAE,WAAW,CAAC,CAAC;YACvB,4BAA4B,EAAE,OAAO;YACrC,kBAAkB,EAAE,WAAW,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YACrD,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;SACrC,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC;AACvB,CAAC,EAAC","sourcesContent":["import chunker from './chunker';\n\nexport default () => {\n let // Less input string\n input;\n\n let // current chunk\n j;\n\n const // holds state for backtracking\n saveStack = [];\n\n let // furthest index the parser has gone to\n furthest;\n\n let // if this is furthest we got to, this is the probably cause\n furthestPossibleErrorMessage;\n\n let // chunkified input\n chunks;\n\n let // current chunk\n current;\n\n let // index of current chunk, in `input`\n currentPos;\n\n const parserInput = {};\n const CHARCODE_SPACE = 32;\n const CHARCODE_TAB = 9;\n const CHARCODE_LF = 10;\n const CHARCODE_CR = 13;\n const CHARCODE_PLUS = 43;\n const CHARCODE_COMMA = 44;\n const CHARCODE_FORWARD_SLASH = 47;\n const CHARCODE_9 = 57;\n\n function skipWhitespace(length) {\n const oldi = parserInput.i;\n const oldj = j;\n const curr = parserInput.i - currentPos;\n const endIndex = parserInput.i + current.length - curr;\n const mem = (parserInput.i += length);\n const inp = input;\n let c;\n let nextChar;\n let comment;\n\n for (; parserInput.i < endIndex; parserInput.i++) {\n c = inp.charCodeAt(parserInput.i);\n\n if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) {\n nextChar = inp.charAt(parserInput.i + 1);\n if (nextChar === '/') {\n comment = {index: parserInput.i, isLineComment: true};\n let nextNewLine = inp.indexOf('\\n', parserInput.i + 2);\n if (nextNewLine < 0) {\n nextNewLine = endIndex;\n }\n parserInput.i = nextNewLine;\n comment.text = inp.substr(comment.index, parserInput.i - comment.index);\n parserInput.commentStore.push(comment);\n continue;\n } else if (nextChar === '*') {\n const nextStarSlash = inp.indexOf('*/', parserInput.i + 2);\n if (nextStarSlash >= 0) {\n comment = {\n index: parserInput.i,\n text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i),\n isLineComment: false\n };\n parserInput.i += comment.text.length - 1;\n parserInput.commentStore.push(comment);\n continue;\n }\n }\n break;\n }\n\n if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) {\n break;\n }\n }\n\n current = current.slice(length + parserInput.i - mem + curr);\n currentPos = parserInput.i;\n\n if (!current.length) {\n if (j < chunks.length - 1) {\n current = chunks[++j];\n skipWhitespace(0); // skip space at the beginning of a chunk\n return true; // things changed\n }\n parserInput.finished = true;\n }\n\n return oldi !== parserInput.i || oldj !== j;\n }\n\n parserInput.save = () => {\n currentPos = parserInput.i;\n saveStack.push( { current, i: parserInput.i, j });\n };\n parserInput.restore = possibleErrorMessage => {\n\n if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) {\n furthest = parserInput.i;\n furthestPossibleErrorMessage = possibleErrorMessage;\n }\n const state = saveStack.pop();\n current = state.current;\n currentPos = parserInput.i = state.i;\n j = state.j;\n };\n parserInput.forget = () => {\n saveStack.pop();\n };\n parserInput.isWhitespace = offset => {\n const pos = parserInput.i + (offset || 0);\n const code = input.charCodeAt(pos);\n return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF);\n };\n\n // Specialization of $(tok)\n parserInput.$re = tok => {\n if (parserInput.i > currentPos) {\n current = current.slice(parserInput.i - currentPos);\n currentPos = parserInput.i;\n }\n\n const m = tok.exec(current);\n if (!m) {\n return null;\n }\n\n skipWhitespace(m[0].length);\n if (typeof m === 'string') {\n return m;\n }\n\n return m.length === 1 ? m[0] : m;\n };\n\n parserInput.$char = tok => {\n if (input.charAt(parserInput.i) !== tok) {\n return null;\n }\n skipWhitespace(1);\n return tok;\n };\n\n parserInput.$str = tok => {\n const tokLength = tok.length;\n\n // https://jsperf.com/string-startswith/21\n for (let i = 0; i < tokLength; i++) {\n if (input.charAt(parserInput.i + i) !== tok.charAt(i)) {\n return null;\n }\n }\n\n skipWhitespace(tokLength);\n return tok;\n };\n\n parserInput.$quoted = loc => {\n const pos = loc || parserInput.i;\n const startChar = input.charAt(pos);\n\n if (startChar !== '\\'' && startChar !== '\"') {\n return;\n }\n const length = input.length;\n const currentPosition = pos;\n\n for (let i = 1; i + currentPosition < length; i++) {\n const nextChar = input.charAt(i + currentPosition);\n switch (nextChar) {\n case '\\\\':\n i++;\n continue;\n case '\\r':\n case '\\n':\n break;\n case startChar:\n const str = input.substr(currentPosition, i + 1);\n if (!loc && loc !== 0) {\n skipWhitespace(i + 1);\n return str\n }\n return [startChar, str];\n default:\n }\n }\n return null;\n };\n\n /**\n * Permissive parsing. Ignores everything except matching {} [] () and quotes\n * until matching token (outside of blocks)\n */\n parserInput.$parseUntil = tok => {\n let quote = '';\n let returnVal = null;\n let inComment = false;\n let blockDepth = 0;\n const blockStack = [];\n const parseGroups = [];\n const length = input.length;\n const startPos = parserInput.i;\n let lastPos = parserInput.i;\n let i = parserInput.i;\n let loop = true;\n let testChar;\n\n if (typeof tok === 'string') {\n testChar = char => char === tok\n } else {\n testChar = char => tok.test(char)\n }\n\n do {\n let prevChar;\n let nextChar = input.charAt(i);\n if (blockDepth === 0 && testChar(nextChar)) {\n returnVal = input.substr(lastPos, i - lastPos);\n if (returnVal) {\n parseGroups.push(returnVal);\n }\n else {\n parseGroups.push(' ');\n }\n returnVal = parseGroups;\n skipWhitespace(i - startPos);\n loop = false\n } else {\n if (inComment) {\n if (nextChar === '*' && \n input.charAt(i + 1) === '/') {\n i++;\n blockDepth--;\n inComment = false;\n }\n i++;\n continue;\n }\n switch (nextChar) {\n case '\\\\':\n i++;\n nextChar = input.charAt(i);\n parseGroups.push(input.substr(lastPos, i - lastPos + 1));\n lastPos = i + 1;\n break;\n case '/':\n if (input.charAt(i + 1) === '*') {\n i++;\n inComment = true;\n blockDepth++;\n }\n break;\n case '\\'':\n case '\"':\n quote = parserInput.$quoted(i);\n if (quote) {\n parseGroups.push(input.substr(lastPos, i - lastPos), quote);\n i += quote[1].length - 1;\n lastPos = i + 1;\n }\n else {\n skipWhitespace(i - startPos);\n returnVal = nextChar;\n loop = false;\n }\n break;\n case '{':\n blockStack.push('}');\n blockDepth++;\n break;\n case '(':\n blockStack.push(')');\n blockDepth++;\n break;\n case '[':\n blockStack.push(']');\n blockDepth++;\n break;\n case '}':\n case ')':\n case ']':\n const expected = blockStack.pop();\n if (nextChar === expected) {\n blockDepth--;\n } else {\n // move the parser to the error and return expected\n skipWhitespace(i - startPos);\n returnVal = expected;\n loop = false;\n }\n }\n i++;\n if (i > length) {\n loop = false;\n }\n }\n prevChar = nextChar;\n } while (loop);\n\n return returnVal ? returnVal : null;\n }\n\n parserInput.autoCommentAbsorb = true;\n parserInput.commentStore = [];\n parserInput.finished = false;\n\n // Same as $(), but don't change the state of the parser,\n // just return the match.\n parserInput.peek = tok => {\n if (typeof tok === 'string') {\n // https://jsperf.com/string-startswith/21\n for (let i = 0; i < tok.length; i++) {\n if (input.charAt(parserInput.i + i) !== tok.charAt(i)) {\n return false;\n }\n }\n return true;\n } else {\n return tok.test(current);\n }\n };\n\n // Specialization of peek()\n // TODO remove or change some currentChar calls to peekChar\n parserInput.peekChar = tok => input.charAt(parserInput.i) === tok;\n\n parserInput.currentChar = () => input.charAt(parserInput.i);\n\n parserInput.prevChar = () => input.charAt(parserInput.i - 1);\n\n parserInput.getInput = () => input;\n\n parserInput.peekNotNumeric = () => {\n const c = input.charCodeAt(parserInput.i);\n // Is the first char of the dimension 0-9, '.', '+' or '-'\n return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA;\n };\n\n parserInput.start = (str, chunkInput, failFunction) => {\n input = str;\n parserInput.i = j = currentPos = furthest = 0;\n\n // chunking apparently makes things quicker (but my tests indicate\n // it might actually make things slower in node at least)\n // and it is a non-perfect parse - it can't recognise\n // unquoted urls, meaning it can't distinguish comments\n // meaning comments with quotes or {}() in them get 'counted'\n // and then lead to parse errors.\n // In addition if the chunking chunks in the wrong place we might\n // not be able to parse a parser statement in one go\n // this is officially deprecated but can be switched on via an option\n // in the case it causes too much performance issues.\n if (chunkInput) {\n chunks = chunker(str, failFunction);\n } else {\n chunks = [str];\n }\n\n current = chunks[0];\n\n skipWhitespace(0);\n };\n\n parserInput.end = () => {\n let message;\n const isFinished = parserInput.i >= input.length;\n\n if (parserInput.i < furthest) {\n message = furthestPossibleErrorMessage;\n parserInput.i = furthest;\n }\n return {\n isFinished,\n furthest: parserInput.i,\n furthestPossibleErrorMessage: message,\n furthestReachedEnd: parserInput.i >= input.length - 1,\n furthestChar: input[parserInput.i]\n };\n };\n\n return parserInput;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/parser/parser.js b/packages/less/lib/less/parser/parser.js deleted file mode 100644 index 1dfbd440f..000000000 --- a/packages/less/lib/less/parser/parser.js +++ /dev/null @@ -1,2262 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var less_error_1 = __importDefault(require("../less-error")); -var tree_1 = __importDefault(require("../tree")); -var visitors_1 = __importDefault(require("../visitors")); -var parser_input_1 = __importDefault(require("./parser-input")); -var utils = __importStar(require("../utils")); -var function_registry_1 = __importDefault(require("../functions/function-registry")); -// -// less.js - parser -// -// A relatively straight-forward predictive parser. -// There is no tokenization/lexing stage, the input is parsed -// in one sweep. -// -// To make the parser fast enough to run in the browser, several -// optimization had to be made: -// -// - Matching and slicing on a huge input is often cause of slowdowns. -// The solution is to chunkify the input into smaller strings. -// The chunks are stored in the `chunks` var, -// `j` holds the current chunk index, and `currentPos` holds -// the index of the current chunk in relation to `input`. -// This gives us an almost 4x speed-up. -// -// - In many cases, we don't need to match individual tokens; -// for example, if a value doesn't hold any variables, operations -// or dynamic references, the parser can effectively 'skip' it, -// treating it as a literal. -// An example would be '1px solid #000' - which evaluates to itself, -// we don't need to know what the individual components are. -// The drawback, of course is that you don't get the benefits of -// syntax-checking on the CSS. This gives us a 50% speed-up in the parser, -// and a smaller speed-up in the code-gen. -// -// -// Token matching is done with the `$` function, which either takes -// a terminal string or regexp, or a non-terminal function to call. -// It also takes care of moving all the indices forwards. -// -var Parser = function Parser(context, imports, fileInfo) { - var parsers; - var parserInput = parser_input_1.default(); - function error(msg, type) { - throw new less_error_1.default({ - index: parserInput.i, - filename: fileInfo.filename, - type: type || 'Syntax', - message: msg - }, imports); - } - function expect(arg, msg) { - // some older browsers return typeof 'function' for RegExp - var result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg); - if (result) { - return result; - } - error(msg || (typeof arg === 'string' - ? "expected '" + arg + "' got '" + parserInput.currentChar() + "'" - : 'unexpected token')); - } - // Specialization of expect() - function expectChar(arg, msg) { - if (parserInput.$char(arg)) { - return arg; - } - error(msg || "expected '" + arg + "' got '" + parserInput.currentChar() + "'"); - } - function getDebugInfo(index) { - var filename = fileInfo.filename; - return { - lineNumber: utils.getLocation(index, parserInput.getInput()).line + 1, - fileName: filename - }; - } - /** - * Used after initial parsing to create nodes on the fly - * - * @param {String} str - string to parse - * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] - * @param {Number} currentIndex - start number to begin indexing - * @param {Object} fileInfo - fileInfo to attach to created nodes - */ - function parseNode(str, parseList, currentIndex, fileInfo, callback) { - var result; - var returnNodes = []; - var parser = parserInput; - try { - parser.start(str, false, function fail(msg, index) { - callback({ - message: msg, - index: index + currentIndex - }); - }); - for (var x = 0, p = void 0, i = void 0; (p = parseList[x]); x++) { - i = parser.i; - result = parsers[p](); - if (result) { - try { - result._index = i + currentIndex; - result._fileInfo = fileInfo; - } - catch (e) { } - returnNodes.push(result); - } - else { - returnNodes.push(null); - } - } - var endInfo = parser.end(); - if (endInfo.isFinished) { - callback(null, returnNodes); - } - else { - callback(true, null); - } - } - catch (e) { - throw new less_error_1.default({ - index: e.index + currentIndex, - message: e.message - }, imports, fileInfo.filename); - } - } - // - // The Parser - // - return { - parserInput: parserInput, - imports: imports, - fileInfo: fileInfo, - parseNode: parseNode, - // - // Parse an input string into an abstract syntax tree, - // @param str A string containing 'less' markup - // @param callback call `callback` when done. - // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply - // - parse: function (str, callback, additionalData) { - var root; - var error = null; - var globalVars; - var modifyVars; - var ignored; - var preText = ''; - globalVars = (additionalData && additionalData.globalVars) ? Parser.serializeVars(additionalData.globalVars) + "\n" : ''; - modifyVars = (additionalData && additionalData.modifyVars) ? "\n" + Parser.serializeVars(additionalData.modifyVars) : ''; - if (context.pluginManager) { - var preProcessors = context.pluginManager.getPreProcessors(); - for (var i = 0; i < preProcessors.length; i++) { - str = preProcessors[i].process(str, { context: context, imports: imports, fileInfo: fileInfo }); - } - } - if (globalVars || (additionalData && additionalData.banner)) { - preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars; - ignored = imports.contentsIgnoredChars; - ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0; - ignored[fileInfo.filename] += preText.length; - } - str = str.replace(/\r\n?/g, '\n'); - // Remove potential UTF Byte Order Mark - str = preText + str.replace(/^\uFEFF/, '') + modifyVars; - imports.contents[fileInfo.filename] = str; - // Start with the primary rule. - // The whole syntax tree is held under a Ruleset node, - // with the `root` property set to true, so no `{}` are - // output. The callback is called when the input is parsed. - try { - parserInput.start(str, context.chunkInput, function fail(msg, index) { - throw new less_error_1.default({ - index: index, - type: 'Parse', - message: msg, - filename: fileInfo.filename - }, imports); - }); - tree_1.default.Node.prototype.parse = this; - root = new tree_1.default.Ruleset(null, this.parsers.primary()); - tree_1.default.Node.prototype.rootNode = root; - root.root = true; - root.firstRoot = true; - root.functionRegistry = function_registry_1.default.inherit(); - } - catch (e) { - return callback(new less_error_1.default(e, imports, fileInfo.filename)); - } - // If `i` is smaller than the `input.length - 1`, - // it means the parser wasn't able to parse the whole - // string, so we've got a parsing error. - // - // We try to extract a \n delimited string, - // showing the line where the parse error occurred. - // We split it up into two parts (the part which parsed, - // and the part which didn't), so we can color them differently. - var endInfo = parserInput.end(); - if (!endInfo.isFinished) { - var message = endInfo.furthestPossibleErrorMessage; - if (!message) { - message = 'Unrecognised input'; - if (endInfo.furthestChar === '}') { - message += '. Possibly missing opening \'{\''; - } - else if (endInfo.furthestChar === ')') { - message += '. Possibly missing opening \'(\''; - } - else if (endInfo.furthestReachedEnd) { - message += '. Possibly missing something'; - } - } - error = new less_error_1.default({ - type: 'Parse', - message: message, - index: endInfo.furthest, - filename: fileInfo.filename - }, imports); - } - var finish = function (e) { - e = error || e || imports.error; - if (e) { - if (!(e instanceof less_error_1.default)) { - e = new less_error_1.default(e, imports, fileInfo.filename); - } - return callback(e); - } - else { - return callback(null, root); - } - }; - if (context.processImports !== false) { - new visitors_1.default.ImportVisitor(imports, finish) - .run(root); - } - else { - return finish(); - } - }, - // - // Here in, the parsing rules/functions - // - // The basic structure of the syntax tree generated is as follows: - // - // Ruleset -> Declaration -> Value -> Expression -> Entity - // - // Here's some Less code: - // - // .class { - // color: #fff; - // border: 1px solid #000; - // width: @w + 4px; - // > .child {...} - // } - // - // And here's what the parse tree might look like: - // - // Ruleset (Selector '.class', [ - // Declaration ("color", Value ([Expression [Color #fff]])) - // Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) - // Declaration ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) - // Ruleset (Selector [Element '>', '.child'], [...]) - // ]) - // - // In general, most rules will try to parse a token with the `$re()` function, and if the return - // value is truly, will return a new node, of the relevant type. Sometimes, we need to check - // first, before parsing, that's when we use `peek()`. - // - parsers: parsers = { - // - // The `primary` rule is the *entry* and *exit* point of the parser. - // The rules here can appear at any level of the parse tree. - // - // The recursive nature of the grammar is an interplay between the `block` - // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, - // as represented by this simplified grammar: - // - // primary → (ruleset | declaration)+ - // ruleset → selector+ block - // block → '{' primary '}' - // - // Only at one point is the primary rule not called from the - // block rule: at the root level. - // - primary: function () { - var mixin = this.mixin; - var root = []; - var node; - while (true) { - while (true) { - node = this.comment(); - if (!node) { - break; - } - root.push(node); - } - // always process comments before deciding if finished - if (parserInput.finished) { - break; - } - if (parserInput.peek('}')) { - break; - } - node = this.extendRule(); - if (node) { - root = root.concat(node); - continue; - } - node = mixin.definition() || this.declaration() || mixin.call(false, false) || - this.ruleset() || this.variableCall() || this.entities.call() || this.atrule(); - if (node) { - root.push(node); - } - else { - var foundSemiColon = false; - while (parserInput.$char(';')) { - foundSemiColon = true; - } - if (!foundSemiColon) { - break; - } - } - } - return root; - }, - // comments are collected by the main parsing mechanism and then assigned to nodes - // where the current structure allows it - comment: function () { - if (parserInput.commentStore.length) { - var comment = parserInput.commentStore.shift(); - return new (tree_1.default.Comment)(comment.text, comment.isLineComment, comment.index, fileInfo); - } - }, - // - // Entities are tokens which can be found inside an Expression - // - entities: { - mixinLookup: function () { - return parsers.mixin.call(true, true); - }, - // - // A string, which supports escaping " and ' - // - // "milky way" 'he\'s the one!' - // - quoted: function (forceEscaped) { - var str; - var index = parserInput.i; - var isEscaped = false; - parserInput.save(); - if (parserInput.$char('~')) { - isEscaped = true; - } - else if (forceEscaped) { - parserInput.restore(); - return; - } - str = parserInput.$quoted(); - if (!str) { - parserInput.restore(); - return; - } - parserInput.forget(); - return new (tree_1.default.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index, fileInfo); - }, - // - // A catch-all word, such as: - // - // black border-collapse - // - keyword: function () { - var k = parserInput.$char('%') || parserInput.$re(/^\[?(?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\]?/); - if (k) { - return tree_1.default.Color.fromKeyword(k) || new (tree_1.default.Keyword)(k); - } - }, - // - // A function call - // - // rgb(255, 0, 255) - // - // The arguments are parsed with the `entities.arguments` parser. - // - call: function () { - var name; - var args; - var func; - var index = parserInput.i; - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (parserInput.peek(/^url\(/i)) { - return; - } - parserInput.save(); - name = parserInput.$re(/^([\w-]+|%|progid:[\w\.]+)\(/); - if (!name) { - parserInput.forget(); - return; - } - name = name[1]; - func = this.customFuncCall(name); - if (func) { - args = func.parse(); - if (args && func.stop) { - parserInput.forget(); - return args; - } - } - args = this.arguments(args); - if (!parserInput.$char(')')) { - parserInput.restore('Could not parse call arguments or missing \')\''); - return; - } - parserInput.forget(); - return new (tree_1.default.Call)(name, args, index, fileInfo); - }, - // - // Parsing rules for functions with non-standard args, e.g.: - // - // boolean(not(2 > 1)) - // - // This is a quick prototype, to be modified/improved when - // more custom-parsed funcs come (e.g. `selector(...)`) - // - customFuncCall: function (name) { - /* Ideally the table is to be moved out of here for faster perf., - but it's quite tricky since it relies on all these `parsers` - and `expect` available only here */ - return { - alpha: f(parsers.ieAlpha, true), - boolean: f(condition), - 'if': f(condition) - }[name.toLowerCase()]; - function f(parse, stop) { - return { - parse: parse, - stop: stop // when true - stop after parse() and return its result, - // otherwise continue for plain args - }; - } - function condition() { - return [expect(parsers.condition, 'expected condition')]; - } - }, - arguments: function (prevArgs) { - var argsComma = prevArgs || []; - var argsSemiColon = []; - var isSemiColonSeparated; - var value; - parserInput.save(); - while (true) { - if (prevArgs) { - prevArgs = false; - } - else { - value = parsers.detachedRuleset() || this.assignment() || parsers.expression(); - if (!value) { - break; - } - if (value.value && value.value.length == 1) { - value = value.value[0]; - } - argsComma.push(value); - } - if (parserInput.$char(',')) { - continue; - } - if (parserInput.$char(';') || isSemiColonSeparated) { - isSemiColonSeparated = true; - value = (argsComma.length < 1) ? argsComma[0] - : new tree_1.default.Value(argsComma); - argsSemiColon.push(value); - argsComma = []; - } - } - parserInput.forget(); - return isSemiColonSeparated ? argsSemiColon : argsComma; - }, - literal: function () { - return this.dimension() || - this.color() || - this.quoted() || - this.unicodeDescriptor(); - }, - // Assignments are argument entities for calls. - // They are present in ie filter properties as shown below. - // - // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) - // - assignment: function () { - var key; - var value; - parserInput.save(); - key = parserInput.$re(/^\w+(?=\s?=)/i); - if (!key) { - parserInput.restore(); - return; - } - if (!parserInput.$char('=')) { - parserInput.restore(); - return; - } - value = parsers.entity(); - if (value) { - parserInput.forget(); - return new (tree_1.default.Assignment)(key, value); - } - else { - parserInput.restore(); - } - }, - // - // Parse url() tokens - // - // We use a specific rule for urls, because they don't really behave like - // standard function calls. The difference is that the argument doesn't have - // to be enclosed within a string, so it can't be parsed as an Expression. - // - url: function () { - var value; - var index = parserInput.i; - parserInput.autoCommentAbsorb = false; - if (!parserInput.$str('url(')) { - parserInput.autoCommentAbsorb = true; - return; - } - value = this.quoted() || this.variable() || this.property() || - parserInput.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/) || ''; - parserInput.autoCommentAbsorb = true; - expectChar(')'); - return new (tree_1.default.URL)((value.value != null || - value instanceof tree_1.default.Variable || - value instanceof tree_1.default.Property) ? - value : new (tree_1.default.Anonymous)(value, index), index, fileInfo); - }, - // - // A Variable entity, such as `@fink`, in - // - // width: @fink + 2px - // - // We use a different parser for variable definitions, - // see `parsers.variable`. - // - variable: function () { - var ch; - var name; - var index = parserInput.i; - parserInput.save(); - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\w-]+/))) { - ch = parserInput.currentChar(); - if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\s/)) { - // this may be a VariableCall lookup - var result = parsers.variableCall(name); - if (result) { - parserInput.forget(); - return result; - } - } - parserInput.forget(); - return new (tree_1.default.Variable)(name, index, fileInfo); - } - parserInput.restore(); - }, - // A variable entity using the protective {} e.g. @{var} - variableCurly: function () { - var curly; - var index = parserInput.i; - if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\{([\w-]+)\}/))) { - return new (tree_1.default.Variable)("@" + curly[1], index, fileInfo); - } - }, - // - // A Property accessor, such as `$color`, in - // - // background-color: $color - // - property: function () { - var name; - var index = parserInput.i; - if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\$[\w-]+/))) { - return new (tree_1.default.Property)(name, index, fileInfo); - } - }, - // A property entity useing the protective {} e.g. ${prop} - propertyCurly: function () { - var curly; - var index = parserInput.i; - if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\$\{([\w-]+)\}/))) { - return new (tree_1.default.Property)("$" + curly[1], index, fileInfo); - } - }, - // - // A Hexadecimal color - // - // #4F3C2F - // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. - // - color: function () { - var rgb; - parserInput.save(); - if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\w.#\[])?/))) { - if (!rgb[2]) { - parserInput.forget(); - return new (tree_1.default.Color)(rgb[1], undefined, rgb[0]); - } - } - parserInput.restore(); - }, - colorKeyword: function () { - parserInput.save(); - var autoCommentAbsorb = parserInput.autoCommentAbsorb; - parserInput.autoCommentAbsorb = false; - var k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/); - parserInput.autoCommentAbsorb = autoCommentAbsorb; - if (!k) { - parserInput.forget(); - return; - } - parserInput.restore(); - var color = tree_1.default.Color.fromKeyword(k); - if (color) { - parserInput.$str(k); - return color; - } - }, - // - // A Dimension, that is, a number and a unit - // - // 0.5em 95% - // - dimension: function () { - if (parserInput.peekNotNumeric()) { - return; - } - var value = parserInput.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i); - if (value) { - return new (tree_1.default.Dimension)(value[1], value[2]); - } - }, - // - // A unicode descriptor, as is used in unicode-range - // - // U+0?? or U+00A1-00A9 - // - unicodeDescriptor: function () { - var ud; - ud = parserInput.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/); - if (ud) { - return new (tree_1.default.UnicodeDescriptor)(ud[0]); - } - }, - // - // JavaScript code to be evaluated - // - // `window.location.href` - // - javascript: function () { - var js; - var index = parserInput.i; - parserInput.save(); - var escape = parserInput.$char('~'); - var jsQuote = parserInput.$char('`'); - if (!jsQuote) { - parserInput.restore(); - return; - } - js = parserInput.$re(/^[^`]*`/); - if (js) { - parserInput.forget(); - return new (tree_1.default.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index, fileInfo); - } - parserInput.restore('invalid javascript definition'); - } - }, - // - // The variable part of a variable definition. Used in the `rule` parser - // - // @fink: - // - variable: function () { - var name; - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\s*:/))) { - return name[1]; - } - }, - // - // Call a variable value to retrieve a detached ruleset - // or a value from a detached ruleset's rules. - // - // @fink(); - // @fink; - // color: @fink[@color]; - // - variableCall: function (parsedName) { - var lookups; - var i = parserInput.i; - var inValue = !!parsedName; - var name = parsedName; - parserInput.save(); - if (name || (parserInput.currentChar() === '@' - && (name = parserInput.$re(/^(@[\w-]+)(\(\s*\))?/)))) { - lookups = this.mixin.ruleLookups(); - if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) { - parserInput.restore('Missing \'[...]\' lookup in variable call'); - return; - } - if (!inValue) { - name = name[1]; - } - var call = new tree_1.default.VariableCall(name, i, fileInfo); - if (!inValue && parsers.end()) { - parserInput.forget(); - return call; - } - else { - parserInput.forget(); - return new tree_1.default.NamespaceValue(call, lookups, i, fileInfo); - } - } - parserInput.restore(); - }, - // - // extend syntax - used to extend selectors - // - extend: function (isRule) { - var elements; - var e; - var index = parserInput.i; - var option; - var extendList; - var extend; - if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) { - return; - } - do { - option = null; - elements = null; - while (!(option = parserInput.$re(/^(all)(?=\s*(\)|,))/))) { - e = this.element(); - if (!e) { - break; - } - if (elements) { - elements.push(e); - } - else { - elements = [e]; - } - } - option = option && option[1]; - if (!elements) { - error('Missing target selector for :extend().'); - } - extend = new (tree_1.default.Extend)(new (tree_1.default.Selector)(elements), option, index, fileInfo); - if (extendList) { - extendList.push(extend); - } - else { - extendList = [extend]; - } - } while (parserInput.$char(',')); - expect(/^\)/); - if (isRule) { - expect(/^;/); - } - return extendList; - }, - // - // extendRule - used in a rule to extend all the parent selectors - // - extendRule: function () { - return this.extend(true); - }, - // - // Mixins - // - mixin: { - // - // A Mixin call, with an optional argument list - // - // #mixins > .square(#fff); - // #mixins.square(#fff); - // .rounded(4px, black); - // .button; - // - // We can lookup / return a value using the lookup syntax: - // - // color: #mixin.square(#fff)[@color]; - // - // The `while` loop is there because mixins can be - // namespaced, but we only support the child and descendant - // selector for now. - // - call: function (inValue, getLookup) { - var s = parserInput.currentChar(); - var important = false; - var lookups; - var index = parserInput.i; - var elements; - var args; - var hasParens; - if (s !== '.' && s !== '#') { - return; - } - parserInput.save(); // stop us absorbing part of an invalid selector - elements = this.elements(); - if (elements) { - if (parserInput.$char('(')) { - args = this.args(true).args; - expectChar(')'); - hasParens = true; - } - if (getLookup !== false) { - lookups = this.ruleLookups(); - } - if (getLookup === true && !lookups) { - parserInput.restore(); - return; - } - if (inValue && !lookups && !hasParens) { - // This isn't a valid in-value mixin call - parserInput.restore(); - return; - } - if (!inValue && parsers.important()) { - important = true; - } - if (inValue || parsers.end()) { - parserInput.forget(); - var mixin = new (tree_1.default.mixin.Call)(elements, args, index, fileInfo, !lookups && important); - if (lookups) { - return new tree_1.default.NamespaceValue(mixin, lookups); - } - else { - return mixin; - } - } - } - parserInput.restore(); - }, - /** - * Matching elements for mixins - * (Start with . or # and can have > ) - */ - elements: function () { - var elements; - var e; - var c; - var elem; - var elemIndex; - var re = /^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/; - while (true) { - elemIndex = parserInput.i; - e = parserInput.$re(re); - if (!e) { - break; - } - elem = new (tree_1.default.Element)(c, e, false, elemIndex, fileInfo); - if (elements) { - elements.push(elem); - } - else { - elements = [elem]; - } - c = parserInput.$char('>'); - } - return elements; - }, - args: function (isCall) { - var entities = parsers.entities; - var returner = { args: null, variadic: false }; - var expressions = []; - var argsSemiColon = []; - var argsComma = []; - var isSemiColonSeparated; - var expressionContainsNamed; - var name; - var nameLoop; - var value; - var arg; - var expand; - var hasSep = true; - parserInput.save(); - while (true) { - if (isCall) { - arg = parsers.detachedRuleset() || parsers.expression(); - } - else { - parserInput.commentStore.length = 0; - if (parserInput.$str('...')) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ variadic: true }); - break; - } - arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true); - } - if (!arg || !hasSep) { - break; - } - nameLoop = null; - if (arg.throwAwayComments) { - arg.throwAwayComments(); - } - value = arg; - var val = null; - if (isCall) { - // Variable - if (arg.value && arg.value.length == 1) { - val = arg.value[0]; - } - } - else { - val = arg; - } - if (val && (val instanceof tree_1.default.Variable || val instanceof tree_1.default.Property)) { - if (parserInput.$char(':')) { - if (expressions.length > 0) { - if (isSemiColonSeparated) { - error('Cannot mix ; and , as delimiter types'); - } - expressionContainsNamed = true; - } - value = parsers.detachedRuleset() || parsers.expression(); - if (!value) { - if (isCall) { - error('could not understand value for named argument'); - } - else { - parserInput.restore(); - returner.args = []; - return returner; - } - } - nameLoop = (name = val.name); - } - else if (parserInput.$str('...')) { - if (!isCall) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ name: arg.name, variadic: true }); - break; - } - else { - expand = true; - } - } - else if (!isCall) { - name = nameLoop = val.name; - value = null; - } - } - if (value) { - expressions.push(value); - } - argsComma.push({ name: nameLoop, value: value, expand: expand }); - if (parserInput.$char(',')) { - hasSep = true; - continue; - } - hasSep = parserInput.$char(';') === ';'; - if (hasSep || isSemiColonSeparated) { - if (expressionContainsNamed) { - error('Cannot mix ; and , as delimiter types'); - } - isSemiColonSeparated = true; - if (expressions.length > 1) { - value = new (tree_1.default.Value)(expressions); - } - argsSemiColon.push({ name: name, value: value, expand: expand }); - name = null; - expressions = []; - expressionContainsNamed = false; - } - } - parserInput.forget(); - returner.args = isSemiColonSeparated ? argsSemiColon : argsComma; - return returner; - }, - // - // A Mixin definition, with a list of parameters - // - // .rounded (@radius: 2px, @color) { - // ... - // } - // - // Until we have a finer grained state-machine, we have to - // do a look-ahead, to make sure we don't have a mixin call. - // See the `rule` function for more information. - // - // We start by matching `.rounded (`, and then proceed on to - // the argument list, which has optional default values. - // We store the parameters in `params`, with a `value` key, - // if there is a value, such as in the case of `@radius`. - // - // Once we've got our params list, and a closing `)`, we parse - // the `{...}` block. - // - definition: function () { - var name; - var params = []; - var match; - var ruleset; - var cond; - var variadic = false; - if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') || - parserInput.peek(/^[^{]*\}/)) { - return; - } - parserInput.save(); - match = parserInput.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/); - if (match) { - name = match[1]; - var argInfo = this.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - // .mixincall("@{a}"); - // looks a bit like a mixin definition.. - // also - // .mixincall(@a: {rule: set;}); - // so we have to be nice and restore - if (!parserInput.$char(')')) { - parserInput.restore('Missing closing \')\''); - return; - } - parserInput.commentStore.length = 0; - if (parserInput.$str('when')) { // Guard - cond = expect(parsers.conditions, 'expected condition'); - } - ruleset = parsers.block(); - if (ruleset) { - parserInput.forget(); - return new (tree_1.default.mixin.Definition)(name, params, ruleset, cond, variadic); - } - else { - parserInput.restore(); - } - } - else { - parserInput.restore(); - } - }, - ruleLookups: function () { - var rule; - var args; - var lookups = []; - if (parserInput.currentChar() !== '[') { - return; - } - while (true) { - parserInput.save(); - args = null; - rule = this.lookupValue(); - if (!rule && rule !== '') { - parserInput.restore(); - break; - } - lookups.push(rule); - parserInput.forget(); - } - if (lookups.length > 0) { - return lookups; - } - }, - lookupValue: function () { - parserInput.save(); - if (!parserInput.$char('[')) { - parserInput.restore(); - return; - } - var name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/); - if (!parserInput.$char(']')) { - parserInput.restore(); - return; - } - if (name || name === '') { - parserInput.forget(); - return name; - } - parserInput.restore(); - } - }, - // - // Entities are the smallest recognized token, - // and can be found inside a rule's value. - // - entity: function () { - var entities = this.entities; - return this.comment() || entities.literal() || entities.variable() || entities.url() || - entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) || - entities.javascript(); - }, - // - // A Declaration terminator. Note that we use `peek()` to check for '}', - // because the `block` rule will be expecting it, but we still need to make sure - // it's there, if ';' was omitted. - // - end: function () { - return parserInput.$char(';') || parserInput.peek('}'); - }, - // - // IE's alpha function - // - // alpha(opacity=88) - // - ieAlpha: function () { - var value; - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (!parserInput.$re(/^opacity=/i)) { - return; - } - value = parserInput.$re(/^\d+/); - if (!value) { - value = expect(parsers.entities.variable, 'Could not parse alpha'); - value = "@{" + value.name.slice(1) + "}"; - } - expectChar(')'); - return new tree_1.default.Quoted('', "alpha(opacity=" + value + ")"); - }, - // - // A Selector Element - // - // div - // + h1 - // #socks - // input[type="text"] - // - // Elements are the building blocks for Selectors, - // they are made out of a `Combinator` (see combinator rule), - // and an element name, such as a tag a class, or `*`. - // - element: function () { - var e; - var c; - var v; - var index = parserInput.i; - c = this.combinator(); - e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) || - parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) || - parserInput.$char('*') || parserInput.$char('&') || this.attribute() || - parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[\.#:](?=@)/) || - this.entities.variableCurly(); - if (!e) { - parserInput.save(); - if (parserInput.$char('(')) { - if ((v = this.selector(false)) && parserInput.$char(')')) { - e = new (tree_1.default.Paren)(v); - parserInput.forget(); - } - else { - parserInput.restore('Missing closing \')\''); - } - } - else { - parserInput.forget(); - } - } - if (e) { - return new (tree_1.default.Element)(c, e, e instanceof tree_1.default.Variable, index, fileInfo); - } - }, - // - // Combinators combine elements together, in a Selector. - // - // Because our parser isn't white-space sensitive, special care - // has to be taken, when parsing the descendant combinator, ` `, - // as it's an empty space. We have to check the previous character - // in the input, to see if it's a ` ` character. More info on how - // we deal with this in *combinator.js*. - // - combinator: function () { - var c = parserInput.currentChar(); - if (c === '/') { - parserInput.save(); - var slashedCombinator = parserInput.$re(/^\/[a-z]+\//i); - if (slashedCombinator) { - parserInput.forget(); - return new (tree_1.default.Combinator)(slashedCombinator); - } - parserInput.restore(); - } - if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') { - parserInput.i++; - if (c === '^' && parserInput.currentChar() === '^') { - c = '^^'; - parserInput.i++; - } - while (parserInput.isWhitespace()) { - parserInput.i++; - } - return new (tree_1.default.Combinator)(c); - } - else if (parserInput.isWhitespace(-1)) { - return new (tree_1.default.Combinator)(' '); - } - else { - return new (tree_1.default.Combinator)(null); - } - }, - // - // A CSS Selector - // with less extensions e.g. the ability to extend and guard - // - // .class > div + h1 - // li a:hover - // - // Selectors are made out of one or more Elements, see above. - // - selector: function (isLess) { - var index = parserInput.i; - var elements; - var extendList; - var c; - var e; - var allExtends; - var when; - var condition; - isLess = isLess !== false; - while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) { - if (when) { - condition = expect(this.conditions, 'expected condition'); - } - else if (condition) { - error('CSS guard can only be used at the end of selector'); - } - else if (extendList) { - if (allExtends) { - allExtends = allExtends.concat(extendList); - } - else { - allExtends = extendList; - } - } - else { - if (allExtends) { - error('Extend can only be used at the end of selector'); - } - c = parserInput.currentChar(); - if (elements) { - elements.push(e); - } - else { - elements = [e]; - } - e = null; - } - if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') { - break; - } - } - if (elements) { - return new (tree_1.default.Selector)(elements, allExtends, condition, index, fileInfo); - } - if (allExtends) { - error('Extend must be used to extend a selector, it cannot be used on its own'); - } - }, - selectors: function () { - var s; - var selectors; - while (true) { - s = this.selector(); - if (!s) { - break; - } - if (selectors) { - selectors.push(s); - } - else { - selectors = [s]; - } - parserInput.commentStore.length = 0; - if (s.condition && selectors.length > 1) { - error("Guards are only currently allowed on a single selector."); - } - if (!parserInput.$char(',')) { - break; - } - if (s.condition) { - error("Guards are only currently allowed on a single selector."); - } - parserInput.commentStore.length = 0; - } - return selectors; - }, - attribute: function () { - if (!parserInput.$char('[')) { - return; - } - var entities = this.entities; - var key; - var val; - var op; - if (!(key = entities.variableCurly())) { - key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/); - } - op = parserInput.$re(/^[|~*$^]?=/); - if (op) { - val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\w-]+/) || entities.variableCurly(); - } - expectChar(']'); - return new (tree_1.default.Attribute)(key, op, val); - }, - // - // The `block` rule is used by `ruleset` and `mixin.definition`. - // It's a wrapper around the `primary` rule, with added `{}`. - // - block: function () { - var content; - if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) { - return content; - } - }, - blockRuleset: function () { - var block = this.block(); - if (block) { - block = new tree_1.default.Ruleset(null, block); - } - return block; - }, - detachedRuleset: function () { - var argInfo; - var params; - var variadic; - parserInput.save(); - if (parserInput.$re(/^[.#]\(/)) { - /** - * DR args currently only implemented for each() function, and not - * yet settable as `@dr: #(@arg) {}` - * This should be done when DRs are merged with mixins. - * See: https://github.com/less/less-meta/issues/16 - */ - argInfo = this.mixin.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - if (!parserInput.$char(')')) { - parserInput.restore(); - return; - } - } - var blockRuleset = this.blockRuleset(); - if (blockRuleset) { - parserInput.forget(); - if (params) { - return new tree_1.default.mixin.Definition(null, params, blockRuleset, null, variadic); - } - return new tree_1.default.DetachedRuleset(blockRuleset); - } - parserInput.restore(); - }, - // - // div, .class, body > p {...} - // - ruleset: function () { - var selectors; - var rules; - var debugInfo; - parserInput.save(); - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(parserInput.i); - } - selectors = this.selectors(); - if (selectors && (rules = this.block())) { - parserInput.forget(); - var ruleset = new (tree_1.default.Ruleset)(selectors, rules, context.strictImports); - if (context.dumpLineNumbers) { - ruleset.debugInfo = debugInfo; - } - return ruleset; - } - else { - parserInput.restore(); - } - }, - declaration: function () { - var name; - var value; - var index = parserInput.i; - var hasDR; - var c = parserInput.currentChar(); - var important; - var merge; - var isVariable; - if (c === '.' || c === '#' || c === '&' || c === ':') { - return; - } - parserInput.save(); - name = this.variable() || this.ruleProperty(); - if (name) { - isVariable = typeof name === 'string'; - if (isVariable) { - value = this.detachedRuleset(); - if (value) { - hasDR = true; - } - } - parserInput.commentStore.length = 0; - if (!value) { - // a name returned by this.ruleProperty() is always an array of the form: - // [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"] - // where each item is a tree.Keyword or tree.Variable - merge = !isVariable && name.length > 1 && name.pop().value; - // Custom property values get permissive parsing - if (name[0].value && name[0].value.slice(0, 2) === '--') { - value = this.permissiveValue(); - } - // Try to store values as anonymous - // If we need the value later we'll re-parse it in ruleset.parseValue - else { - value = this.anonymousValue(); - } - if (value) { - parserInput.forget(); - // anonymous values absorb the end ';' which is required for them to work - return new (tree_1.default.Declaration)(name, value, false, merge, index, fileInfo); - } - if (!value) { - value = this.value(); - } - if (value) { - important = this.important(); - } - else if (isVariable) { - // As a last resort, try permissiveValue - value = this.permissiveValue(); - } - } - if (value && (this.end() || hasDR)) { - parserInput.forget(); - return new (tree_1.default.Declaration)(name, value, important, merge, index, fileInfo); - } - else { - parserInput.restore(); - } - } - else { - parserInput.restore(); - } - }, - anonymousValue: function () { - var index = parserInput.i; - var match = parserInput.$re(/^([^.#@\$+\/'"*`(;{}-]*);/); - if (match) { - return new (tree_1.default.Anonymous)(match[1], index); - } - }, - /** - * Used for custom properties, at-rules, and variables (as fallback) - * Parses almost anything inside of {} [] () "" blocks - * until it reaches outer-most tokens. - * - * First, it will try to parse comments and entities to reach - * the end. This is mostly like the Expression parser except no - * math is allowed. - */ - permissiveValue: function (untilTokens) { - var i; - var e; - var done; - var value; - var tok = untilTokens || ';'; - var index = parserInput.i; - var result = []; - function testCurrentChar() { - var char = parserInput.currentChar(); - if (typeof tok === 'string') { - return char === tok; - } - else { - return tok.test(char); - } - } - if (testCurrentChar()) { - return; - } - value = []; - do { - e = this.comment(); - if (e) { - value.push(e); - continue; - } - e = this.entity(); - if (e) { - value.push(e); - } - } while (e); - done = testCurrentChar(); - if (value.length > 0) { - value = new (tree_1.default.Expression)(value); - if (done) { - return value; - } - else { - result.push(value); - } - // Preserve space before $parseUntil as it will not - if (parserInput.prevChar() === ' ') { - result.push(new tree_1.default.Anonymous(' ', index)); - } - } - parserInput.save(); - value = parserInput.$parseUntil(tok); - if (value) { - if (typeof value === 'string') { - error("Expected '" + value + "'", 'Parse'); - } - if (value.length === 1 && value[0] === ' ') { - parserInput.forget(); - return new tree_1.default.Anonymous('', index); - } - var item = void 0; - for (i = 0; i < value.length; i++) { - item = value[i]; - if (Array.isArray(item)) { - // Treat actual quotes as normal quoted values - result.push(new tree_1.default.Quoted(item[0], item[1], true, index, fileInfo)); - } - else { - if (i === value.length - 1) { - item = item.trim(); - } - // Treat like quoted values, but replace vars like unquoted expressions - var quote = new tree_1.default.Quoted('\'', item, true, index, fileInfo); - quote.variableRegex = /@([\w-]+)/g; - quote.propRegex = /\$([\w-]+)/g; - result.push(quote); - } - } - parserInput.forget(); - return new tree_1.default.Expression(result, true); - } - parserInput.restore(); - }, - // - // An @import atrule - // - // @import "lib"; - // - // Depending on our environment, importing is done differently: - // In the browser, it's an XHR request, in Node, it would be a - // file-system operation. The function used for importing is - // stored in `import`, which we pass to the Import constructor. - // - 'import': function () { - var path; - var features; - var index = parserInput.i; - var dir = parserInput.$re(/^@import?\s+/); - if (dir) { - var options = (dir ? this.importOptions() : null) || {}; - if ((path = this.entities.quoted() || this.entities.url())) { - features = this.mediaFeatures(); - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon or unrecognised media features on import'); - } - features = features && new (tree_1.default.Value)(features); - return new (tree_1.default.Import)(path, features, options, index, fileInfo); - } - else { - parserInput.i = index; - error('malformed import statement'); - } - } - }, - importOptions: function () { - var o; - var options = {}; - var optionName; - var value; - // list of options, surrounded by parens - if (!parserInput.$char('(')) { - return null; - } - do { - o = this.importOption(); - if (o) { - optionName = o; - value = true; - switch (optionName) { - case 'css': - optionName = 'less'; - value = false; - break; - case 'once': - optionName = 'multiple'; - value = false; - break; - } - options[optionName] = value; - if (!parserInput.$char(',')) { - break; - } - } - } while (o); - expectChar(')'); - return options; - }, - importOption: function () { - var opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/); - if (opt) { - return opt[1]; - } - }, - mediaFeature: function () { - var entities = this.entities; - var nodes = []; - var e; - var p; - parserInput.save(); - do { - e = entities.keyword() || entities.variable() || entities.mixinLookup(); - if (e) { - nodes.push(e); - } - else if (parserInput.$char('(')) { - p = this.property(); - e = this.value(); - if (parserInput.$char(')')) { - if (p && e) { - nodes.push(new (tree_1.default.Paren)(new (tree_1.default.Declaration)(p, e, null, null, parserInput.i, fileInfo, true))); - } - else if (e) { - nodes.push(new (tree_1.default.Paren)(e)); - } - else { - error('badly formed media feature definition'); - } - } - else { - error('Missing closing \')\'', 'Parse'); - } - } - } while (e); - parserInput.forget(); - if (nodes.length > 0) { - return new (tree_1.default.Expression)(nodes); - } - }, - mediaFeatures: function () { - var entities = this.entities; - var features = []; - var e; - do { - e = this.mediaFeature(); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { - break; - } - } - else { - e = entities.variable() || entities.mixinLookup(); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { - break; - } - } - } - } while (e); - return features.length > 0 ? features : null; - }, - media: function () { - var features; - var rules; - var media; - var debugInfo; - var index = parserInput.i; - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(index); - } - parserInput.save(); - if (parserInput.$str('@media')) { - features = this.mediaFeatures(); - rules = this.block(); - if (!rules) { - error('media definitions require block statements after any features'); - } - parserInput.forget(); - media = new (tree_1.default.Media)(rules, features, index, fileInfo); - if (context.dumpLineNumbers) { - media.debugInfo = debugInfo; - } - return media; - } - parserInput.restore(); - }, - // - // A @plugin directive, used to import plugins dynamically. - // - // @plugin (args) "lib"; - // - plugin: function () { - var path; - var args; - var options; - var index = parserInput.i; - var dir = parserInput.$re(/^@plugin?\s+/); - if (dir) { - args = this.pluginArgs(); - if (args) { - options = { - pluginArgs: args, - isPlugin: true - }; - } - else { - options = { isPlugin: true }; - } - if ((path = this.entities.quoted() || this.entities.url())) { - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon on @plugin'); - } - return new (tree_1.default.Import)(path, null, options, index, fileInfo); - } - else { - parserInput.i = index; - error('malformed @plugin statement'); - } - } - }, - pluginArgs: function () { - // list of options, surrounded by parens - parserInput.save(); - if (!parserInput.$char('(')) { - parserInput.restore(); - return null; - } - var args = parserInput.$re(/^\s*([^\);]+)\)\s*/); - if (args[1]) { - parserInput.forget(); - return args[1].trim(); - } - else { - parserInput.restore(); - return null; - } - }, - // - // A CSS AtRule - // - // @charset "utf-8"; - // - atrule: function () { - var index = parserInput.i; - var name; - var value; - var rules; - var nonVendorSpecificName; - var hasIdentifier; - var hasExpression; - var hasUnknown; - var hasBlock = true; - var isRooted = true; - if (parserInput.currentChar() !== '@') { - return; - } - value = this['import']() || this.plugin() || this.media(); - if (value) { - return value; - } - parserInput.save(); - name = parserInput.$re(/^@[a-z-]+/); - if (!name) { - return; - } - nonVendorSpecificName = name; - if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) { - nonVendorSpecificName = "@" + name.slice(name.indexOf('-', 2) + 1); - } - switch (nonVendorSpecificName) { - case '@charset': - hasIdentifier = true; - hasBlock = false; - break; - case '@namespace': - hasExpression = true; - hasBlock = false; - break; - case '@keyframes': - case '@counter-style': - hasIdentifier = true; - break; - case '@document': - case '@supports': - hasUnknown = true; - isRooted = false; - break; - default: - hasUnknown = true; - break; - } - parserInput.commentStore.length = 0; - if (hasIdentifier) { - value = this.entity(); - if (!value) { - error("expected " + name + " identifier"); - } - } - else if (hasExpression) { - value = this.expression(); - if (!value) { - error("expected " + name + " expression"); - } - } - else if (hasUnknown) { - value = this.permissiveValue(/^[{;]/); - hasBlock = (parserInput.currentChar() === '{'); - if (!value) { - if (!hasBlock && parserInput.currentChar() !== ';') { - error(name + " rule is missing block or ending semi-colon"); - } - } - else if (!value.value) { - value = null; - } - } - if (hasBlock) { - rules = this.blockRuleset(); - } - if (rules || (!hasBlock && value && parserInput.$char(';'))) { - parserInput.forget(); - return new (tree_1.default.AtRule)(name, value, rules, index, fileInfo, context.dumpLineNumbers ? getDebugInfo(index) : null, isRooted); - } - parserInput.restore('at-rule options not recognised'); - }, - // - // A Value is a comma-delimited list of Expressions - // - // font-family: Baskerville, Georgia, serif; - // - // In a Rule, a Value represents everything after the `:`, - // and before the `;`. - // - value: function () { - var e; - var expressions = []; - var index = parserInput.i; - do { - e = this.expression(); - if (e) { - expressions.push(e); - if (!parserInput.$char(',')) { - break; - } - } - } while (e); - if (expressions.length > 0) { - return new (tree_1.default.Value)(expressions, index); - } - }, - important: function () { - if (parserInput.currentChar() === '!') { - return parserInput.$re(/^! *important/); - } - }, - sub: function () { - var a; - var e; - parserInput.save(); - if (parserInput.$char('(')) { - a = this.addition(); - if (a && parserInput.$char(')')) { - parserInput.forget(); - e = new (tree_1.default.Expression)([a]); - e.parens = true; - return e; - } - parserInput.restore('Expected \')\''); - return; - } - parserInput.restore(); - }, - multiplication: function () { - var m; - var a; - var op; - var operation; - var isSpaced; - m = this.operand(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - if (parserInput.peek(/^\/[*\/]/)) { - break; - } - parserInput.save(); - op = parserInput.$char('/') || parserInput.$char('*') || parserInput.$str('./'); - if (!op) { - parserInput.forget(); - break; - } - a = this.operand(); - if (!a) { - parserInput.restore(); - break; - } - parserInput.forget(); - m.parensInOp = true; - a.parensInOp = true; - operation = new (tree_1.default.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - addition: function () { - var m; - var a; - var op; - var operation; - var isSpaced; - m = this.multiplication(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - op = parserInput.$re(/^[-+]\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-'))); - if (!op) { - break; - } - a = this.multiplication(); - if (!a) { - break; - } - m.parensInOp = true; - a.parensInOp = true; - operation = new (tree_1.default.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - conditions: function () { - var a; - var b; - var index = parserInput.i; - var condition; - a = this.condition(true); - if (a) { - while (true) { - if (!parserInput.peek(/^,\s*(not\s*)?\(/) || !parserInput.$char(',')) { - break; - } - b = this.condition(true); - if (!b) { - break; - } - condition = new (tree_1.default.Condition)('or', condition || a, b, index); - } - return condition || a; - } - }, - condition: function (needsParens) { - var result; - var logical; - var next; - function or() { - return parserInput.$str('or'); - } - result = this.conditionAnd(needsParens); - if (!result) { - return; - } - logical = or(); - if (logical) { - next = this.condition(needsParens); - if (next) { - result = new (tree_1.default.Condition)(logical, result, next); - } - else { - return; - } - } - return result; - }, - conditionAnd: function (needsParens) { - var result; - var logical; - var next; - var self = this; - function insideCondition() { - var cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens); - if (!cond && !needsParens) { - return self.atomicCondition(needsParens); - } - return cond; - } - function and() { - return parserInput.$str('and'); - } - result = insideCondition(); - if (!result) { - return; - } - logical = and(); - if (logical) { - next = this.conditionAnd(needsParens); - if (next) { - result = new (tree_1.default.Condition)(logical, result, next); - } - else { - return; - } - } - return result; - }, - negatedCondition: function (needsParens) { - if (parserInput.$str('not')) { - var result = this.parenthesisCondition(needsParens); - if (result) { - result.negate = !result.negate; - } - return result; - } - }, - parenthesisCondition: function (needsParens) { - function tryConditionFollowedByParenthesis(me) { - var body; - parserInput.save(); - body = me.condition(needsParens); - if (!body) { - parserInput.restore(); - return; - } - if (!parserInput.$char(')')) { - parserInput.restore(); - return; - } - parserInput.forget(); - return body; - } - var body; - parserInput.save(); - if (!parserInput.$str('(')) { - parserInput.restore(); - return; - } - body = tryConditionFollowedByParenthesis(this); - if (body) { - parserInput.forget(); - return body; - } - body = this.atomicCondition(needsParens); - if (!body) { - parserInput.restore(); - return; - } - if (!parserInput.$char(')')) { - parserInput.restore("expected ')' got '" + parserInput.currentChar() + "'"); - return; - } - parserInput.forget(); - return body; - }, - atomicCondition: function (needsParens) { - var entities = this.entities; - var index = parserInput.i; - var a; - var b; - var c; - var op; - function cond() { - return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup(); - } - cond = cond.bind(this); - a = cond(); - if (a) { - if (parserInput.$char('>')) { - if (parserInput.$char('=')) { - op = '>='; - } - else { - op = '>'; - } - } - else if (parserInput.$char('<')) { - if (parserInput.$char('=')) { - op = '<='; - } - else { - op = '<'; - } - } - else if (parserInput.$char('=')) { - if (parserInput.$char('>')) { - op = '=>'; - } - else if (parserInput.$char('<')) { - op = '=<'; - } - else { - op = '='; - } - } - if (op) { - b = cond(); - if (b) { - c = new (tree_1.default.Condition)(op, a, b, index, false); - } - else { - error('expected expression'); - } - } - else { - c = new (tree_1.default.Condition)('=', a, new (tree_1.default.Keyword)('true'), index, false); - } - return c; - } - }, - // - // An operand is anything that can be part of an operation, - // such as a Color, or a Variable - // - operand: function () { - var entities = this.entities; - var negate; - if (parserInput.peek(/^-[@\$\(]/)) { - negate = parserInput.$char('-'); - } - var o = this.sub() || entities.dimension() || - entities.color() || entities.variable() || - entities.property() || entities.call() || - entities.quoted(true) || entities.colorKeyword() || - entities.mixinLookup(); - if (negate) { - o.parensInOp = true; - o = new (tree_1.default.Negative)(o); - } - return o; - }, - // - // Expressions either represent mathematical operations, - // or white-space delimited Entities. - // - // 1px solid black - // @var * 2 - // - expression: function () { - var entities = []; - var e; - var delim; - var index = parserInput.i; - do { - e = this.comment(); - if (e) { - entities.push(e); - continue; - } - e = this.addition() || this.entity(); - if (e instanceof tree_1.default.Comment) { - e = null; - } - if (e) { - entities.push(e); - // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here - if (!parserInput.peek(/^\/[\/*]/)) { - delim = parserInput.$char('/'); - if (delim) { - entities.push(new (tree_1.default.Anonymous)(delim, index)); - } - } - } - } while (e); - if (entities.length > 0) { - return new (tree_1.default.Expression)(entities); - } - }, - property: function () { - var name = parserInput.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/); - if (name) { - return name[1]; - } - }, - ruleProperty: function () { - var name = []; - var index = []; - var s; - var k; - parserInput.save(); - var simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\s*:/); - if (simpleProperty) { - name = [new (tree_1.default.Keyword)(simpleProperty[1])]; - parserInput.forget(); - return name; - } - function match(re) { - var i = parserInput.i; - var chunk = parserInput.$re(re); - if (chunk) { - index.push(i); - return name.push(chunk[1]); - } - } - match(/^(\*?)/); - while (true) { - if (!match(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/)) { - break; - } - } - if ((name.length > 1) && match(/^((?:\+_|\+)?)\s*:/)) { - parserInput.forget(); - // at last, we have the complete match now. move forward, - // convert name particles to tree objects and return: - if (name[0] === '') { - name.shift(); - index.shift(); - } - for (k = 0; k < name.length; k++) { - s = name[k]; - name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ? - new (tree_1.default.Keyword)(s) : - (s.charAt(0) === '@' ? - new (tree_1.default.Variable)("@" + s.slice(2, -1), index[k], fileInfo) : - new (tree_1.default.Property)("$" + s.slice(2, -1), index[k], fileInfo)); - } - return name; - } - parserInput.restore(); - } - } - }; -}; -Parser.serializeVars = function (vars) { - var s = ''; - for (var name_1 in vars) { - if (Object.hasOwnProperty.call(vars, name_1)) { - var value = vars[name_1]; - s += ((name_1[0] === '@') ? '' : '@') + name_1 + ": " + value + ((String(value).slice(-1) === ';') ? '' : ';'); - } - } - return s; -}; -exports.default = Parser; -//# sourceMappingURL=parser.js.map \ No newline at end of file diff --git a/packages/less/lib/less/parser/parser.js.map b/packages/less/lib/less/parser/parser.js.map deleted file mode 100644 index 0acdc2356..000000000 --- a/packages/less/lib/less/parser/parser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/less/parser/parser.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAsC;AACtC,iDAA2B;AAC3B,yDAAmC;AACnC,gEAA4C;AAC5C,8CAAkC;AAClC,qFAA8D;AAE9D,EAAE;AACF,mBAAmB;AACnB,EAAE;AACF,sDAAsD;AACtD,gEAAgE;AAChE,mBAAmB;AACnB,EAAE;AACF,mEAAmE;AACnE,kCAAkC;AAClC,EAAE;AACF,yEAAyE;AACzE,mEAAmE;AACnE,kDAAkD;AAClD,iEAAiE;AACjE,8DAA8D;AAC9D,4CAA4C;AAC5C,EAAE;AACF,gEAAgE;AAChE,sEAAsE;AACtE,oEAAoE;AACpE,iCAAiC;AACjC,yEAAyE;AACzE,iEAAiE;AACjE,qEAAqE;AACrE,+EAA+E;AAC/E,+CAA+C;AAC/C,EAAE;AACF,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAC5D,EAAE;AAEF,IAAM,MAAM,GAAG,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ;IACrD,IAAI,OAAO,CAAC;IACZ,IAAM,WAAW,GAAG,sBAAc,EAAE,CAAC;IAErC,SAAS,KAAK,CAAC,GAAG,EAAE,IAAI;QACpB,MAAM,IAAI,oBAAS,CACf;YACI,KAAK,EAAE,WAAW,CAAC,CAAC;YACpB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,IAAI,EAAE,IAAI,IAAI,QAAQ;YACtB,OAAO,EAAE,GAAG;SACf,EACD,OAAO,CACV,CAAC;IACN,CAAC;IAED,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG;QACpB,0DAA0D;QAC1D,IAAM,MAAM,GAAG,CAAC,GAAG,YAAY,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GA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AAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAE,CAAC;SAC5G;KACJ;IAED,OAAO,CAAC,CAAC;AACb,CAAC,CAAC;AAEF,kBAAe,MAAM,CAAC","sourcesContent":["import LessError from '../less-error';\nimport tree from '../tree';\nimport visitors from '../visitors';\nimport getParserInput from './parser-input';\nimport * as utils from '../utils';\nimport functionRegistry from '../functions/function-registry';\n\n//\n// less.js - parser\n//\n// A relatively straight-forward predictive parser.\n// There is no tokenization/lexing stage, the input is parsed\n// in one sweep.\n//\n// To make the parser fast enough to run in the browser, several\n// optimization had to be made:\n//\n// - Matching and slicing on a huge input is often cause of slowdowns.\n// The solution is to chunkify the input into smaller strings.\n// The chunks are stored in the `chunks` var,\n// `j` holds the current chunk index, and `currentPos` holds\n// the index of the current chunk in relation to `input`.\n// This gives us an almost 4x speed-up.\n//\n// - In many cases, we don't need to match individual tokens;\n// for example, if a value doesn't hold any variables, operations\n// or dynamic references, the parser can effectively 'skip' it,\n// treating it as a literal.\n// An example would be '1px solid #000' - which evaluates to itself,\n// we don't need to know what the individual components are.\n// The drawback, of course is that you don't get the benefits of\n// syntax-checking on the CSS. This gives us a 50% speed-up in the parser,\n// and a smaller speed-up in the code-gen.\n//\n//\n// Token matching is done with the `$` function, which either takes\n// a terminal string or regexp, or a non-terminal function to call.\n// It also takes care of moving all the indices forwards.\n//\n\nconst Parser = function Parser(context, imports, fileInfo) {\n let parsers;\n const parserInput = getParserInput();\n\n function error(msg, type) {\n throw new LessError(\n {\n index: parserInput.i,\n filename: fileInfo.filename,\n type: type || 'Syntax',\n message: msg\n },\n imports\n );\n }\n\n function expect(arg, msg) {\n // some older browsers return typeof 'function' for RegExp\n const result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg);\n if (result) {\n return result;\n }\n \n error(msg || (typeof arg === 'string'\n ? `expected '${arg}' got '${parserInput.currentChar()}'`\n : 'unexpected token'));\n }\n\n // Specialization of expect()\n function expectChar(arg, msg) {\n if (parserInput.$char(arg)) {\n return arg;\n }\n error(msg || `expected '${arg}' got '${parserInput.currentChar()}'`);\n }\n\n function getDebugInfo(index) {\n const filename = fileInfo.filename;\n\n return {\n lineNumber: utils.getLocation(index, parserInput.getInput()).line + 1,\n fileName: filename\n };\n }\n\n /**\n * Used after initial parsing to create nodes on the fly\n * \n * @param {String} str - string to parse \n * @param {Array} parseList - array of parsers to run input through e.g. [\"value\", \"important\"]\n * @param {Number} currentIndex - start number to begin indexing\n * @param {Object} fileInfo - fileInfo to attach to created nodes\n */\n function parseNode(str, parseList, currentIndex, fileInfo, callback) {\n let result;\n const returnNodes = [];\n const parser = parserInput;\n\n try {\n parser.start(str, false, function fail(msg, index) {\n callback({\n message: msg,\n index: index + currentIndex\n });\n });\n for (let x = 0, p, i; (p = parseList[x]); x++) {\n i = parser.i;\n result = parsers[p]();\n if (result) {\n try {\n result._index = i + currentIndex;\n result._fileInfo = fileInfo;\n } catch (e) {}\n returnNodes.push(result);\n }\n else {\n returnNodes.push(null);\n }\n }\n\n const endInfo = parser.end();\n if (endInfo.isFinished) {\n callback(null, returnNodes);\n }\n else {\n callback(true, null);\n }\n } catch (e) {\n throw new LessError({\n index: e.index + currentIndex,\n message: e.message\n }, imports, fileInfo.filename);\n }\n }\n\n //\n // The Parser\n //\n return {\n parserInput,\n imports,\n fileInfo,\n parseNode,\n //\n // Parse an input string into an abstract syntax tree,\n // @param str A string containing 'less' markup\n // @param callback call `callback` when done.\n // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply\n //\n parse: function (str, callback, additionalData) {\n let root;\n let error = null;\n let globalVars;\n let modifyVars;\n let ignored;\n let preText = '';\n\n globalVars = (additionalData && additionalData.globalVars) ? `${Parser.serializeVars(additionalData.globalVars)}\\n` : '';\n modifyVars = (additionalData && additionalData.modifyVars) ? `\\n${Parser.serializeVars(additionalData.modifyVars)}` : '';\n\n if (context.pluginManager) {\n const preProcessors = context.pluginManager.getPreProcessors();\n for (let i = 0; i < preProcessors.length; i++) {\n str = preProcessors[i].process(str, { context, imports, fileInfo });\n }\n }\n\n if (globalVars || (additionalData && additionalData.banner)) {\n preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars;\n ignored = imports.contentsIgnoredChars;\n ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0;\n ignored[fileInfo.filename] += preText.length;\n }\n\n str = str.replace(/\\r\\n?/g, '\\n');\n // Remove potential UTF Byte Order Mark\n str = preText + str.replace(/^\\uFEFF/, '') + modifyVars;\n imports.contents[fileInfo.filename] = str;\n\n // Start with the primary rule.\n // The whole syntax tree is held under a Ruleset node,\n // with the `root` property set to true, so no `{}` are\n // output. The callback is called when the input is parsed.\n try {\n parserInput.start(str, context.chunkInput, function fail(msg, index) {\n throw new LessError({\n index,\n type: 'Parse',\n message: msg,\n filename: fileInfo.filename\n }, imports);\n });\n\n tree.Node.prototype.parse = this;\n root = new tree.Ruleset(null, this.parsers.primary());\n tree.Node.prototype.rootNode = root;\n root.root = true;\n root.firstRoot = true;\n root.functionRegistry = functionRegistry.inherit();\n \n } catch (e) {\n return callback(new LessError(e, imports, fileInfo.filename));\n }\n\n // If `i` is smaller than the `input.length - 1`,\n // it means the parser wasn't able to parse the whole\n // string, so we've got a parsing error.\n //\n // We try to extract a \\n delimited string,\n // showing the line where the parse error occurred.\n // We split it up into two parts (the part which parsed,\n // and the part which didn't), so we can color them differently.\n const endInfo = parserInput.end();\n if (!endInfo.isFinished) {\n\n let message = endInfo.furthestPossibleErrorMessage;\n\n if (!message) {\n message = 'Unrecognised input';\n if (endInfo.furthestChar === '}') {\n message += '. Possibly missing opening \\'{\\'';\n } else if (endInfo.furthestChar === ')') {\n message += '. Possibly missing opening \\'(\\'';\n } else if (endInfo.furthestReachedEnd) {\n message += '. Possibly missing something';\n }\n }\n\n error = new LessError({\n type: 'Parse',\n message,\n index: endInfo.furthest,\n filename: fileInfo.filename\n }, imports);\n }\n\n const finish = e => {\n e = error || e || imports.error;\n\n if (e) {\n if (!(e instanceof LessError)) {\n e = new LessError(e, imports, fileInfo.filename);\n }\n\n return callback(e);\n }\n else {\n return callback(null, root);\n }\n };\n\n if (context.processImports !== false) {\n new visitors.ImportVisitor(imports, finish)\n .run(root);\n } else {\n return finish();\n }\n },\n\n //\n // Here in, the parsing rules/functions\n //\n // The basic structure of the syntax tree generated is as follows:\n //\n // Ruleset -> Declaration -> Value -> Expression -> Entity\n //\n // Here's some Less code:\n //\n // .class {\n // color: #fff;\n // border: 1px solid #000;\n // width: @w + 4px;\n // > .child {...}\n // }\n //\n // And here's what the parse tree might look like:\n //\n // Ruleset (Selector '.class', [\n // Declaration (\"color\", Value ([Expression [Color #fff]]))\n // Declaration (\"border\", Value ([Expression [Dimension 1px][Keyword \"solid\"][Color #000]]))\n // Declaration (\"width\", Value ([Expression [Operation \" + \" [Variable \"@w\"][Dimension 4px]]]))\n // Ruleset (Selector [Element '>', '.child'], [...])\n // ])\n //\n // In general, most rules will try to parse a token with the `$re()` function, and if the return\n // value is truly, will return a new node, of the relevant type. Sometimes, we need to check\n // first, before parsing, that's when we use `peek()`.\n //\n parsers: parsers = {\n //\n // The `primary` rule is the *entry* and *exit* point of the parser.\n // The rules here can appear at any level of the parse tree.\n //\n // The recursive nature of the grammar is an interplay between the `block`\n // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,\n // as represented by this simplified grammar:\n //\n // primary → (ruleset | declaration)+\n // ruleset → selector+ block\n // block → '{' primary '}'\n //\n // Only at one point is the primary rule not called from the\n // block rule: at the root level.\n //\n primary: function () {\n const mixin = this.mixin;\n let root = [];\n let node;\n\n while (true) {\n while (true) {\n node = this.comment();\n if (!node) { break; }\n root.push(node);\n }\n // always process comments before deciding if finished\n if (parserInput.finished) {\n break;\n }\n if (parserInput.peek('}')) {\n break;\n }\n\n node = this.extendRule();\n if (node) {\n root = root.concat(node);\n continue;\n }\n\n node = mixin.definition() || this.declaration() || mixin.call(false, false) || \n this.ruleset() || this.variableCall() || this.entities.call() || this.atrule();\n if (node) {\n root.push(node);\n } else {\n let foundSemiColon = false;\n while (parserInput.$char(';')) {\n foundSemiColon = true;\n }\n if (!foundSemiColon) {\n break;\n }\n }\n }\n\n return root;\n },\n\n // comments are collected by the main parsing mechanism and then assigned to nodes\n // where the current structure allows it\n comment: function () {\n if (parserInput.commentStore.length) {\n const comment = parserInput.commentStore.shift();\n return new(tree.Comment)(comment.text, comment.isLineComment, comment.index, fileInfo);\n }\n },\n\n //\n // Entities are tokens which can be found inside an Expression\n //\n entities: {\n mixinLookup: function() {\n return parsers.mixin.call(true, true);\n },\n //\n // A string, which supports escaping \" and '\n //\n // \"milky way\" 'he\\'s the one!'\n //\n quoted: function (forceEscaped) {\n let str;\n const index = parserInput.i;\n let isEscaped = false;\n\n parserInput.save();\n if (parserInput.$char('~')) {\n isEscaped = true;\n } else if (forceEscaped) {\n parserInput.restore();\n return;\n }\n\n str = parserInput.$quoted();\n if (!str) {\n parserInput.restore();\n return;\n }\n parserInput.forget();\n\n return new(tree.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index, fileInfo);\n },\n\n //\n // A catch-all word, such as:\n //\n // black border-collapse\n //\n keyword: function () {\n const k = parserInput.$char('%') || parserInput.$re(/^\\[?(?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\\]?/);\n if (k) {\n return tree.Color.fromKeyword(k) || new(tree.Keyword)(k);\n }\n },\n\n //\n // A function call\n //\n // rgb(255, 0, 255)\n //\n // The arguments are parsed with the `entities.arguments` parser.\n //\n call: function () {\n let name;\n let args;\n let func;\n const index = parserInput.i;\n\n // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18\n if (parserInput.peek(/^url\\(/i)) {\n return;\n }\n\n parserInput.save();\n\n name = parserInput.$re(/^([\\w-]+|%|progid:[\\w\\.]+)\\(/);\n if (!name) {\n parserInput.forget(); \n return;\n }\n\n name = name[1];\n func = this.customFuncCall(name);\n if (func) {\n args = func.parse();\n if (args && func.stop) {\n parserInput.forget();\n return args;\n }\n }\n\n args = this.arguments(args);\n\n if (!parserInput.$char(')')) {\n parserInput.restore('Could not parse call arguments or missing \\')\\'');\n return;\n }\n\n parserInput.forget();\n\n return new(tree.Call)(name, args, index, fileInfo);\n },\n \n //\n // Parsing rules for functions with non-standard args, e.g.:\n //\n // boolean(not(2 > 1))\n //\n // This is a quick prototype, to be modified/improved when\n // more custom-parsed funcs come (e.g. `selector(...)`)\n //\n\n customFuncCall: function (name) {\n /* Ideally the table is to be moved out of here for faster perf.,\n but it's quite tricky since it relies on all these `parsers`\n and `expect` available only here */\n return {\n alpha: f(parsers.ieAlpha, true),\n boolean: f(condition),\n 'if': f(condition)\n }[name.toLowerCase()];\n\n function f(parse, stop) {\n return {\n parse, // parsing function\n stop // when true - stop after parse() and return its result, \n // otherwise continue for plain args\n };\n }\n \n function condition() {\n return [expect(parsers.condition, 'expected condition')];\n }\n },\n\n arguments: function (prevArgs) {\n let argsComma = prevArgs || [];\n const argsSemiColon = [];\n let isSemiColonSeparated;\n let value;\n\n parserInput.save();\n\n while (true) {\n if (prevArgs) {\n prevArgs = false;\n } else {\n value = parsers.detachedRuleset() || this.assignment() || parsers.expression();\n if (!value) {\n break;\n }\n\n if (value.value && value.value.length == 1) {\n value = value.value[0];\n }\n\n argsComma.push(value);\n }\n\n if (parserInput.$char(',')) {\n continue;\n }\n\n if (parserInput.$char(';') || isSemiColonSeparated) {\n isSemiColonSeparated = true;\n value = (argsComma.length < 1) ? argsComma[0]\n : new tree.Value(argsComma);\n argsSemiColon.push(value);\n argsComma = [];\n }\n }\n\n parserInput.forget();\n return isSemiColonSeparated ? argsSemiColon : argsComma;\n },\n literal: function () {\n return this.dimension() ||\n this.color() ||\n this.quoted() ||\n this.unicodeDescriptor();\n },\n\n // Assignments are argument entities for calls.\n // They are present in ie filter properties as shown below.\n //\n // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* )\n //\n\n assignment: function () {\n let key;\n let value;\n parserInput.save();\n key = parserInput.$re(/^\\w+(?=\\s?=)/i);\n if (!key) {\n parserInput.restore();\n return;\n }\n if (!parserInput.$char('=')) {\n parserInput.restore();\n return;\n }\n value = parsers.entity();\n if (value) {\n parserInput.forget();\n return new(tree.Assignment)(key, value);\n } else {\n parserInput.restore();\n }\n },\n\n //\n // Parse url() tokens\n //\n // We use a specific rule for urls, because they don't really behave like\n // standard function calls. The difference is that the argument doesn't have\n // to be enclosed within a string, so it can't be parsed as an Expression.\n //\n url: function () {\n let value;\n const index = parserInput.i;\n\n parserInput.autoCommentAbsorb = false;\n\n if (!parserInput.$str('url(')) {\n parserInput.autoCommentAbsorb = true;\n return;\n }\n\n value = this.quoted() || this.variable() || this.property() ||\n parserInput.$re(/^(?:(?:\\\\[\\(\\)'\"])|[^\\(\\)'\"])+/) || '';\n\n parserInput.autoCommentAbsorb = true;\n\n expectChar(')');\n\n return new(tree.URL)((value.value != null || \n value instanceof tree.Variable || \n value instanceof tree.Property) ?\n value : new(tree.Anonymous)(value, index), index, fileInfo);\n },\n\n //\n // A Variable entity, such as `@fink`, in\n //\n // width: @fink + 2px\n //\n // We use a different parser for variable definitions,\n // see `parsers.variable`.\n //\n variable: function () {\n let ch;\n let name;\n const index = parserInput.i;\n\n parserInput.save();\n if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\\w-]+/))) {\n ch = parserInput.currentChar();\n if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\\s/)) {\n // this may be a VariableCall lookup\n const result = parsers.variableCall(name);\n if (result) {\n parserInput.forget();\n return result;\n }\n }\n parserInput.forget();\n return new(tree.Variable)(name, index, fileInfo);\n }\n parserInput.restore();\n },\n\n // A variable entity using the protective {} e.g. @{var}\n variableCurly: function () {\n let curly;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\\{([\\w-]+)\\}/))) {\n return new(tree.Variable)(`@${curly[1]}`, index, fileInfo);\n }\n },\n //\n // A Property accessor, such as `$color`, in\n //\n // background-color: $color\n //\n property: function () {\n let name;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\\$[\\w-]+/))) {\n return new(tree.Property)(name, index, fileInfo);\n }\n },\n\n // A property entity useing the protective {} e.g. ${prop}\n propertyCurly: function () {\n let curly;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\\$\\{([\\w-]+)\\}/))) {\n return new(tree.Property)(`$${curly[1]}`, index, fileInfo);\n }\n },\n //\n // A Hexadecimal color\n //\n // #4F3C2F\n //\n // `rgb` and `hsl` colors are parsed through the `entities.call` parser.\n //\n color: function () {\n let rgb;\n parserInput.save();\n\n if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\\w.#\\[])?/))) {\n if (!rgb[2]) {\n parserInput.forget();\n return new(tree.Color)(rgb[1], undefined, rgb[0]);\n } \n }\n parserInput.restore();\n },\n\n colorKeyword: function () {\n parserInput.save();\n const autoCommentAbsorb = parserInput.autoCommentAbsorb;\n parserInput.autoCommentAbsorb = false;\n const k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);\n parserInput.autoCommentAbsorb = autoCommentAbsorb;\n if (!k) {\n parserInput.forget();\n return;\n }\n parserInput.restore();\n const color = tree.Color.fromKeyword(k);\n if (color) {\n parserInput.$str(k);\n return color;\n }\n },\n\n //\n // A Dimension, that is, a number and a unit\n //\n // 0.5em 95%\n //\n dimension: function () {\n if (parserInput.peekNotNumeric()) {\n return;\n }\n\n const value = parserInput.$re(/^([+-]?\\d*\\.?\\d+)(%|[a-z_]+)?/i);\n if (value) {\n return new(tree.Dimension)(value[1], value[2]);\n }\n },\n\n //\n // A unicode descriptor, as is used in unicode-range\n //\n // U+0?? or U+00A1-00A9\n //\n unicodeDescriptor: function () {\n let ud;\n\n ud = parserInput.$re(/^U\\+[0-9a-fA-F?]+(\\-[0-9a-fA-F?]+)?/);\n if (ud) {\n return new(tree.UnicodeDescriptor)(ud[0]);\n }\n },\n\n //\n // JavaScript code to be evaluated\n //\n // `window.location.href`\n //\n javascript: function () {\n let js;\n const index = parserInput.i;\n\n parserInput.save();\n\n const escape = parserInput.$char('~');\n const jsQuote = parserInput.$char('`');\n\n if (!jsQuote) {\n parserInput.restore();\n return;\n }\n\n js = parserInput.$re(/^[^`]*`/);\n if (js) {\n parserInput.forget();\n return new(tree.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index, fileInfo);\n }\n parserInput.restore('invalid javascript definition');\n }\n },\n\n //\n // The variable part of a variable definition. Used in the `rule` parser\n //\n // @fink:\n //\n variable: function () {\n let name;\n\n if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\\w-]+)\\s*:/))) { return name[1]; }\n },\n\n //\n // Call a variable value to retrieve a detached ruleset\n // or a value from a detached ruleset's rules.\n //\n // @fink();\n // @fink;\n // color: @fink[@color];\n //\n variableCall: function (parsedName) {\n let lookups;\n const i = parserInput.i;\n const inValue = !!parsedName;\n let name = parsedName;\n\n parserInput.save();\n\n if (name || (parserInput.currentChar() === '@'\n && (name = parserInput.$re(/^(@[\\w-]+)(\\(\\s*\\))?/)))) {\n\n lookups = this.mixin.ruleLookups();\n\n if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) {\n parserInput.restore('Missing \\'[...]\\' lookup in variable call');\n return;\n }\n\n if (!inValue) {\n name = name[1];\n }\n\n const call = new tree.VariableCall(name, i, fileInfo);\n if (!inValue && parsers.end()) {\n parserInput.forget();\n return call;\n }\n else {\n parserInput.forget();\n return new tree.NamespaceValue(call, lookups, i, fileInfo);\n }\n }\n\n parserInput.restore();\n },\n\n //\n // extend syntax - used to extend selectors\n //\n extend: function(isRule) {\n let elements;\n let e;\n const index = parserInput.i;\n let option;\n let extendList;\n let extend;\n\n if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) {\n return;\n }\n\n do {\n option = null;\n elements = null;\n while (!(option = parserInput.$re(/^(all)(?=\\s*(\\)|,))/))) {\n e = this.element();\n if (!e) {\n break;\n }\n if (elements) {\n elements.push(e);\n } else {\n elements = [ e ];\n }\n }\n\n option = option && option[1];\n if (!elements) {\n error('Missing target selector for :extend().');\n }\n extend = new(tree.Extend)(new(tree.Selector)(elements), option, index, fileInfo);\n if (extendList) {\n extendList.push(extend);\n } else {\n extendList = [ extend ];\n }\n } while (parserInput.$char(','));\n\n expect(/^\\)/);\n\n if (isRule) {\n expect(/^;/);\n }\n\n return extendList;\n },\n\n //\n // extendRule - used in a rule to extend all the parent selectors\n //\n extendRule: function() {\n return this.extend(true);\n },\n\n //\n // Mixins\n //\n mixin: {\n //\n // A Mixin call, with an optional argument list\n //\n // #mixins > .square(#fff);\n // #mixins.square(#fff);\n // .rounded(4px, black);\n // .button;\n //\n // We can lookup / return a value using the lookup syntax:\n //\n // color: #mixin.square(#fff)[@color];\n //\n // The `while` loop is there because mixins can be\n // namespaced, but we only support the child and descendant\n // selector for now.\n //\n call: function (inValue, getLookup) {\n const s = parserInput.currentChar();\n let important = false;\n let lookups;\n const index = parserInput.i;\n let elements;\n let args;\n let hasParens;\n\n if (s !== '.' && s !== '#') { return; }\n\n parserInput.save(); // stop us absorbing part of an invalid selector\n\n elements = this.elements();\n\n if (elements) {\n if (parserInput.$char('(')) {\n args = this.args(true).args;\n expectChar(')');\n hasParens = true;\n }\n\n if (getLookup !== false) {\n lookups = this.ruleLookups();\n }\n if (getLookup === true && !lookups) {\n parserInput.restore();\n return;\n }\n\n if (inValue && !lookups && !hasParens) {\n // This isn't a valid in-value mixin call\n parserInput.restore();\n return;\n }\n\n if (!inValue && parsers.important()) {\n important = true;\n }\n\n if (inValue || parsers.end()) {\n parserInput.forget();\n const mixin = new(tree.mixin.Call)(elements, args, index, fileInfo, !lookups && important);\n if (lookups) {\n return new tree.NamespaceValue(mixin, lookups);\n }\n else {\n return mixin;\n }\n }\n }\n\n parserInput.restore();\n },\n /**\n * Matching elements for mixins\n * (Start with . or # and can have > )\n */\n elements: function() {\n let elements;\n let e;\n let c;\n let elem;\n let elemIndex;\n const re = /^[#.](?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/;\n while (true) {\n elemIndex = parserInput.i;\n e = parserInput.$re(re);\n \n if (!e) {\n break;\n }\n elem = new(tree.Element)(c, e, false, elemIndex, fileInfo);\n if (elements) {\n elements.push(elem);\n } else {\n elements = [ elem ];\n }\n c = parserInput.$char('>');\n }\n return elements;\n },\n args: function (isCall) {\n const entities = parsers.entities;\n const returner = { args:null, variadic: false };\n let expressions = [];\n const argsSemiColon = [];\n const argsComma = [];\n let isSemiColonSeparated;\n let expressionContainsNamed;\n let name;\n let nameLoop;\n let value;\n let arg;\n let expand;\n let hasSep = true;\n\n parserInput.save();\n\n while (true) {\n if (isCall) {\n arg = parsers.detachedRuleset() || parsers.expression();\n } else {\n parserInput.commentStore.length = 0;\n if (parserInput.$str('...')) {\n returner.variadic = true;\n if (parserInput.$char(';') && !isSemiColonSeparated) {\n isSemiColonSeparated = true;\n }\n (isSemiColonSeparated ? argsSemiColon : argsComma)\n .push({ variadic: true });\n break;\n }\n arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true);\n }\n\n if (!arg || !hasSep) {\n break;\n }\n\n nameLoop = null;\n if (arg.throwAwayComments) {\n arg.throwAwayComments();\n }\n value = arg;\n let val = null;\n\n if (isCall) {\n // Variable\n if (arg.value && arg.value.length == 1) {\n val = arg.value[0];\n }\n } else {\n val = arg;\n }\n\n if (val && (val instanceof tree.Variable || val instanceof tree.Property)) {\n if (parserInput.$char(':')) {\n if (expressions.length > 0) {\n if (isSemiColonSeparated) {\n error('Cannot mix ; and , as delimiter types');\n }\n expressionContainsNamed = true;\n }\n\n value = parsers.detachedRuleset() || parsers.expression();\n\n if (!value) {\n if (isCall) {\n error('could not understand value for named argument');\n } else {\n parserInput.restore();\n returner.args = [];\n return returner;\n }\n }\n nameLoop = (name = val.name);\n } else if (parserInput.$str('...')) {\n if (!isCall) {\n returner.variadic = true;\n if (parserInput.$char(';') && !isSemiColonSeparated) {\n isSemiColonSeparated = true;\n }\n (isSemiColonSeparated ? argsSemiColon : argsComma)\n .push({ name: arg.name, variadic: true });\n break;\n } else {\n expand = true;\n }\n } else if (!isCall) {\n name = nameLoop = val.name;\n value = null;\n }\n }\n\n if (value) {\n expressions.push(value);\n }\n\n argsComma.push({ name:nameLoop, value, expand });\n\n if (parserInput.$char(',')) {\n hasSep = true;\n continue;\n }\n hasSep = parserInput.$char(';') === ';';\n\n if (hasSep || isSemiColonSeparated) {\n\n if (expressionContainsNamed) {\n error('Cannot mix ; and , as delimiter types');\n }\n\n isSemiColonSeparated = true;\n\n if (expressions.length > 1) {\n value = new(tree.Value)(expressions);\n }\n argsSemiColon.push({ name, value, expand });\n\n name = null;\n expressions = [];\n expressionContainsNamed = false;\n }\n }\n\n parserInput.forget();\n returner.args = isSemiColonSeparated ? argsSemiColon : argsComma;\n return returner;\n },\n //\n // A Mixin definition, with a list of parameters\n //\n // .rounded (@radius: 2px, @color) {\n // ...\n // }\n //\n // Until we have a finer grained state-machine, we have to\n // do a look-ahead, to make sure we don't have a mixin call.\n // See the `rule` function for more information.\n //\n // We start by matching `.rounded (`, and then proceed on to\n // the argument list, which has optional default values.\n // We store the parameters in `params`, with a `value` key,\n // if there is a value, such as in the case of `@radius`.\n //\n // Once we've got our params list, and a closing `)`, we parse\n // the `{...}` block.\n //\n definition: function () {\n let name;\n let params = [];\n let match;\n let ruleset;\n let cond;\n let variadic = false;\n if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') ||\n parserInput.peek(/^[^{]*\\}/)) {\n return;\n }\n\n parserInput.save();\n\n match = parserInput.$re(/^([#.](?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\\s*\\(/);\n if (match) {\n name = match[1];\n\n const argInfo = this.args(false);\n params = argInfo.args;\n variadic = argInfo.variadic;\n\n // .mixincall(\"@{a}\");\n // looks a bit like a mixin definition..\n // also\n // .mixincall(@a: {rule: set;});\n // so we have to be nice and restore\n if (!parserInput.$char(')')) {\n parserInput.restore('Missing closing \\')\\'');\n return;\n }\n\n parserInput.commentStore.length = 0;\n\n if (parserInput.$str('when')) { // Guard\n cond = expect(parsers.conditions, 'expected condition');\n }\n\n ruleset = parsers.block();\n\n if (ruleset) {\n parserInput.forget();\n return new(tree.mixin.Definition)(name, params, ruleset, cond, variadic);\n } else {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n }\n },\n \n ruleLookups: function() {\n let rule;\n let args;\n const lookups = [];\n\n if (parserInput.currentChar() !== '[') { \n return;\n }\n\n while (true) {\n parserInput.save();\n args = null;\n rule = this.lookupValue();\n if (!rule && rule !== '') {\n parserInput.restore();\n break;\n }\n lookups.push(rule);\n parserInput.forget();\n }\n if (lookups.length > 0) {\n return lookups;\n }\n },\n \n lookupValue: function() {\n parserInput.save();\n \n if (!parserInput.$char('[')) { \n parserInput.restore();\n return;\n }\n \n const name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);\n \n if (!parserInput.$char(']')) {\n parserInput.restore();\n return;\n } \n\n if (name || name === '') {\n parserInput.forget();\n return name;\n }\n \n parserInput.restore();\n }\n },\n //\n // Entities are the smallest recognized token,\n // and can be found inside a rule's value.\n //\n entity: function () {\n const entities = this.entities;\n\n return this.comment() || entities.literal() || entities.variable() || entities.url() ||\n entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) ||\n entities.javascript();\n },\n\n //\n // A Declaration terminator. Note that we use `peek()` to check for '}',\n // because the `block` rule will be expecting it, but we still need to make sure\n // it's there, if ';' was omitted.\n //\n end: function () {\n return parserInput.$char(';') || parserInput.peek('}');\n },\n\n //\n // IE's alpha function\n //\n // alpha(opacity=88)\n //\n ieAlpha: function () {\n let value;\n\n // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18\n if (!parserInput.$re(/^opacity=/i)) { return; }\n value = parserInput.$re(/^\\d+/);\n if (!value) {\n value = expect(parsers.entities.variable, 'Could not parse alpha');\n value = `@{${value.name.slice(1)}}`;\n }\n expectChar(')');\n return new tree.Quoted('', `alpha(opacity=${value})`);\n },\n\n //\n // A Selector Element\n //\n // div\n // + h1\n // #socks\n // input[type=\"text\"]\n //\n // Elements are the building blocks for Selectors,\n // they are made out of a `Combinator` (see combinator rule),\n // and an element name, such as a tag a class, or `*`.\n //\n element: function () {\n let e;\n let c;\n let v;\n const index = parserInput.i;\n\n c = this.combinator();\n\n e = parserInput.$re(/^(?:\\d+\\.\\d+|\\d+)%/) ||\n parserInput.$re(/^(?:[.#]?|:*)(?:[\\w-]|[^\\x00-\\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) ||\n parserInput.$char('*') || parserInput.$char('&') || this.attribute() ||\n parserInput.$re(/^\\([^&()@]+\\)/) || parserInput.$re(/^[\\.#:](?=@)/) ||\n this.entities.variableCurly();\n\n if (!e) {\n parserInput.save();\n if (parserInput.$char('(')) {\n if ((v = this.selector(false)) && parserInput.$char(')')) {\n e = new(tree.Paren)(v);\n parserInput.forget();\n } else {\n parserInput.restore('Missing closing \\')\\'');\n }\n } else {\n parserInput.forget();\n }\n }\n\n if (e) { return new(tree.Element)(c, e, e instanceof tree.Variable, index, fileInfo); }\n },\n\n //\n // Combinators combine elements together, in a Selector.\n //\n // Because our parser isn't white-space sensitive, special care\n // has to be taken, when parsing the descendant combinator, ` `,\n // as it's an empty space. We have to check the previous character\n // in the input, to see if it's a ` ` character. More info on how\n // we deal with this in *combinator.js*.\n //\n combinator: function () {\n let c = parserInput.currentChar();\n\n if (c === '/') {\n parserInput.save();\n const slashedCombinator = parserInput.$re(/^\\/[a-z]+\\//i);\n if (slashedCombinator) {\n parserInput.forget();\n return new(tree.Combinator)(slashedCombinator);\n }\n parserInput.restore();\n }\n\n if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') {\n parserInput.i++;\n if (c === '^' && parserInput.currentChar() === '^') {\n c = '^^';\n parserInput.i++;\n }\n while (parserInput.isWhitespace()) { parserInput.i++; }\n return new(tree.Combinator)(c);\n } else if (parserInput.isWhitespace(-1)) {\n return new(tree.Combinator)(' ');\n } else {\n return new(tree.Combinator)(null);\n }\n },\n //\n // A CSS Selector\n // with less extensions e.g. the ability to extend and guard\n //\n // .class > div + h1\n // li a:hover\n //\n // Selectors are made out of one or more Elements, see above.\n //\n selector: function (isLess) {\n const index = parserInput.i;\n let elements;\n let extendList;\n let c;\n let e;\n let allExtends;\n let when;\n let condition;\n isLess = isLess !== false;\n while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) {\n if (when) {\n condition = expect(this.conditions, 'expected condition');\n } else if (condition) {\n error('CSS guard can only be used at the end of selector');\n } else if (extendList) {\n if (allExtends) {\n allExtends = allExtends.concat(extendList);\n } else {\n allExtends = extendList;\n }\n } else {\n if (allExtends) { error('Extend can only be used at the end of selector'); }\n c = parserInput.currentChar();\n if (elements) {\n elements.push(e);\n } else {\n elements = [ e ];\n }\n e = null;\n }\n if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') {\n break;\n }\n }\n\n if (elements) { return new(tree.Selector)(elements, allExtends, condition, index, fileInfo); }\n if (allExtends) { error('Extend must be used to extend a selector, it cannot be used on its own'); }\n },\n selectors: function () {\n let s;\n let selectors;\n while (true) {\n s = this.selector();\n if (!s) {\n break;\n }\n if (selectors) {\n selectors.push(s);\n } else {\n selectors = [ s ];\n }\n parserInput.commentStore.length = 0;\n if (s.condition && selectors.length > 1) {\n error(\"Guards are only currently allowed on a single selector.\");\n }\n if (!parserInput.$char(',')) { break; }\n if (s.condition) {\n error(\"Guards are only currently allowed on a single selector.\");\n }\n parserInput.commentStore.length = 0;\n }\n return selectors;\n },\n attribute: function () {\n if (!parserInput.$char('[')) { return; }\n\n const entities = this.entities;\n let key;\n let val;\n let op;\n\n if (!(key = entities.variableCurly())) {\n key = expect(/^(?:[_A-Za-z0-9-\\*]*\\|)?(?:[_A-Za-z0-9-]|\\\\.)+/);\n }\n\n op = parserInput.$re(/^[|~*$^]?=/);\n if (op) {\n val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\\w-]+/) || entities.variableCurly();\n }\n\n expectChar(']');\n\n return new(tree.Attribute)(key, op, val);\n },\n\n //\n // The `block` rule is used by `ruleset` and `mixin.definition`.\n // It's a wrapper around the `primary` rule, with added `{}`.\n //\n block: function () {\n let content;\n if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) {\n return content;\n }\n },\n\n blockRuleset: function() {\n let block = this.block();\n\n if (block) {\n block = new tree.Ruleset(null, block);\n }\n return block;\n },\n\n detachedRuleset: function() {\n let argInfo;\n let params;\n let variadic;\n\n parserInput.save();\n if (parserInput.$re(/^[.#]\\(/)) {\n /**\n * DR args currently only implemented for each() function, and not \n * yet settable as `@dr: #(@arg) {}`\n * This should be done when DRs are merged with mixins.\n * See: https://github.com/less/less-meta/issues/16\n */\n argInfo = this.mixin.args(false);\n params = argInfo.args;\n variadic = argInfo.variadic;\n if (!parserInput.$char(')')) {\n parserInput.restore();\n return;\n }\n }\n const blockRuleset = this.blockRuleset();\n if (blockRuleset) {\n parserInput.forget();\n if (params) {\n return new tree.mixin.Definition(null, params, blockRuleset, null, variadic);\n }\n return new tree.DetachedRuleset(blockRuleset);\n }\n parserInput.restore();\n },\n\n //\n // div, .class, body > p {...}\n //\n ruleset: function () {\n let selectors;\n let rules;\n let debugInfo;\n\n parserInput.save();\n\n if (context.dumpLineNumbers) {\n debugInfo = getDebugInfo(parserInput.i);\n }\n\n selectors = this.selectors();\n\n if (selectors && (rules = this.block())) {\n parserInput.forget();\n const ruleset = new(tree.Ruleset)(selectors, rules, context.strictImports);\n if (context.dumpLineNumbers) {\n ruleset.debugInfo = debugInfo;\n }\n return ruleset;\n } else {\n parserInput.restore();\n }\n },\n declaration: function () {\n let name;\n let value;\n const index = parserInput.i;\n let hasDR;\n const c = parserInput.currentChar();\n let important;\n let merge;\n let isVariable;\n\n if (c === '.' || c === '#' || c === '&' || c === ':') { return; }\n\n parserInput.save();\n\n name = this.variable() || this.ruleProperty();\n if (name) {\n isVariable = typeof name === 'string';\n\n if (isVariable) {\n value = this.detachedRuleset();\n if (value) {\n hasDR = true;\n }\n }\n\n parserInput.commentStore.length = 0;\n if (!value) {\n // a name returned by this.ruleProperty() is always an array of the form:\n // [string-1, ..., string-n, \"\"] or [string-1, ..., string-n, \"+\"]\n // where each item is a tree.Keyword or tree.Variable\n merge = !isVariable && name.length > 1 && name.pop().value;\n\n // Custom property values get permissive parsing\n if (name[0].value && name[0].value.slice(0, 2) === '--') {\n value = this.permissiveValue();\n }\n // Try to store values as anonymous\n // If we need the value later we'll re-parse it in ruleset.parseValue\n else {\n value = this.anonymousValue();\n }\n if (value) {\n parserInput.forget();\n // anonymous values absorb the end ';' which is required for them to work\n return new(tree.Declaration)(name, value, false, merge, index, fileInfo);\n }\n\n if (!value) {\n value = this.value();\n }\n\n if (value) {\n important = this.important();\n } else if (isVariable) {\n // As a last resort, try permissiveValue\n value = this.permissiveValue();\n }\n }\n\n if (value && (this.end() || hasDR)) {\n parserInput.forget();\n return new(tree.Declaration)(name, value, important, merge, index, fileInfo);\n }\n else {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n }\n },\n anonymousValue: function () {\n const index = parserInput.i;\n const match = parserInput.$re(/^([^.#@\\$+\\/'\"*`(;{}-]*);/);\n if (match) {\n return new(tree.Anonymous)(match[1], index);\n }\n },\n /**\n * Used for custom properties, at-rules, and variables (as fallback)\n * Parses almost anything inside of {} [] () \"\" blocks\n * until it reaches outer-most tokens.\n * \n * First, it will try to parse comments and entities to reach\n * the end. This is mostly like the Expression parser except no\n * math is allowed.\n */\n permissiveValue: function (untilTokens) {\n let i;\n let e;\n let done;\n let value;\n const tok = untilTokens || ';';\n const index = parserInput.i;\n const result = [];\n\n function testCurrentChar() {\n const char = parserInput.currentChar();\n if (typeof tok === 'string') {\n return char === tok;\n } else {\n return tok.test(char);\n }\n }\n if (testCurrentChar()) {\n return;\n }\n value = [];\n do {\n e = this.comment();\n if (e) {\n value.push(e);\n continue;\n }\n e = this.entity();\n if (e) {\n value.push(e);\n }\n } while (e);\n\n done = testCurrentChar();\n\n if (value.length > 0) {\n value = new(tree.Expression)(value);\n if (done) {\n return value;\n }\n else {\n result.push(value);\n }\n // Preserve space before $parseUntil as it will not\n if (parserInput.prevChar() === ' ') {\n result.push(new tree.Anonymous(' ', index));\n }\n }\n parserInput.save();\n\n value = parserInput.$parseUntil(tok);\n\n if (value) {\n if (typeof value === 'string') {\n error(`Expected '${value}'`, 'Parse');\n }\n if (value.length === 1 && value[0] === ' ') {\n parserInput.forget();\n return new tree.Anonymous('', index);\n }\n let item;\n for (i = 0; i < value.length; i++) {\n item = value[i];\n if (Array.isArray(item)) {\n // Treat actual quotes as normal quoted values\n result.push(new tree.Quoted(item[0], item[1], true, index, fileInfo));\n }\n else {\n if (i === value.length - 1) {\n item = item.trim();\n }\n // Treat like quoted values, but replace vars like unquoted expressions\n const quote = new tree.Quoted('\\'', item, true, index, fileInfo);\n quote.variableRegex = /@([\\w-]+)/g;\n quote.propRegex = /\\$([\\w-]+)/g;\n result.push(quote);\n }\n }\n parserInput.forget();\n return new tree.Expression(result, true);\n }\n parserInput.restore();\n },\n\n //\n // An @import atrule\n //\n // @import \"lib\";\n //\n // Depending on our environment, importing is done differently:\n // In the browser, it's an XHR request, in Node, it would be a\n // file-system operation. The function used for importing is\n // stored in `import`, which we pass to the Import constructor.\n //\n 'import': function () {\n let path;\n let features;\n const index = parserInput.i;\n\n const dir = parserInput.$re(/^@import?\\s+/);\n\n if (dir) {\n const options = (dir ? this.importOptions() : null) || {};\n\n if ((path = this.entities.quoted() || this.entities.url())) {\n features = this.mediaFeatures();\n\n if (!parserInput.$char(';')) {\n parserInput.i = index;\n error('missing semi-colon or unrecognised media features on import');\n }\n features = features && new(tree.Value)(features);\n return new(tree.Import)(path, features, options, index, fileInfo);\n }\n else {\n parserInput.i = index;\n error('malformed import statement');\n }\n }\n },\n\n importOptions: function() {\n let o;\n const options = {};\n let optionName;\n let value;\n\n // list of options, surrounded by parens\n if (!parserInput.$char('(')) { return null; }\n do {\n o = this.importOption();\n if (o) {\n optionName = o;\n value = true;\n switch (optionName) {\n case 'css':\n optionName = 'less';\n value = false;\n break;\n case 'once':\n optionName = 'multiple';\n value = false;\n break;\n }\n options[optionName] = value;\n if (!parserInput.$char(',')) { break; }\n }\n } while (o);\n expectChar(')');\n return options;\n },\n\n importOption: function() {\n const opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/);\n if (opt) {\n return opt[1];\n }\n },\n\n mediaFeature: function () {\n const entities = this.entities;\n const nodes = [];\n let e;\n let p;\n parserInput.save();\n do {\n e = entities.keyword() || entities.variable() || entities.mixinLookup();\n if (e) {\n nodes.push(e);\n } else if (parserInput.$char('(')) {\n p = this.property();\n e = this.value();\n if (parserInput.$char(')')) {\n if (p && e) {\n nodes.push(new(tree.Paren)(new(tree.Declaration)(p, e, null, null, parserInput.i, fileInfo, true)));\n } else if (e) {\n nodes.push(new(tree.Paren)(e));\n } else {\n error('badly formed media feature definition');\n }\n } else {\n error('Missing closing \\')\\'', 'Parse');\n }\n }\n } while (e);\n\n parserInput.forget();\n if (nodes.length > 0) {\n return new(tree.Expression)(nodes);\n }\n },\n\n mediaFeatures: function () {\n const entities = this.entities;\n const features = [];\n let e;\n do {\n e = this.mediaFeature();\n if (e) {\n features.push(e);\n if (!parserInput.$char(',')) { break; }\n } else {\n e = entities.variable() || entities.mixinLookup();\n if (e) {\n features.push(e);\n if (!parserInput.$char(',')) { break; }\n }\n }\n } while (e);\n\n return features.length > 0 ? features : null;\n },\n\n media: function () {\n let features;\n let rules;\n let media;\n let debugInfo;\n const index = parserInput.i;\n\n if (context.dumpLineNumbers) {\n debugInfo = getDebugInfo(index);\n }\n\n parserInput.save();\n\n if (parserInput.$str('@media')) {\n features = this.mediaFeatures();\n\n rules = this.block();\n\n if (!rules) {\n error('media definitions require block statements after any features');\n }\n\n parserInput.forget();\n\n media = new(tree.Media)(rules, features, index, fileInfo);\n if (context.dumpLineNumbers) {\n media.debugInfo = debugInfo;\n }\n\n return media;\n }\n\n parserInput.restore();\n },\n\n //\n\n // A @plugin directive, used to import plugins dynamically.\n //\n // @plugin (args) \"lib\";\n //\n plugin: function () {\n let path;\n let args;\n let options;\n const index = parserInput.i;\n const dir = parserInput.$re(/^@plugin?\\s+/);\n\n if (dir) {\n args = this.pluginArgs();\n\n if (args) {\n options = {\n pluginArgs: args,\n isPlugin: true\n };\n }\n else {\n options = { isPlugin: true };\n }\n\n if ((path = this.entities.quoted() || this.entities.url())) {\n\n if (!parserInput.$char(';')) {\n parserInput.i = index;\n error('missing semi-colon on @plugin');\n }\n return new(tree.Import)(path, null, options, index, fileInfo);\n }\n else {\n parserInput.i = index;\n error('malformed @plugin statement');\n }\n }\n },\n\n pluginArgs: function() {\n // list of options, surrounded by parens\n parserInput.save();\n if (!parserInput.$char('(')) {\n parserInput.restore();\n return null;\n }\n const args = parserInput.$re(/^\\s*([^\\);]+)\\)\\s*/);\n if (args[1]) {\n parserInput.forget();\n return args[1].trim();\n }\n else { \n parserInput.restore();\n return null;\n }\n },\n\n //\n // A CSS AtRule\n //\n // @charset \"utf-8\";\n //\n atrule: function () {\n const index = parserInput.i;\n let name;\n let value;\n let rules;\n let nonVendorSpecificName;\n let hasIdentifier;\n let hasExpression;\n let hasUnknown;\n let hasBlock = true;\n let isRooted = true;\n\n if (parserInput.currentChar() !== '@') { return; }\n\n value = this['import']() || this.plugin() || this.media();\n if (value) {\n return value;\n }\n\n parserInput.save();\n\n name = parserInput.$re(/^@[a-z-]+/);\n\n if (!name) { return; }\n\n nonVendorSpecificName = name;\n if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) {\n nonVendorSpecificName = `@${name.slice(name.indexOf('-', 2) + 1)}`;\n }\n\n switch (nonVendorSpecificName) {\n case '@charset':\n hasIdentifier = true;\n hasBlock = false;\n break;\n case '@namespace':\n hasExpression = true;\n hasBlock = false;\n break;\n case '@keyframes':\n case '@counter-style':\n hasIdentifier = true;\n break;\n case '@document':\n case '@supports':\n hasUnknown = true;\n isRooted = false;\n break;\n default:\n hasUnknown = true;\n break;\n }\n\n parserInput.commentStore.length = 0;\n\n if (hasIdentifier) {\n value = this.entity();\n if (!value) {\n error(`expected ${name} identifier`);\n }\n } else if (hasExpression) {\n value = this.expression();\n if (!value) {\n error(`expected ${name} expression`);\n }\n } else if (hasUnknown) {\n value = this.permissiveValue(/^[{;]/);\n hasBlock = (parserInput.currentChar() === '{');\n if (!value) {\n if (!hasBlock && parserInput.currentChar() !== ';') {\n error(`${name} rule is missing block or ending semi-colon`);\n }\n }\n else if (!value.value) {\n value = null;\n }\n }\n\n if (hasBlock) {\n rules = this.blockRuleset();\n }\n\n if (rules || (!hasBlock && value && parserInput.$char(';'))) {\n parserInput.forget();\n return new(tree.AtRule)(name, value, rules, index, fileInfo,\n context.dumpLineNumbers ? getDebugInfo(index) : null,\n isRooted\n );\n }\n\n parserInput.restore('at-rule options not recognised');\n },\n\n //\n // A Value is a comma-delimited list of Expressions\n //\n // font-family: Baskerville, Georgia, serif;\n //\n // In a Rule, a Value represents everything after the `:`,\n // and before the `;`.\n //\n value: function () {\n let e;\n const expressions = [];\n const index = parserInput.i;\n\n do {\n e = this.expression();\n if (e) {\n expressions.push(e);\n if (!parserInput.$char(',')) { break; }\n }\n } while (e);\n\n if (expressions.length > 0) {\n return new(tree.Value)(expressions, index);\n }\n },\n important: function () {\n if (parserInput.currentChar() === '!') {\n return parserInput.$re(/^! *important/);\n }\n },\n sub: function () {\n let a;\n let e;\n\n parserInput.save();\n if (parserInput.$char('(')) {\n a = this.addition();\n if (a && parserInput.$char(')')) {\n parserInput.forget();\n e = new(tree.Expression)([a]);\n e.parens = true;\n return e;\n }\n parserInput.restore('Expected \\')\\'');\n return;\n }\n parserInput.restore();\n },\n multiplication: function () {\n let m;\n let a;\n let op;\n let operation;\n let isSpaced;\n m = this.operand();\n if (m) {\n isSpaced = parserInput.isWhitespace(-1);\n while (true) {\n if (parserInput.peek(/^\\/[*\\/]/)) {\n break;\n }\n\n parserInput.save();\n\n op = parserInput.$char('/') || parserInput.$char('*') || parserInput.$str('./');\n\n if (!op) { parserInput.forget(); break; }\n\n a = this.operand();\n\n if (!a) { parserInput.restore(); break; }\n parserInput.forget();\n\n m.parensInOp = true;\n a.parensInOp = true;\n operation = new(tree.Operation)(op, [operation || m, a], isSpaced);\n isSpaced = parserInput.isWhitespace(-1);\n }\n return operation || m;\n }\n },\n addition: function () {\n let m;\n let a;\n let op;\n let operation;\n let isSpaced;\n m = this.multiplication();\n if (m) {\n isSpaced = parserInput.isWhitespace(-1);\n while (true) {\n op = parserInput.$re(/^[-+]\\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-')));\n if (!op) {\n break;\n }\n a = this.multiplication();\n if (!a) {\n break;\n }\n\n m.parensInOp = true;\n a.parensInOp = true;\n operation = new(tree.Operation)(op, [operation || m, a], isSpaced);\n isSpaced = parserInput.isWhitespace(-1);\n }\n return operation || m;\n }\n },\n conditions: function () {\n let a;\n let b;\n const index = parserInput.i;\n let condition;\n\n a = this.condition(true);\n if (a) {\n while (true) {\n if (!parserInput.peek(/^,\\s*(not\\s*)?\\(/) || !parserInput.$char(',')) {\n break;\n }\n b = this.condition(true);\n if (!b) {\n break;\n }\n condition = new(tree.Condition)('or', condition || a, b, index);\n }\n return condition || a;\n }\n },\n condition: function (needsParens) {\n let result;\n let logical;\n let next;\n function or() {\n return parserInput.$str('or');\n }\n\n result = this.conditionAnd(needsParens);\n if (!result) {\n return ;\n }\n logical = or();\n if (logical) {\n next = this.condition(needsParens);\n if (next) {\n result = new(tree.Condition)(logical, result, next);\n } else {\n return ;\n }\n }\n return result;\n },\n conditionAnd: function (needsParens) {\n let result;\n let logical;\n let next;\n const self = this;\n function insideCondition() {\n const cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens);\n if (!cond && !needsParens) {\n return self.atomicCondition(needsParens);\n }\n return cond;\n }\n function and() {\n return parserInput.$str('and');\n }\n\n result = insideCondition();\n if (!result) {\n return ;\n }\n logical = and();\n if (logical) {\n next = this.conditionAnd(needsParens);\n if (next) {\n result = new(tree.Condition)(logical, result, next);\n } else {\n return ;\n }\n }\n return result;\n },\n negatedCondition: function (needsParens) {\n if (parserInput.$str('not')) {\n const result = this.parenthesisCondition(needsParens);\n if (result) {\n result.negate = !result.negate;\n }\n return result;\n }\n },\n parenthesisCondition: function (needsParens) {\n function tryConditionFollowedByParenthesis(me) {\n let body;\n parserInput.save();\n body = me.condition(needsParens);\n if (!body) {\n parserInput.restore();\n return ;\n }\n if (!parserInput.$char(')')) {\n parserInput.restore();\n return ;\n }\n parserInput.forget();\n return body;\n }\n\n let body;\n parserInput.save();\n if (!parserInput.$str('(')) {\n parserInput.restore();\n return ;\n }\n body = tryConditionFollowedByParenthesis(this);\n if (body) {\n parserInput.forget();\n return body;\n }\n\n body = this.atomicCondition(needsParens);\n if (!body) {\n parserInput.restore();\n return ;\n }\n if (!parserInput.$char(')')) {\n parserInput.restore(`expected ')' got '${parserInput.currentChar()}'`);\n return ;\n }\n parserInput.forget();\n return body;\n },\n atomicCondition: function (needsParens) {\n const entities = this.entities;\n const index = parserInput.i;\n let a;\n let b;\n let c;\n let op;\n\n function cond() {\n return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup();\n }\n cond = cond.bind(this);\n\n a = cond();\n if (a) {\n if (parserInput.$char('>')) {\n if (parserInput.$char('=')) {\n op = '>=';\n } else {\n op = '>';\n }\n } else\n if (parserInput.$char('<')) {\n if (parserInput.$char('=')) {\n op = '<=';\n } else {\n op = '<';\n }\n } else\n if (parserInput.$char('=')) {\n if (parserInput.$char('>')) {\n op = '=>';\n } else if (parserInput.$char('<')) {\n op = '=<';\n } else {\n op = '=';\n }\n }\n if (op) {\n b = cond();\n if (b) {\n c = new(tree.Condition)(op, a, b, index, false);\n } else {\n error('expected expression');\n }\n } else {\n c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index, false);\n }\n return c;\n }\n },\n\n //\n // An operand is anything that can be part of an operation,\n // such as a Color, or a Variable\n //\n operand: function () {\n const entities = this.entities;\n let negate;\n\n if (parserInput.peek(/^-[@\\$\\(]/)) {\n negate = parserInput.$char('-');\n }\n\n let o = this.sub() || entities.dimension() ||\n entities.color() || entities.variable() ||\n entities.property() || entities.call() ||\n entities.quoted(true) || entities.colorKeyword() ||\n entities.mixinLookup();\n\n if (negate) {\n o.parensInOp = true;\n o = new(tree.Negative)(o);\n }\n\n return o;\n },\n\n //\n // Expressions either represent mathematical operations,\n // or white-space delimited Entities.\n //\n // 1px solid black\n // @var * 2\n //\n expression: function () {\n const entities = [];\n let e;\n let delim;\n const index = parserInput.i;\n\n do {\n e = this.comment();\n if (e) {\n entities.push(e);\n continue;\n }\n e = this.addition() || this.entity();\n\n if (e instanceof tree.Comment) {\n e = null;\n }\n\n if (e) {\n entities.push(e);\n // operations do not allow keyword \"/\" dimension (e.g. small/20px) so we support that here\n if (!parserInput.peek(/^\\/[\\/*]/)) {\n delim = parserInput.$char('/');\n if (delim) {\n entities.push(new(tree.Anonymous)(delim, index));\n }\n }\n }\n } while (e);\n if (entities.length > 0) {\n return new(tree.Expression)(entities);\n }\n },\n property: function () {\n const name = parserInput.$re(/^(\\*?-?[_a-zA-Z0-9-]+)\\s*:/);\n if (name) {\n return name[1];\n }\n },\n ruleProperty: function () {\n let name = [];\n const index = [];\n let s;\n let k;\n\n parserInput.save();\n\n const simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\\s*:/);\n if (simpleProperty) {\n name = [new(tree.Keyword)(simpleProperty[1])];\n parserInput.forget();\n return name;\n }\n\n function match(re) {\n const i = parserInput.i;\n const chunk = parserInput.$re(re);\n if (chunk) {\n index.push(i);\n return name.push(chunk[1]);\n }\n }\n\n match(/^(\\*?)/);\n while (true) {\n if (!match(/^((?:[\\w-]+)|(?:[@\\$]\\{[\\w-]+\\}))/)) {\n break;\n }\n }\n\n if ((name.length > 1) && match(/^((?:\\+_|\\+)?)\\s*:/)) {\n parserInput.forget();\n\n // at last, we have the complete match now. move forward,\n // convert name particles to tree objects and return:\n if (name[0] === '') {\n name.shift();\n index.shift();\n }\n for (k = 0; k < name.length; k++) {\n s = name[k];\n name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ?\n new(tree.Keyword)(s) :\n (s.charAt(0) === '@' ?\n new(tree.Variable)(`@${s.slice(2, -1)}`, index[k], fileInfo) :\n new(tree.Property)(`$${s.slice(2, -1)}`, index[k], fileInfo));\n }\n return name;\n }\n parserInput.restore();\n }\n }\n };\n};\nParser.serializeVars = vars => {\n let s = '';\n\n for (const name in vars) {\n if (Object.hasOwnProperty.call(vars, name)) {\n const value = vars[name];\n s += `${((name[0] === '@') ? '' : '@') + name}: ${value}${(String(value).slice(-1) === ';') ? '' : ';'}`;\n }\n }\n\n return s;\n};\n\nexport default Parser;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/plugin-manager.js b/packages/less/lib/less/plugin-manager.js deleted file mode 100644 index ab12c42c3..000000000 --- a/packages/less/lib/less/plugin-manager.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Plugin Manager - */ -var PluginManager = /** @class */ (function () { - function PluginManager(less) { - this.less = less; - this.visitors = []; - this.preProcessors = []; - this.postProcessors = []; - this.installedPlugins = []; - this.fileManagers = []; - this.iterator = -1; - this.pluginCache = {}; - this.Loader = new less.PluginLoader(less); - } - /** - * Adds all the plugins in the array - * @param {Array} plugins - */ - PluginManager.prototype.addPlugins = function (plugins) { - if (plugins) { - for (var i = 0; i < plugins.length; i++) { - this.addPlugin(plugins[i]); - } - } - }; - /** - * - * @param plugin - * @param {String} filename - */ - PluginManager.prototype.addPlugin = function (plugin, filename, functionRegistry) { - this.installedPlugins.push(plugin); - if (filename) { - this.pluginCache[filename] = plugin; - } - if (plugin.install) { - plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry); - } - }; - /** - * - * @param filename - */ - PluginManager.prototype.get = function (filename) { - return this.pluginCache[filename]; - }; - /** - * Adds a visitor. The visitor object has options on itself to determine - * when it should run. - * @param visitor - */ - PluginManager.prototype.addVisitor = function (visitor) { - this.visitors.push(visitor); - }; - /** - * Adds a pre processor object - * @param {object} preProcessor - * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import - */ - PluginManager.prototype.addPreProcessor = function (preProcessor, priority) { - var indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) { - if (this.preProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.preProcessors.splice(indexToInsertAt, 0, { preProcessor: preProcessor, priority: priority }); - }; - /** - * Adds a post processor object - * @param {object} postProcessor - * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression - */ - PluginManager.prototype.addPostProcessor = function (postProcessor, priority) { - var indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) { - if (this.postProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.postProcessors.splice(indexToInsertAt, 0, { postProcessor: postProcessor, priority: priority }); - }; - /** - * - * @param manager - */ - PluginManager.prototype.addFileManager = function (manager) { - this.fileManagers.push(manager); - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getPreProcessors = function () { - var preProcessors = []; - for (var i = 0; i < this.preProcessors.length; i++) { - preProcessors.push(this.preProcessors[i].preProcessor); - } - return preProcessors; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getPostProcessors = function () { - var postProcessors = []; - for (var i = 0; i < this.postProcessors.length; i++) { - postProcessors.push(this.postProcessors[i].postProcessor); - } - return postProcessors; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getVisitors = function () { - return this.visitors; - }; - PluginManager.prototype.visitor = function () { - var self = this; - return { - first: function () { - self.iterator = -1; - return self.visitors[self.iterator]; - }, - get: function () { - self.iterator += 1; - return self.visitors[self.iterator]; - } - }; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getFileManagers = function () { - return this.fileManagers; - }; - return PluginManager; -}()); -var pm; -function PluginManagerFactory(less, newFactory) { - if (newFactory || !pm) { - pm = new PluginManager(less); - } - return pm; -} -; -// -exports.default = PluginManagerFactory; -//# sourceMappingURL=plugin-manager.js.map \ No newline at end of file diff --git a/packages/less/lib/less/plugin-manager.js.map b/packages/less/lib/less/plugin-manager.js.map deleted file mode 100644 index 038903458..000000000 --- a/packages/less/lib/less/plugin-manager.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"plugin-manager.js","sourceRoot":"","sources":["../../src/less/plugin-manager.js"],"names":[],"mappings":";;AAAA;;GAEG;AACH;IACI,uBAAY,IAAI;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,kCAAU,GAAV,UAAW,OAAO;QACd,IAAI,OAAO,EAAE;YACT,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,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CAAC,CAAC,CAAC;gBACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxC,CAAC;YACD,GAAG,EAAE;gBACD,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;gBACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxC,CAAC;SACJ,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,uCAAe,GAAf;QACI,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACL,oBAAC;AAAD,CAAC,AAxJD,IAwJC;AAED,IAAI,EAAE,CAAC;AAEP,SAAS,oBAAoB,CAAC,IAAI,EAAE,UAAU;IAC1C,IAAI,UAAU,IAAI,CAAC,EAAE,EAAE;QACnB,EAAE,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;KAChC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAAA,CAAC;AAEF,EAAE;AACF,kBAAe,oBAAoB,CAAC","sourcesContent":["/**\n * Plugin Manager\n */\nclass PluginManager {\n constructor(less) {\n this.less = less;\n this.visitors = [];\n this.preProcessors = [];\n this.postProcessors = [];\n this.installedPlugins = [];\n this.fileManagers = [];\n this.iterator = -1;\n this.pluginCache = {};\n this.Loader = new less.PluginLoader(less);\n }\n\n /**\n * Adds all the plugins in the array\n * @param {Array} plugins\n */\n addPlugins(plugins) {\n if (plugins) {\n for (let i = 0; i < plugins.length; i++) {\n this.addPlugin(plugins[i]);\n }\n }\n }\n\n /**\n *\n * @param plugin\n * @param {String} filename\n */\n addPlugin(plugin, filename, functionRegistry) {\n this.installedPlugins.push(plugin);\n if (filename) {\n this.pluginCache[filename] = plugin;\n }\n if (plugin.install) {\n plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry);\n }\n }\n\n /**\n *\n * @param filename\n */\n get(filename) {\n return this.pluginCache[filename];\n }\n\n /**\n * Adds a visitor. The visitor object has options on itself to determine\n * when it should run.\n * @param visitor\n */\n addVisitor(visitor) {\n this.visitors.push(visitor);\n }\n\n /**\n * Adds a pre processor object\n * @param {object} preProcessor\n * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import\n */\n addPreProcessor(preProcessor, priority) {\n let indexToInsertAt;\n for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) {\n if (this.preProcessors[indexToInsertAt].priority >= priority) {\n break;\n }\n }\n this.preProcessors.splice(indexToInsertAt, 0, {preProcessor, priority});\n }\n\n /**\n * Adds a post processor object\n * @param {object} postProcessor\n * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression\n */\n addPostProcessor(postProcessor, priority) {\n let indexToInsertAt;\n for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) {\n if (this.postProcessors[indexToInsertAt].priority >= priority) {\n break;\n }\n }\n this.postProcessors.splice(indexToInsertAt, 0, {postProcessor, priority});\n }\n\n /**\n *\n * @param manager\n */\n addFileManager(manager) {\n this.fileManagers.push(manager);\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getPreProcessors() {\n const preProcessors = [];\n for (let i = 0; i < this.preProcessors.length; i++) {\n preProcessors.push(this.preProcessors[i].preProcessor);\n }\n return preProcessors;\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getPostProcessors() {\n const postProcessors = [];\n for (let i = 0; i < this.postProcessors.length; i++) {\n postProcessors.push(this.postProcessors[i].postProcessor);\n }\n return postProcessors;\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getVisitors() {\n return this.visitors;\n }\n\n visitor() {\n const self = this;\n return {\n first: function() {\n self.iterator = -1;\n return self.visitors[self.iterator];\n },\n get: function() {\n self.iterator += 1;\n return self.visitors[self.iterator];\n }\n };\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getFileManagers() {\n return this.fileManagers;\n }\n}\n\nlet pm;\n\nfunction PluginManagerFactory(less, newFactory) {\n if (newFactory || !pm) {\n pm = new PluginManager(less);\n }\n return pm;\n};\n\n//\nexport default PluginManagerFactory;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/render.js b/packages/less/lib/less/render.js deleted file mode 100644 index dcb6e155f..000000000 --- a/packages/less/lib/less/render.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var PromiseConstructor; -var utils = __importStar(require("./utils")); -exports.default = (function (environment, ParseTree, ImportManager) { - var render = function (input, options, callback) { - if (typeof options === 'function') { - callback = options; - options = utils.copyOptions(this.options, {}); - } - else { - options = utils.copyOptions(this.options, options || {}); - } - if (!callback) { - var self_1 = this; - return new Promise(function (resolve, reject) { - render.call(self_1, input, options, function (err, output) { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - else { - this.parse(input, options, function (err, root, imports, options) { - if (err) { - return callback(err); - } - var result; - try { - var parseTree = new ParseTree(root, imports); - result = parseTree.toCSS(options); - } - catch (err) { - return callback(err); - } - callback(null, result); - }); - } - }; - return render; -}); -//# sourceMappingURL=render.js.map \ No newline at end of file diff --git a/packages/less/lib/less/render.js.map b/packages/less/lib/less/render.js.map deleted file mode 100644 index ce9f41bfb..000000000 --- a/packages/less/lib/less/render.js.map +++ /dev/null @@ -1 +0,0 @@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AAO,CAAC,CAAC;iBACrC;gBACD,OAAO,GAAG,EAAE;oBAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;iBAAE;gBAErC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC,EAAC","sourcesContent":["let PromiseConstructor;\nimport * as utils from './utils';\n\nexport default (environment, ParseTree, ImportManager) => {\n const render = function (input, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = utils.copyOptions(this.options, {});\n }\n else {\n options = utils.copyOptions(this.options, options || {});\n }\n\n if (!callback) {\n const self = this;\n return new Promise((resolve, reject) => {\n render.call(self, input, options, (err, output) => {\n if (err) {\n reject(err);\n } else {\n resolve(output);\n }\n });\n });\n } else {\n this.parse(input, options, (err, root, imports, options) => {\n if (err) { return callback(err); }\n\n let result;\n try {\n const parseTree = new ParseTree(root, imports);\n result = parseTree.toCSS(options);\n }\n catch (err) { return callback(err); }\n\n callback(null, result);\n });\n }\n };\n\n return render;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/source-map-builder.js b/packages/less/lib/less/source-map-builder.js deleted file mode 100644 index 9d1f5baba..000000000 --- a/packages/less/lib/less/source-map-builder.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = (function (SourceMapOutput, environment) { - var SourceMapBuilder = /** @class */ (function () { - function SourceMapBuilder(options) { - this.options = options; - } - SourceMapBuilder.prototype.toCSS = function (rootNode, options, imports) { - var sourceMapOutput = new SourceMapOutput({ - contentsIgnoredCharsMap: imports.contentsIgnoredChars, - rootNode: rootNode, - contentsMap: imports.contents, - sourceMapFilename: this.options.sourceMapFilename, - sourceMapURL: this.options.sourceMapURL, - outputFilename: this.options.sourceMapOutputFilename, - sourceMapBasepath: this.options.sourceMapBasepath, - sourceMapRootpath: this.options.sourceMapRootpath, - outputSourceFiles: this.options.outputSourceFiles, - sourceMapGenerator: this.options.sourceMapGenerator, - sourceMapFileInline: this.options.sourceMapFileInline, - disableSourcemapAnnotation: this.options.disableSourcemapAnnotation - }); - var css = sourceMapOutput.toCSS(options); - this.sourceMap = sourceMapOutput.sourceMap; - this.sourceMapURL = sourceMapOutput.sourceMapURL; - if (this.options.sourceMapInputFilename) { - this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename); - } - if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) { - this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL); - } - return css + this.getCSSAppendage(); - }; - SourceMapBuilder.prototype.getCSSAppendage = function () { - var sourceMapURL = this.sourceMapURL; - if (this.options.sourceMapFileInline) { - if (this.sourceMap === undefined) { - return ''; - } - sourceMapURL = "data:application/json;base64," + environment.encodeBase64(this.sourceMap); - } - if (this.options.disableSourcemapAnnotation) { - return ''; - } - if (sourceMapURL) { - return "/*# sourceMappingURL=" + sourceMapURL + " */"; - } - return ''; - }; - SourceMapBuilder.prototype.getExternalSourceMap = function () { - return this.sourceMap; - }; - SourceMapBuilder.prototype.setExternalSourceMap = function (sourceMap) { - this.sourceMap = sourceMap; - }; - SourceMapBuilder.prototype.isInline = function () { - return this.options.sourceMapFileInline; - }; - SourceMapBuilder.prototype.getSourceMapURL = function () { - return this.sourceMapURL; - }; - SourceMapBuilder.prototype.getOutputFilename = function () { - return this.options.sourceMapOutputFilename; - }; - SourceMapBuilder.prototype.getInputFilename = function () { - return this.sourceMapInputFilename; - }; - return SourceMapBuilder; - }()); - return SourceMapBuilder; -}); -//# sourceMappingURL=source-map-builder.js.map \ No newline at end of file diff --git a/packages/less/lib/less/source-map-builder.js.map b/packages/less/lib/less/source-map-builder.js.map deleted file mode 100644 index 3046a8439..000000000 --- a/packages/less/lib/less/source-map-builder.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source-map-builder.js","sourceRoot":"","sources":["../../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, environment) => {\n class SourceMapBuilder {\n constructor(options) {\n this.options = options;\n }\n\n toCSS(rootNode, options, imports) {\n const sourceMapOutput = new SourceMapOutput(\n {\n contentsIgnoredCharsMap: imports.contentsIgnoredChars,\n rootNode,\n contentsMap: imports.contents,\n sourceMapFilename: this.options.sourceMapFilename,\n sourceMapURL: this.options.sourceMapURL,\n outputFilename: this.options.sourceMapOutputFilename,\n sourceMapBasepath: this.options.sourceMapBasepath,\n sourceMapRootpath: this.options.sourceMapRootpath,\n outputSourceFiles: this.options.outputSourceFiles,\n sourceMapGenerator: this.options.sourceMapGenerator,\n sourceMapFileInline: this.options.sourceMapFileInline, \n disableSourcemapAnnotation: this.options.disableSourcemapAnnotation\n });\n\n const css = sourceMapOutput.toCSS(options);\n this.sourceMap = sourceMapOutput.sourceMap;\n this.sourceMapURL = sourceMapOutput.sourceMapURL;\n if (this.options.sourceMapInputFilename) {\n this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename);\n }\n if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) {\n this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL);\n }\n return css + this.getCSSAppendage();\n }\n\n getCSSAppendage() {\n\n let sourceMapURL = this.sourceMapURL;\n if (this.options.sourceMapFileInline) {\n if (this.sourceMap === undefined) {\n return '';\n }\n sourceMapURL = `data:application/json;base64,${environment.encodeBase64(this.sourceMap)}`;\n }\n\n if (this.options.disableSourcemapAnnotation) {\n return '';\n }\n\n if (sourceMapURL) {\n return `/*# sourceMappingURL=${sourceMapURL} */`;\n }\n return '';\n }\n\n getExternalSourceMap() {\n return this.sourceMap;\n }\n\n setExternalSourceMap(sourceMap) {\n this.sourceMap = sourceMap;\n }\n\n isInline() {\n return this.options.sourceMapFileInline;\n }\n\n getSourceMapURL() {\n return this.sourceMapURL;\n }\n\n getOutputFilename() {\n return this.options.sourceMapOutputFilename;\n }\n\n getInputFilename() {\n return this.sourceMapInputFilename;\n }\n }\n\n return SourceMapBuilder;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/source-map-output.js b/packages/less/lib/less/source-map-output.js deleted file mode 100644 index 3da8676e2..000000000 --- a/packages/less/lib/less/source-map-output.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = (function (environment) { - var SourceMapOutput = /** @class */ (function () { - function SourceMapOutput(options) { - this._css = []; - this._rootNode = options.rootNode; - this._contentsMap = options.contentsMap; - this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap; - if (options.sourceMapFilename) { - this._sourceMapFilename = options.sourceMapFilename.replace(/\\/g, '/'); - } - this._outputFilename = options.outputFilename; - this.sourceMapURL = options.sourceMapURL; - if (options.sourceMapBasepath) { - this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\/g, '/'); - } - if (options.sourceMapRootpath) { - this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/'); - if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') { - this._sourceMapRootpath += '/'; - } - } - else { - this._sourceMapRootpath = ''; - } - this._outputSourceFiles = options.outputSourceFiles; - this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator(); - this._lineNumber = 0; - this._column = 0; - } - SourceMapOutput.prototype.removeBasepath = function (path) { - if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) { - path = path.substring(this._sourceMapBasepath.length); - if (path.charAt(0) === '\\' || path.charAt(0) === '/') { - path = path.substring(1); - } - } - return path; - }; - SourceMapOutput.prototype.normalizeFilename = function (filename) { - filename = filename.replace(/\\/g, '/'); - filename = this.removeBasepath(filename); - return (this._sourceMapRootpath || '') + filename; - }; - SourceMapOutput.prototype.add = function (chunk, fileInfo, index, mapLines) { - // ignore adding empty strings - if (!chunk) { - return; - } - var lines; - var sourceLines; - var columns; - var sourceColumns; - var i; - if (fileInfo && fileInfo.filename) { - var inputSource = this._contentsMap[fileInfo.filename]; - // remove vars/banner added to the top of the file - if (this._contentsIgnoredCharsMap[fileInfo.filename]) { - // adjust the index - index -= this._contentsIgnoredCharsMap[fileInfo.filename]; - if (index < 0) { - index = 0; - } - // adjust the source - inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]); - } - // ignore empty content - if (inputSource === undefined) { - return; - } - inputSource = inputSource.substring(0, index); - sourceLines = inputSource.split('\n'); - sourceColumns = sourceLines[sourceLines.length - 1]; - } - lines = chunk.split('\n'); - columns = lines[lines.length - 1]; - if (fileInfo && fileInfo.filename) { - if (!mapLines) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column }, - original: { line: sourceLines.length, column: sourceColumns.length }, - source: this.normalizeFilename(fileInfo.filename) }); - } - else { - for (i = 0; i < lines.length; i++) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0 }, - original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0 }, - source: this.normalizeFilename(fileInfo.filename) }); - } - } - } - if (lines.length === 1) { - this._column += columns.length; - } - else { - this._lineNumber += lines.length - 1; - this._column = columns.length; - } - this._css.push(chunk); - }; - SourceMapOutput.prototype.isEmpty = function () { - return this._css.length === 0; - }; - SourceMapOutput.prototype.toCSS = function (context) { - this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null }); - if (this._outputSourceFiles) { - for (var filename in this._contentsMap) { - if (this._contentsMap.hasOwnProperty(filename)) { - var source = this._contentsMap[filename]; - if (this._contentsIgnoredCharsMap[filename]) { - source = source.slice(this._contentsIgnoredCharsMap[filename]); - } - this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source); - } - } - } - this._rootNode.genCSS(context, this); - if (this._css.length > 0) { - var sourceMapURL = void 0; - var sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON()); - if (this.sourceMapURL) { - sourceMapURL = this.sourceMapURL; - } - else if (this._sourceMapFilename) { - sourceMapURL = this._sourceMapFilename; - } - this.sourceMapURL = sourceMapURL; - this.sourceMap = sourceMapContent; - } - return this._css.join(''); - }; - return SourceMapOutput; - }()); - return SourceMapOutput; -}); -//# sourceMappingURL=source-map-output.js.map \ No newline at end of file diff --git a/packages/less/lib/less/source-map-output.js.map b/packages/less/lib/less/source-map-output.js.map deleted file mode 100644 index 9e55717c1..000000000 --- a/packages/less/lib/less/source-map-output.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source-map-output.js","sourceRoot":"","sources":["../../src/less/source-map-output.js"],"names":[],"mappings":";;AAAA,mBAAe,UAAA,WAAW;IACtB;QACI,yBAAY,OAAO;YACf,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;YAClC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;YACxC,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC;YAChE,IAAI,OAAO,CAAC,iBAAiB,EAAE;gBAC3B,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;aAC3E;YACD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;YAC9C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;YACzC,IAAI,OAAO,CAAC,iBAAiB,EAAE;gBAC3B,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;aAC3E;YACD,IAAI,OAAO,CAAC,iBAAiB,EAAE;gBAC3B,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBACxE,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,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AC;gBAEjC,IAAI,CAAC,SAAS,GAAG,gBAAgB,CAAC;aACrC;YAED,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9B,CAAC;QACL,sBAAC;IAAD,CAAC,AAhJD,IAgJC;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC,EAAC","sourcesContent":["export default environment => {\n class SourceMapOutput {\n constructor(options) {\n this._css = [];\n this._rootNode = options.rootNode;\n this._contentsMap = options.contentsMap;\n this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap;\n if (options.sourceMapFilename) {\n this._sourceMapFilename = options.sourceMapFilename.replace(/\\\\/g, '/');\n }\n this._outputFilename = options.outputFilename;\n this.sourceMapURL = options.sourceMapURL;\n if (options.sourceMapBasepath) {\n this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\\\/g, '/');\n }\n if (options.sourceMapRootpath) {\n this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\\\/g, '/');\n if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') {\n this._sourceMapRootpath += '/';\n }\n } else {\n this._sourceMapRootpath = '';\n }\n this._outputSourceFiles = options.outputSourceFiles;\n this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator();\n\n this._lineNumber = 0;\n this._column = 0;\n }\n\n removeBasepath(path) {\n if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) {\n path = path.substring(this._sourceMapBasepath.length);\n if (path.charAt(0) === '\\\\' || path.charAt(0) === '/') {\n path = path.substring(1);\n }\n }\n\n return path;\n }\n\n normalizeFilename(filename) {\n filename = filename.replace(/\\\\/g, '/');\n filename = this.removeBasepath(filename);\n return (this._sourceMapRootpath || '') + filename;\n }\n\n add(chunk, fileInfo, index, mapLines) {\n // ignore adding empty strings\n if (!chunk) {\n return;\n }\n\n let lines;\n let sourceLines;\n let columns;\n let sourceColumns;\n let i;\n\n if (fileInfo && fileInfo.filename) {\n let inputSource = this._contentsMap[fileInfo.filename];\n\n // remove vars/banner added to the top of the file\n if (this._contentsIgnoredCharsMap[fileInfo.filename]) {\n // adjust the index\n index -= this._contentsIgnoredCharsMap[fileInfo.filename];\n if (index < 0) { index = 0; }\n // adjust the source\n inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]);\n }\n\n // ignore empty content\n if (inputSource === undefined) {\n return;\n }\n\n inputSource = inputSource.substring(0, index);\n sourceLines = inputSource.split('\\n');\n sourceColumns = sourceLines[sourceLines.length - 1];\n }\n\n lines = chunk.split('\\n');\n columns = lines[lines.length - 1];\n\n if (fileInfo && fileInfo.filename) {\n if (!mapLines) {\n this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column},\n original: { line: sourceLines.length, column: sourceColumns.length},\n source: this.normalizeFilename(fileInfo.filename)});\n } else {\n for (i = 0; i < lines.length; i++) {\n this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0},\n original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0},\n source: this.normalizeFilename(fileInfo.filename)});\n }\n }\n }\n\n if (lines.length === 1) {\n this._column += columns.length;\n } else {\n this._lineNumber += lines.length - 1;\n this._column = columns.length;\n }\n\n this._css.push(chunk);\n }\n\n isEmpty() {\n return this._css.length === 0;\n }\n\n toCSS(context) {\n this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null });\n\n if (this._outputSourceFiles) {\n for (const filename in this._contentsMap) {\n if (this._contentsMap.hasOwnProperty(filename)) {\n let source = this._contentsMap[filename];\n if (this._contentsIgnoredCharsMap[filename]) {\n source = source.slice(this._contentsIgnoredCharsMap[filename]);\n }\n this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source);\n }\n }\n }\n\n this._rootNode.genCSS(context, this);\n\n if (this._css.length > 0) {\n let sourceMapURL;\n const sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON());\n\n if (this.sourceMapURL) {\n sourceMapURL = this.sourceMapURL;\n } else if (this._sourceMapFilename) {\n sourceMapURL = this._sourceMapFilename;\n }\n this.sourceMapURL = sourceMapURL;\n\n this.sourceMap = sourceMapContent;\n }\n\n return this._css.join('');\n }\n }\n\n return SourceMapOutput;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/transform-tree.js b/packages/less/lib/less/transform-tree.js deleted file mode 100644 index 2908e1b93..000000000 --- a/packages/less/lib/less/transform-tree.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var contexts_1 = __importDefault(require("./contexts")); -var visitors_1 = __importDefault(require("./visitors")); -var tree_1 = __importDefault(require("./tree")); -exports.default = (function (root, options) { - if (options === void 0) { options = {}; } - var evaldRoot; - var variables = options.variables; - var evalEnv = new contexts_1.default.Eval(options); - // - // Allows setting variables with a hash, so: - // - // `{ color: new tree.Color('#f01') }` will become: - // - // new tree.Declaration('@color', - // new tree.Value([ - // new tree.Expression([ - // new tree.Color('#f01') - // ]) - // ]) - // ) - // - if (typeof variables === 'object' && !Array.isArray(variables)) { - variables = Object.keys(variables).map(function (k) { - var value = variables[k]; - if (!(value instanceof tree_1.default.Value)) { - if (!(value instanceof tree_1.default.Expression)) { - value = new tree_1.default.Expression([value]); - } - value = new tree_1.default.Value([value]); - } - return new tree_1.default.Declaration("@" + k, value, false, null, 0); - }); - evalEnv.frames = [new tree_1.default.Ruleset(null, variables)]; - } - var visitors = [ - new visitors_1.default.JoinSelectorVisitor(), - new visitors_1.default.MarkVisibleSelectorsVisitor(true), - new visitors_1.default.ExtendVisitor(), - new visitors_1.default.ToCSSVisitor({ compress: Boolean(options.compress) }) - ]; - var preEvalVisitors = []; - var v; - var visitorIterator; - /** - * first() / get() allows visitors to be added while visiting - * - * @todo Add scoping for visitors just like functions for @plugin; right now they're global - */ - if (options.pluginManager) { - visitorIterator = options.pluginManager.visitor(); - for (var i = 0; i < 2; i++) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (v.isPreEvalVisitor) { - if (i === 0 || preEvalVisitors.indexOf(v) === -1) { - preEvalVisitors.push(v); - v.run(root); - } - } - else { - if (i === 0 || visitors.indexOf(v) === -1) { - if (v.isPreVisitor) { - visitors.unshift(v); - } - else { - visitors.push(v); - } - } - } - } - } - } - evaldRoot = root.eval(evalEnv); - for (var i = 0; i < visitors.length; i++) { - visitors[i].run(evaldRoot); - } - // Run any remaining visitors added after eval pass - if (options.pluginManager) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (visitors.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) { - v.run(evaldRoot); - } - } - } - return evaldRoot; -}); -//# sourceMappingURL=transform-tree.js.map \ No newline at end of file diff --git a/packages/less/lib/less/transform-tree.js.map b/packages/less/lib/less/transform-tree.js.map deleted file mode 100644 index aea1491a0..000000000 --- a/packages/less/lib/less/transform-tree.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transform-tree.js","sourceRoot":"","sources":["../../src/less/transform-tree.js"],"names":[],"mappings":";;;;;AAAA,wDAAkC;AAClC,wDAAiC;AACjC,gDAA0B;AAE1B,mBAAe,UAAC,IAAI,EAAE,OAAY;IAAZ,wBAAA,EAAA,YAAY;IAC9B,IAAI,SAAS,CAAC;IACd,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAClC,IAAM,OAAO,GAAG,IAAI,kBAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE3C,EAAE;IACF,4CAA4C;IAC5C,EAAE;IACF,qDAAqD;IACrD,EAAE;IACF,mCAAmC;IACnC,uBAAuB;IACvB,8BAA8B;IAC9B,iCAAiC;IACjC,WAAW;IACX,SAAS;IACT,MAAM;IACN,EAAE;IACF,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,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B;SACJ;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC,EAAC","sourcesContent":["import contexts from './contexts';\nimport visitor from './visitors';\nimport tree from './tree';\n\nexport default (root, options = {}) => {\n let evaldRoot;\n let variables = options.variables;\n const evalEnv = new contexts.Eval(options);\n\n //\n // Allows setting variables with a hash, so:\n //\n // `{ color: new tree.Color('#f01') }` will become:\n //\n // new tree.Declaration('@color',\n // new tree.Value([\n // new tree.Expression([\n // new tree.Color('#f01')\n // ])\n // ])\n // )\n //\n if (typeof variables === 'object' && !Array.isArray(variables)) {\n variables = Object.keys(variables).map(k => {\n let value = variables[k];\n\n if (!(value instanceof tree.Value)) {\n if (!(value instanceof tree.Expression)) {\n value = new tree.Expression([value]);\n }\n value = new tree.Value([value]);\n }\n return new tree.Declaration(`@${k}`, value, false, null, 0);\n });\n evalEnv.frames = [new tree.Ruleset(null, variables)];\n }\n\n const visitors = [\n new visitor.JoinSelectorVisitor(),\n new visitor.MarkVisibleSelectorsVisitor(true),\n new visitor.ExtendVisitor(),\n new visitor.ToCSSVisitor({compress: Boolean(options.compress)})\n ];\n\n const preEvalVisitors = [];\n let v;\n let visitorIterator;\n\n /**\n * first() / get() allows visitors to be added while visiting\n * \n * @todo Add scoping for visitors just like functions for @plugin; right now they're global\n */\n if (options.pluginManager) {\n visitorIterator = options.pluginManager.visitor();\n for (var i = 0; i < 2; i++) {\n visitorIterator.first();\n while ((v = visitorIterator.get())) {\n if (v.isPreEvalVisitor) {\n if (i === 0 || preEvalVisitors.indexOf(v) === -1) {\n preEvalVisitors.push(v);\n v.run(root);\n }\n }\n else {\n if (i === 0 || visitors.indexOf(v) === -1) {\n if (v.isPreVisitor) {\n visitors.unshift(v);\n }\n else {\n visitors.push(v);\n }\n }\n }\n }\n }\n }\n\n evaldRoot = root.eval(evalEnv);\n\n for (var i = 0; i < visitors.length; i++) {\n visitors[i].run(evaldRoot);\n }\n\n // Run any remaining visitors added after eval pass\n if (options.pluginManager) {\n visitorIterator.first();\n while ((v = visitorIterator.get())) {\n if (visitors.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) {\n v.run(evaldRoot);\n }\n }\n }\n\n return evaldRoot;\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/anonymous.js b/packages/less/lib/less/tree/anonymous.js deleted file mode 100644 index b8fb9c233..000000000 --- a/packages/less/lib/less/tree/anonymous.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var Anonymous = /** @class */ (function (_super) { - __extends(Anonymous, _super); - function Anonymous(value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { - var _this = _super.call(this) || this; - _this.value = value; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.mapLines = mapLines; - _this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike; - _this.allowRoot = true; - _this.copyVisibilityInfo(visibilityInfo); - return _this; - } - Anonymous.prototype.eval = function () { - return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); - }; - Anonymous.prototype.compare = function (other) { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - }; - Anonymous.prototype.isRulesetLike = function () { - return this.rulesetLike; - }; - Anonymous.prototype.genCSS = function (context, output) { - this.nodeVisible = Boolean(this.value); - if (this.nodeVisible) { - output.add(this.value, this._fileInfo, this._index, this.mapLines); - } - }; - return Anonymous; -}(node_1.default)); -Anonymous.prototype.type = 'Anonymous'; -exports.default = Anonymous; -//# sourceMappingURL=anonymous.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/anonymous.js.map b/packages/less/lib/less/tree/anonymous.js.map deleted file mode 100644 index 093c91bd2..000000000 --- a/packages/less/lib/less/tree/anonymous.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src/less/tree/anonymous.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAwB,6BAAI;IACxB,mBAAY,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc;QAAhF,YACI,iBAAO,SASV;QAPG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,WAAW,GAAG,CAAC,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC;QAC9E,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;;IAC5C,CAAC;IAED,wBAAI,GAAJ;QACI,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC1H,CAAC;IAED,2BAAO,GAAP,UAAQ,KAAK;QACT,OAAO,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzE,CAAC;IAED,iCAAa,GAAb;QACI,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,0BAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtE;IACL,CAAC;IACL,gBAAC;AAAD,CAAC,AA/BD,CAAwB,cAAI,GA+B3B;AAED,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,WAAW,CAAC;AACvC,kBAAe,SAAS,CAAC","sourcesContent":["import Node from './node';\n\nclass Anonymous extends Node {\n constructor(value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) {\n super();\n\n this.value = value;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.mapLines = mapLines;\n this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike;\n this.allowRoot = true;\n this.copyVisibilityInfo(visibilityInfo);\n }\n\n eval() {\n return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());\n }\n\n compare(other) {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n }\n\n isRulesetLike() {\n return this.rulesetLike;\n }\n\n genCSS(context, output) {\n this.nodeVisible = Boolean(this.value);\n if (this.nodeVisible) {\n output.add(this.value, this._fileInfo, this._index, this.mapLines);\n }\n }\n}\n\nAnonymous.prototype.type = 'Anonymous';\nexport default Anonymous;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/assignment.js b/packages/less/lib/less/tree/assignment.js deleted file mode 100644 index 05874f382..000000000 --- a/packages/less/lib/less/tree/assignment.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var Assignment = /** @class */ (function (_super) { - __extends(Assignment, _super); - function Assignment(key, val) { - var _this = _super.call(this) || this; - _this.key = key; - _this.value = val; - return _this; - } - Assignment.prototype.accept = function (visitor) { - this.value = visitor.visit(this.value); - }; - Assignment.prototype.eval = function (context) { - if (this.value.eval) { - return new Assignment(this.key, this.value.eval(context)); - } - return this; - }; - Assignment.prototype.genCSS = function (context, output) { - output.add(this.key + "="); - if (this.value.genCSS) { - this.value.genCSS(context, output); - } - else { - output.add(this.value); - } - }; - return Assignment; -}(node_1.default)); -Assignment.prototype.type = 'Assignment'; -exports.default = Assignment; -//# sourceMappingURL=assignment.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/assignment.js.map b/packages/less/lib/less/tree/assignment.js.map deleted file mode 100644 index 965368f5c..000000000 --- a/packages/less/lib/less/tree/assignment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assignment.js","sourceRoot":"","sources":["../../../src/less/tree/assignment.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAyB,8BAAI;IACzB,oBAAY,GAAG,EAAE,GAAG;QAApB,YACI,iBAAO,SAIV;QAFG,KAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC;;IACrB,CAAC;IAED,2BAAM,GAAN,UAAO,OAAO;QACV,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,yBAAI,GAAJ,UAAK,OAAO;QACR,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACjB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,2BAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAI,IAAI,CAAC,GAAG,MAAG,CAAC,CAAC;QAC3B,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACnB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SACtC;aAAM;YACH,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1B;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AA3BD,CAAyB,cAAI,GA2B5B;AAED,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,YAAY,CAAC;AACzC,kBAAe,UAAU,CAAC","sourcesContent":["import Node from './node';\n\nclass Assignment extends Node {\n constructor(key, val) {\n super();\n\n this.key = key;\n this.value = val;\n }\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n }\n\n eval(context) {\n if (this.value.eval) {\n return new Assignment(this.key, this.value.eval(context));\n }\n return this;\n }\n\n genCSS(context, output) {\n output.add(`${this.key}=`);\n if (this.value.genCSS) {\n this.value.genCSS(context, output);\n } else {\n output.add(this.value);\n }\n }\n}\n\nAssignment.prototype.type = 'Assignment';\nexport default Assignment;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/atrule.js b/packages/less/lib/less/tree/atrule.js deleted file mode 100644 index bb6860519..000000000 --- a/packages/less/lib/less/tree/atrule.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var selector_1 = __importDefault(require("./selector")); -var ruleset_1 = __importDefault(require("./ruleset")); -var anonymous_1 = __importDefault(require("./anonymous")); -var AtRule = /** @class */ (function (_super) { - __extends(AtRule, _super); - function AtRule(name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { - var _this = _super.call(this) || this; - var i; - _this.name = name; - _this.value = (value instanceof node_1.default) ? value : (value ? new anonymous_1.default(value) : value); - if (rules) { - if (Array.isArray(rules)) { - _this.rules = rules; - } - else { - _this.rules = [rules]; - _this.rules[0].selectors = (new selector_1.default([], null, null, index, currentFileInfo)).createEmptySelectors(); - } - for (i = 0; i < _this.rules.length; i++) { - _this.rules[i].allowImports = true; - } - _this.setParent(_this.rules, _this); - } - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.debugInfo = debugInfo; - _this.isRooted = isRooted || false; - _this.copyVisibilityInfo(visibilityInfo); - _this.allowRoot = true; - return _this; - } - AtRule.prototype.accept = function (visitor) { - var value = this.value; - var rules = this.rules; - if (rules) { - this.rules = visitor.visitArray(rules); - } - if (value) { - this.value = visitor.visit(value); - } - }; - AtRule.prototype.isRulesetLike = function () { - return this.rules || !this.isCharset(); - }; - AtRule.prototype.isCharset = function () { - return '@charset' === this.name; - }; - AtRule.prototype.genCSS = function (context, output) { - var value = this.value; - var rules = this.rules; - output.add(this.name, this.fileInfo(), this.getIndex()); - if (value) { - output.add(' '); - value.genCSS(context, output); - } - if (rules) { - this.outputRuleset(context, output, rules); - } - else { - output.add(';'); - } - }; - AtRule.prototype.eval = function (context) { - var mediaPathBackup; - var mediaBlocksBackup; - var value = this.value; - var rules = this.rules; - // media stored inside other atrule should not bubble over it - // backpup media bubbling information - mediaPathBackup = context.mediaPath; - mediaBlocksBackup = context.mediaBlocks; - // deleted media bubbling information - context.mediaPath = []; - context.mediaBlocks = []; - if (value) { - value = value.eval(context); - } - if (rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - rules = [rules[0].eval(context)]; - rules[0].root = true; - } - // restore media bubbling information - context.mediaPath = mediaPathBackup; - context.mediaBlocks = mediaBlocksBackup; - return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo()); - }; - AtRule.prototype.variable = function (name) { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return ruleset_1.default.prototype.variable.call(this.rules[0], name); - } - }; - AtRule.prototype.find = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return ruleset_1.default.prototype.find.apply(this.rules[0], args); - } - }; - AtRule.prototype.rulesets = function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return ruleset_1.default.prototype.rulesets.apply(this.rules[0]); - } - }; - AtRule.prototype.outputRuleset = function (context, output, rules) { - var ruleCnt = rules.length; - var i; - context.tabLevel = (context.tabLevel | 0) + 1; - // Compressed - if (context.compress) { - output.add('{'); - for (i = 0; i < ruleCnt; i++) { - rules[i].genCSS(context, output); - } - output.add('}'); - context.tabLevel--; - return; - } - // Non-compressed - var tabSetStr = "\n" + Array(context.tabLevel).join(' '); - var tabRuleStr = tabSetStr + " "; - if (!ruleCnt) { - output.add(" {" + tabSetStr + "}"); - } - else { - output.add(" {" + tabRuleStr); - rules[0].genCSS(context, output); - for (i = 1; i < ruleCnt; i++) { - output.add(tabRuleStr); - rules[i].genCSS(context, output); - } - output.add(tabSetStr + "}"); - } - context.tabLevel--; - }; - return AtRule; -}(node_1.default)); -AtRule.prototype.type = 'AtRule'; -exports.default = AtRule; -//# sourceMappingURL=atrule.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/atrule.js.map b/packages/less/lib/less/tree/atrule.js.map deleted file mode 100644 index c4ad7f0db..000000000 --- a/packages/less/lib/less/tree/atrule.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"atrule.js","sourceRoot":"","sources":["../../../src/less/tree/atrule.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAClC,sDAAgC;AAChC,0DAAoC;AAEpC;IAAqB,0BAAI;IACrB,gBACI,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,eAAe,EACf,SAAS,EACT,QAAQ,EACR,cAAc;QARlB,YAUI,iBAAO,SAwBV;QAtBG,IAAI,CAAC,CAAC;QAEN,KAAI,CAAC,IAAI,GAAI,IAAI,CAAC;QAClB,KAAI,CAAC,KAAK,GAAG,CAAC,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACtF,IAAI,KAAK,EAAE;YACP,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACtB,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;aACtB;iBAAM;gBACH,KAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;gBACrB,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,C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selector';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\n\nclass AtRule extends Node {\n constructor(\n name,\n value,\n rules,\n index,\n currentFileInfo,\n debugInfo,\n isRooted,\n visibilityInfo\n ) {\n super();\n\n let i;\n\n this.name = name;\n this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value);\n if (rules) {\n if (Array.isArray(rules)) {\n this.rules = rules;\n } else {\n this.rules = [rules];\n this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();\n }\n for (i = 0; i < this.rules.length; i++) {\n this.rules[i].allowImports = true;\n }\n this.setParent(this.rules, this);\n }\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.debugInfo = debugInfo;\n this.isRooted = isRooted || false;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n }\n\n accept(visitor) {\n const value = this.value;\n const rules = this.rules;\n if (rules) {\n this.rules = visitor.visitArray(rules);\n }\n if (value) {\n this.value = visitor.visit(value);\n }\n }\n\n isRulesetLike() {\n return this.rules || !this.isCharset();\n }\n\n isCharset() {\n return '@charset' === this.name;\n }\n\n genCSS(context, output) {\n const value = this.value;\n const rules = this.rules;\n output.add(this.name, this.fileInfo(), this.getIndex());\n if (value) {\n output.add(' ');\n value.genCSS(context, output);\n }\n if (rules) {\n this.outputRuleset(context, output, rules);\n } else {\n output.add(';');\n }\n }\n\n eval(context) {\n let mediaPathBackup;\n let mediaBlocksBackup;\n let value = this.value;\n let rules = this.rules;\n\n // media stored inside other atrule should not bubble over it\n // backpup media bubbling information\n mediaPathBackup = context.mediaPath;\n mediaBlocksBackup = context.mediaBlocks;\n // deleted media bubbling information\n context.mediaPath = [];\n context.mediaBlocks = [];\n\n if (value) {\n value = value.eval(context);\n }\n if (rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n rules = [rules[0].eval(context)];\n rules[0].root = true;\n }\n // restore media bubbling information\n context.mediaPath = mediaPathBackup;\n context.mediaBlocks = mediaBlocksBackup;\n\n return new AtRule(this.name, value, rules,\n this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());\n }\n\n variable(name) {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.variable.call(this.rules[0], name);\n }\n }\n\n find(...args) {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.find.apply(this.rules[0], args);\n }\n }\n\n rulesets() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.rulesets.apply(this.rules[0]);\n }\n }\n\n outputRuleset(context, output, rules) {\n const ruleCnt = rules.length;\n let i;\n context.tabLevel = (context.tabLevel | 0) + 1;\n\n // Compressed\n if (context.compress) {\n output.add('{');\n for (i = 0; i < ruleCnt; i++) {\n rules[i].genCSS(context, output);\n }\n output.add('}');\n context.tabLevel--;\n return;\n }\n\n // Non-compressed\n const tabSetStr = `\\n${Array(context.tabLevel).join(' ')}`;\n\n const tabRuleStr = `${tabSetStr} `;\n if (!ruleCnt) {\n output.add(` {${tabSetStr}}`);\n } else {\n output.add(` {${tabRuleStr}`);\n rules[0].genCSS(context, output);\n for (i = 1; i < ruleCnt; i++) {\n output.add(tabRuleStr);\n rules[i].genCSS(context, output);\n }\n output.add(`${tabSetStr}}`);\n }\n\n context.tabLevel--;\n }\n}\n\nAtRule.prototype.type = 'AtRule';\nexport default AtRule;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/attribute.js b/packages/less/lib/less/tree/attribute.js deleted file mode 100644 index 9572c0887..000000000 --- a/packages/less/lib/less/tree/attribute.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var Attribute = /** @class */ (function (_super) { - __extends(Attribute, _super); - function Attribute(key, op, value) { - var _this = _super.call(this) || this; - _this.key = key; - _this.op = op; - _this.value = value; - return _this; - } - Attribute.prototype.eval = function (context) { - return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value); - }; - Attribute.prototype.genCSS = function (context, output) { - output.add(this.toCSS(context)); - }; - Attribute.prototype.toCSS = function (context) { - var value = this.key.toCSS ? this.key.toCSS(context) : this.key; - if (this.op) { - value += this.op; - value += (this.value.toCSS ? this.value.toCSS(context) : this.value); - } - return "[" + value + "]"; - }; - return Attribute; -}(node_1.default)); -Attribute.prototype.type = 'Attribute'; -exports.default = Attribute; -//# sourceMappingURL=attribute.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/attribute.js.map b/packages/less/lib/less/tree/attribute.js.map deleted file mode 100644 index 3a537f864..000000000 --- a/packages/less/lib/less/tree/attribute.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../../src/less/tree/attribute.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAwB,6BAAI;IACxB,mBAAY,GAAG,EAAE,EAAE,EAAE,KAAK;QAA1B,YACI,iBAAO,SAKV;QAHG,KAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,KAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACvB,CAAC;IAED,wBAAI,GAAJ,UAAK,OAAO;QACR,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAClE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1F,CAAC;IAED,0BAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,yBAAK,GAAL,UAAM,OAAO;QACT,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAEhE,IAAI,IAAI,CAAC,EAAE,EAAE;YACT,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACxE;QAED,OAAO,MAAI,KAAK,MAAG,CAAC;IACxB,CAAC;IACL,gBAAC;AAAD,CAAC,AA5BD,CAAwB,cAAI,GA4B3B;AAED,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,WAAW,CAAC;AACvC,kBAAe,SAAS,CAAC","sourcesContent":["import Node from './node';\n\nclass Attribute extends Node {\n constructor(key, op, value) {\n super();\n\n this.key = key;\n this.op = op;\n this.value = value;\n }\n\n eval(context) {\n return new Attribute(this.key.eval ? this.key.eval(context) : this.key,\n this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value);\n }\n\n genCSS(context, output) {\n output.add(this.toCSS(context));\n }\n\n toCSS(context) {\n let value = this.key.toCSS ? this.key.toCSS(context) : this.key;\n\n if (this.op) {\n value += this.op;\n value += (this.value.toCSS ? this.value.toCSS(context) : this.value);\n }\n\n return `[${value}]`;\n }\n}\n\nAttribute.prototype.type = 'Attribute';\nexport default Attribute;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/call.js b/packages/less/lib/less/tree/call.js deleted file mode 100644 index 3d3def714..000000000 --- a/packages/less/lib/less/tree/call.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var anonymous_1 = __importDefault(require("./anonymous")); -var function_caller_1 = __importDefault(require("../functions/function-caller")); -// -// A function call node. -// -var Call = /** @class */ (function (_super) { - __extends(Call, _super); - function Call(name, args, index, currentFileInfo) { - var _this = _super.call(this) || this; - _this.name = name; - _this.args = args; - _this.calc = name === 'calc'; - _this._index = index; - _this._fileInfo = currentFileInfo; - return _this; - } - Call.prototype.accept = function (visitor) { - if (this.args) { - this.args = visitor.visitArray(this.args); - } - }; - // - // When evaluating a function call, - // we either find the function in the functionRegistry, - // in which case we call it, passing the evaluated arguments, - // if this returns null or we cannot find the function, we - // simply print it out as it appeared originally [2]. - // - // The reason why we evaluate the arguments, is in the case where - // we try to pass a variable to a function, like: `saturate(@color)`. - // The function should receive the value, not the variable. - // - Call.prototype.eval = function (context) { - /** - * Turn off math for calc(), and switch back on for evaluating nested functions - */ - var currentMathContext = context.mathOn; - context.mathOn = !this.calc; - if (this.calc || context.inCalc) { - context.enterCalc(); - } - var args = this.args.map(function (a) { return a.eval(context); }); - if (this.calc || context.inCalc) { - context.exitCalc(); - } - context.mathOn = currentMathContext; - var result; - var funcCaller = new function_caller_1.default(this.name, context, this.getIndex(), this.fileInfo()); - if (funcCaller.isValid()) { - try { - result = funcCaller.call(args); - } - catch (e) { - throw { - type: e.type || 'Runtime', - message: "error evaluating function `" + this.name + "`" + (e.message ? ": " + e.message : ''), - index: this.getIndex(), - filename: this.fileInfo().filename, - line: e.lineNumber, - column: e.columnNumber - }; - } - if (result !== null && result !== undefined) { - // Results that that are not nodes are cast as Anonymous nodes - // Falsy values or booleans are returned as empty nodes - if (!(result instanceof node_1.default)) { - if (!result || result === true) { - result = new anonymous_1.default(null); - } - else { - result = new anonymous_1.default(result.toString()); - } - } - result._index = this._index; - result._fileInfo = this._fileInfo; - return result; - } - } - return new Call(this.name, args, this.getIndex(), this.fileInfo()); - }; - Call.prototype.genCSS = function (context, output) { - output.add(this.name + "(", this.fileInfo(), this.getIndex()); - for (var i = 0; i < this.args.length; i++) { - this.args[i].genCSS(context, output); - if (i + 1 < this.args.length) { - output.add(', '); - } - } - output.add(')'); - }; - return Call; -}(node_1.default)); -Call.prototype.type = 'Call'; -exports.default = Call; -//# sourceMappingURL=call.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/call.js.map b/packages/less/lib/less/tree/call.js.map deleted file mode 100644 index f27dcbc3c..000000000 --- a/packages/less/lib/less/tree/call.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"call.js","sourceRoot":"","sources":["../../../src/less/tree/call.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0DAAoC;AACpC,iFAA0D;AA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EJ;QAED,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,qBAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAI,IAAI,CAAC,IAAI,MAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACrC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC1B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACpB;SACJ;QAED,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IACL,WAAC;AAAD,CAAC,AA9FD,CAAmB,cAAI,GA8FtB;AAED,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC;AAC7B,kBAAe,IAAI,CAAC","sourcesContent":["import Node from './node';\nimport Anonymous from './anonymous';\nimport FunctionCaller from '../functions/function-caller';\n\n//\n// A function call node.\n//\nclass Call extends Node {\n constructor(name, args, index, currentFileInfo) {\n super();\n\n this.name = name;\n this.args = args;\n this.calc = name === 'calc';\n this._index = index;\n this._fileInfo = currentFileInfo;\n }\n\n accept(visitor) {\n if (this.args) {\n this.args = visitor.visitArray(this.args);\n }\n }\n\n //\n // When evaluating a function call,\n // we either find the function in the functionRegistry,\n // in which case we call it, passing the evaluated arguments,\n // if this returns null or we cannot find the function, we\n // simply print it out as it appeared originally [2].\n //\n // The reason why we evaluate the arguments, is in the case where\n // we try to pass a variable to a function, like: `saturate(@color)`.\n // The function should receive the value, not the variable.\n //\n eval(context) {\n /**\n * Turn off math for calc(), and switch back on for evaluating nested functions\n */\n const currentMathContext = context.mathOn;\n context.mathOn = !this.calc;\n if (this.calc || context.inCalc) {\n context.enterCalc();\n }\n const args = this.args.map(a => a.eval(context));\n if (this.calc || context.inCalc) {\n context.exitCalc();\n }\n context.mathOn = currentMathContext;\n\n let result;\n const funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo());\n\n if (funcCaller.isValid()) {\n try {\n result = funcCaller.call(args);\n } catch (e) {\n throw { \n type: e.type || 'Runtime',\n message: `error evaluating function \\`${this.name}\\`${e.message ? `: ${e.message}` : ''}`,\n index: this.getIndex(), \n filename: this.fileInfo().filename,\n line: e.lineNumber,\n column: e.columnNumber\n };\n }\n\n if (result !== null && result !== undefined) {\n // Results that that are not nodes are cast as Anonymous nodes\n // Falsy values or booleans are returned as empty nodes\n if (!(result instanceof Node)) {\n if (!result || result === true) {\n result = new Anonymous(null); \n }\n else {\n result = new Anonymous(result.toString()); \n }\n \n }\n result._index = this._index;\n result._fileInfo = this._fileInfo;\n return result;\n }\n\n }\n\n return new Call(this.name, args, this.getIndex(), this.fileInfo());\n }\n\n genCSS(context, output) {\n output.add(`${this.name}(`, this.fileInfo(), this.getIndex());\n\n for (let i = 0; i < this.args.length; i++) {\n this.args[i].genCSS(context, output);\n if (i + 1 < this.args.length) {\n output.add(', ');\n }\n }\n\n output.add(')');\n }\n}\n\nCall.prototype.type = 'Call';\nexport default Call;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/color.js b/packages/less/lib/less/tree/color.js deleted file mode 100644 index a2962ba49..000000000 --- a/packages/less/lib/less/tree/color.js +++ /dev/null @@ -1,261 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var colors_1 = __importDefault(require("../data/colors")); -// -// RGB Colors - #ff0014, #eee -// -var Color = /** @class */ (function (_super) { - __extends(Color, _super); - function Color(rgb, a, originalForm) { - var _this = _super.call(this) || this; - var self = _this; - // - // The end goal here, is to parse the arguments - // into an integer triplet, such as `128, 255, 0` - // - // This facilitates operations and conversions. - // - if (Array.isArray(rgb)) { - _this.rgb = rgb; - } - else if (rgb.length >= 6) { - _this.rgb = []; - rgb.match(/.{2}/g).map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c, 16)); - } - else { - self.alpha = (parseInt(c, 16)) / 255; - } - }); - } - else { - _this.rgb = []; - rgb.split('').map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c + c, 16)); - } - else { - self.alpha = (parseInt(c + c, 16)) / 255; - } - }); - } - _this.alpha = _this.alpha || (typeof a === 'number' ? a : 1); - if (typeof originalForm !== 'undefined') { - _this.value = originalForm; - } - return _this; - } - Color.prototype.luma = function () { - var r = this.rgb[0] / 255; - var g = this.rgb[1] / 255; - var b = this.rgb[2] / 255; - r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4); - g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4); - b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - }; - Color.prototype.genCSS = function (context, output) { - output.add(this.toCSS(context)); - }; - Color.prototype.toCSS = function (context, doNotCompress) { - var compress = context && context.compress && !doNotCompress; - var color; - var alpha; - var colorFunction; - var args = []; - // `value` is set if this color was originally - // converted from a named color string so we need - // to respect this and try to output named color too. - alpha = this.fround(context, this.alpha); - if (this.value) { - if (this.value.indexOf('rgb') === 0) { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } - else if (this.value.indexOf('hsl') === 0) { - if (alpha < 1) { - colorFunction = 'hsla'; - } - else { - colorFunction = 'hsl'; - } - } - else { - return this.value; - } - } - else { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } - switch (colorFunction) { - case 'rgba': - args = this.rgb.map(function (c) { return clamp(Math.round(c), 255); }).concat(clamp(alpha, 1)); - break; - case 'hsla': - args.push(clamp(alpha, 1)); - case 'hsl': - color = this.toHSL(); - args = [ - this.fround(context, color.h), - this.fround(context, color.s * 100) + "%", - this.fround(context, color.l * 100) + "%" - ].concat(args); - } - if (colorFunction) { - // Values are capped between `0` and `255`, rounded and zero-padded. - return colorFunction + "(" + args.join("," + (compress ? '' : ' ')) + ")"; - } - color = this.toRGB(); - if (compress) { - var splitcolor = color.split(''); - // Convert color to short format - if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) { - color = "#" + splitcolor[1] + splitcolor[3] + splitcolor[5]; - } - } - return color; - }; - // - // Operations have to be done per-channel, if not, - // channels will spill onto each other. Once we have - // our result, in the form of an integer triplet, - // we create a new Color node to hold the result. - // - Color.prototype.operate = function (context, op, other) { - var rgb = new Array(3); - var alpha = this.alpha * (1 - other.alpha) + other.alpha; - for (var c = 0; c < 3; c++) { - rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]); - } - return new Color(rgb, alpha); - }; - Color.prototype.toRGB = function () { - return toHex(this.rgb); - }; - Color.prototype.toHSL = function () { - var r = this.rgb[0] / 255; - var g = this.rgb[1] / 255; - var b = this.rgb[2] / 255; - var a = this.alpha; - var max = Math.max(r, g, b); - var min = Math.min(r, g, b); - var h; - var s; - var l = (max + min) / 2; - var d = max - min; - if (max === min) { - h = s = 0; - } - else { - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - return { h: h * 360, s: s, l: l, a: a }; - }; - // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript - Color.prototype.toHSV = function () { - var r = this.rgb[0] / 255; - var g = this.rgb[1] / 255; - var b = this.rgb[2] / 255; - var a = this.alpha; - var max = Math.max(r, g, b); - var min = Math.min(r, g, b); - var h; - var s; - var v = max; - var d = max - min; - if (max === 0) { - s = 0; - } - else { - s = d / max; - } - if (max === min) { - h = 0; - } - else { - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - return { h: h * 360, s: s, v: v, a: a }; - }; - Color.prototype.toARGB = function () { - return toHex([this.alpha * 255].concat(this.rgb)); - }; - Color.prototype.compare = function (x) { - return (x.rgb && - x.rgb[0] === this.rgb[0] && - x.rgb[1] === this.rgb[1] && - x.rgb[2] === this.rgb[2] && - x.alpha === this.alpha) ? 0 : undefined; - }; - return Color; -}(node_1.default)); -Color.prototype.type = 'Color'; -function clamp(v, max) { - return Math.min(Math.max(v, 0), max); -} -function toHex(v) { - return "#" + v.map(function (c) { - c = clamp(Math.round(c), 255); - return (c < 16 ? '0' : '') + c.toString(16); - }).join(''); -} -Color.fromKeyword = function (keyword) { - var c; - var key = keyword.toLowerCase(); - if (colors_1.default.hasOwnProperty(key)) { - c = new Color(colors_1.default[key].slice(1)); - } - else if (key === 'transparent') { - c = new Color([0, 0, 0], 0); - } - if (c) { - c.value = keyword; - return c; - } -}; -exports.default = Color; -//# sourceMappingURL=color.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/color.js.map b/packages/less/lib/less/tree/color.js.map deleted file mode 100644 index d2a4dbcf4..000000000 --- a/packages/less/lib/less/tree/color.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"color.js","sourceRoot":"","sources":["../../../src/less/tree/color.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0DAAoC;AAEpC,EAAE;AACF,6BAA6B;AAC7B,EAAE;AACF;IAAoB,yBAAI;IACpB,eAAY,GAAG,EAAE,CAAC,EAAE,YAAY;QAAhC,YACI,iBAAO,SAkCV;QAhCG,IAAM,IAAI,GAAG,KAAI,CAAC;QAClB,EAAE;QACF,+CAA+C;QAC/C,iDAAiD;QACjD,EAAE;QACF,+CAA+C;QAC/C,EAAE;QACF,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACpB,KAAI,CAAC,GAAG,GAAG,GAAG,CAAC;SAClB;aAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE;YACxB,KAAI,CAAC,GAAG,GAAG,EAAE,CAAC;YACd,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,GAAG,CAAC,EAAE;oBACP,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;iBAClC;qBAAM;oBACH,IAAI,CAAC,KAAK,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;iBACxC;YACL,CAAC,CAAC,CAAC;SACN;aAAM;YACH,KAAI,CAAC,GAAG,GAAG,EAAE,CAAC;YACd,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,GAAG,CAAC,EAAE;oBACP,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAA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AC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAG,CAAC;AAClB,CAAC;AAED,KAAK,CAAC,WAAW,GAAG,UAAA,OAAO;IACvB,IAAI,CAAC,CAAC;IACN,IAAM,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,gBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QAC5B,CAAC,GAAG,IAAI,KAAK,CAAC,gBAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KACvC;SACI,IAAI,GAAG,KAAK,aAAa,EAAE;QAC5B,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC/B;IAED,IAAI,CAAC,EAAE;QACH,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC;QAClB,OAAO,CAAC,CAAC;KACZ;AACL,CAAC,CAAC;AACF,kBAAe,KAAK,CAAC","sourcesContent":["import Node from './node';\nimport colors from '../data/colors';\n\n//\n// RGB Colors - #ff0014, #eee\n//\nclass Color extends Node {\n constructor(rgb, a, originalForm) {\n super();\n\n const self = this;\n //\n // The end goal here, is to parse the arguments\n // into an integer triplet, such as `128, 255, 0`\n //\n // This facilitates operations and conversions.\n //\n if (Array.isArray(rgb)) {\n this.rgb = rgb;\n } else if (rgb.length >= 6) {\n this.rgb = [];\n rgb.match(/.{2}/g).map((c, i) => {\n if (i < 3) {\n self.rgb.push(parseInt(c, 16));\n } else {\n self.alpha = (parseInt(c, 16)) / 255;\n }\n });\n } else {\n this.rgb = [];\n rgb.split('').map((c, i) => {\n if (i < 3) {\n self.rgb.push(parseInt(c + c, 16));\n } else {\n self.alpha = (parseInt(c + c, 16)) / 255;\n }\n });\n }\n this.alpha = this.alpha || (typeof a === 'number' ? a : 1);\n if (typeof originalForm !== 'undefined') {\n this.value = originalForm;\n }\n }\n\n luma() {\n let r = this.rgb[0] / 255;\n let g = this.rgb[1] / 255;\n let b = this.rgb[2] / 255;\n\n r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);\n g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);\n b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);\n\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n }\n\n genCSS(context, output) {\n output.add(this.toCSS(context));\n }\n\n toCSS(context, doNotCompress) {\n const compress = context && context.compress && !doNotCompress;\n let color;\n let alpha;\n let colorFunction;\n let args = [];\n\n // `value` is set if this color was originally\n // converted from a named color string so we need\n // to respect this and try to output named color too.\n alpha = this.fround(context, this.alpha);\n\n if (this.value) {\n if (this.value.indexOf('rgb') === 0) {\n if (alpha < 1) {\n colorFunction = 'rgba';\n }\n } else if (this.value.indexOf('hsl') === 0) {\n if (alpha < 1) {\n colorFunction = 'hsla';\n } else {\n colorFunction = 'hsl';\n }\n } else {\n return this.value;\n }\n } else {\n if (alpha < 1) {\n colorFunction = 'rgba';\n }\n }\n\n switch (colorFunction) {\n case 'rgba':\n args = this.rgb.map(c => clamp(Math.round(c), 255)).concat(clamp(alpha, 1));\n break;\n case 'hsla':\n args.push(clamp(alpha, 1));\n case 'hsl':\n color = this.toHSL();\n args = [\n this.fround(context, color.h),\n `${this.fround(context, color.s * 100)}%`,\n `${this.fround(context, color.l * 100)}%`\n ].concat(args);\n }\n\n if (colorFunction) {\n // Values are capped between `0` and `255`, rounded and zero-padded.\n return `${colorFunction}(${args.join(`,${compress ? '' : ' '}`)})`;\n }\n\n color = this.toRGB();\n\n if (compress) {\n const splitcolor = color.split('');\n\n // Convert color to short format\n if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) {\n color = `#${splitcolor[1]}${splitcolor[3]}${splitcolor[5]}`;\n }\n }\n\n return color;\n }\n\n //\n // Operations have to be done per-channel, if not,\n // channels will spill onto each other. Once we have\n // our result, in the form of an integer triplet,\n // we create a new Color node to hold the result.\n //\n operate(context, op, other) {\n const rgb = new Array(3);\n const alpha = this.alpha * (1 - other.alpha) + other.alpha;\n for (let c = 0; c < 3; c++) {\n rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);\n }\n return new Color(rgb, alpha);\n }\n\n toRGB() {\n return toHex(this.rgb);\n }\n\n toHSL() {\n const r = this.rgb[0] / 255;\n const g = this.rgb[1] / 255;\n const b = this.rgb[2] / 255;\n const a = this.alpha;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h;\n let s;\n const l = (max + min) / 2;\n const d = max - min;\n\n if (max === min) {\n h = s = 0;\n } else {\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h * 360, s, l, a };\n }\n\n // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript\n toHSV() {\n const r = this.rgb[0] / 255;\n const g = this.rgb[1] / 255;\n const b = this.rgb[2] / 255;\n const a = this.alpha;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h;\n let s;\n const v = max;\n\n const d = max - min;\n if (max === 0) {\n s = 0;\n } else {\n s = d / max;\n }\n\n if (max === min) {\n h = 0;\n } else {\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h * 360, s, v, a };\n }\n\n toARGB() {\n return toHex([this.alpha * 255].concat(this.rgb));\n }\n\n compare(x) {\n return (x.rgb &&\n x.rgb[0] === this.rgb[0] &&\n x.rgb[1] === this.rgb[1] &&\n x.rgb[2] === this.rgb[2] &&\n x.alpha === this.alpha) ? 0 : undefined;\n }\n}\n\nColor.prototype.type = 'Color';\n\nfunction clamp(v, max) {\n return Math.min(Math.max(v, 0), max);\n}\n\nfunction toHex(v) {\n return `#${v.map(c => {\n c = clamp(Math.round(c), 255);\n return (c < 16 ? '0' : '') + c.toString(16);\n }).join('')}`;\n}\n\nColor.fromKeyword = keyword => {\n let c;\n const key = keyword.toLowerCase();\n if (colors.hasOwnProperty(key)) {\n c = new Color(colors[key].slice(1));\n }\n else if (key === 'transparent') {\n c = new Color([0, 0, 0], 0);\n }\n\n if (c) {\n c.value = keyword;\n return c;\n }\n};\nexport default Color;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/combinator.js b/packages/less/lib/less/tree/combinator.js deleted file mode 100644 index dfb22ffcb..000000000 --- a/packages/less/lib/less/tree/combinator.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var _noSpaceCombinators = { - '': true, - ' ': true, - '|': true -}; -var Combinator = /** @class */ (function (_super) { - __extends(Combinator, _super); - function Combinator(value) { - var _this = _super.call(this) || this; - if (value === ' ') { - _this.value = ' '; - _this.emptyOrWhitespace = true; - } - else { - _this.value = value ? value.trim() : ''; - _this.emptyOrWhitespace = _this.value === ''; - } - return _this; - } - Combinator.prototype.genCSS = function (context, output) { - var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' '; - output.add(spaceOrEmpty + this.value + spaceOrEmpty); - }; - return Combinator; -}(node_1.default)); -Combinator.prototype.type = 'Combinator'; -exports.default = Combinator; -//# sourceMappingURL=combinator.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/combinator.js.map b/packages/less/lib/less/tree/combinator.js.map deleted file mode 100644 index f98b5c8e3..000000000 --- a/packages/less/lib/less/tree/combinator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"combinator.js","sourceRoot":"","sources":["../../../src/less/tree/combinator.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,IAAM,mBAAmB,GAAG;IACxB,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;CACZ,CAAC;AAEF;IAAyB,8BAAI;IACzB,oBAAY,KAAK;QAAjB,YACI,iBAAO,SASV;QAPG,IAAI,KAAK,KAAK,GAAG,EAAE;YACf,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC;YACjB,KAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SACjC;aAAM;YACH,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,KAAI,CAAC,iBAAiB,GAAG,KAAI,CAAC,KAAK,KAAK,EAAE,CAAC;SAC9C;;IACL,CAAC;IAED,2BAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,IAAM,YAAY,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACtF,MAAM,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,CAAC;IACzD,CAAC;IACL,iBAAC;AAAD,CAAC,AAjBD,CAAyB,cAAI,GAiB5B;AAED,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,YAAY,CAAC;AAEzC,kBAAe,UAAU,CAAC","sourcesContent":["import Node from './node';\nconst _noSpaceCombinators = {\n '': true,\n ' ': true,\n '|': true\n};\n\nclass Combinator extends Node {\n constructor(value) {\n super();\n\n if (value === ' ') {\n this.value = ' ';\n this.emptyOrWhitespace = true;\n } else {\n this.value = value ? value.trim() : '';\n this.emptyOrWhitespace = this.value === '';\n }\n }\n\n genCSS(context, output) {\n const spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';\n output.add(spaceOrEmpty + this.value + spaceOrEmpty);\n }\n}\n\nCombinator.prototype.type = 'Combinator';\n\nexport default Combinator;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/comment.js b/packages/less/lib/less/tree/comment.js deleted file mode 100644 index 7a2cfef08..000000000 --- a/packages/less/lib/less/tree/comment.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var debug_info_1 = __importDefault(require("./debug-info")); -var Comment = /** @class */ (function (_super) { - __extends(Comment, _super); - function Comment(value, isLineComment, index, currentFileInfo) { - var _this = _super.call(this) || this; - _this.value = value; - _this.isLineComment = isLineComment; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.allowRoot = true; - return _this; - } - Comment.prototype.genCSS = function (context, output) { - if (this.debugInfo) { - output.add(debug_info_1.default(context, this), this.fileInfo(), this.getIndex()); - } - output.add(this.value); - }; - Comment.prototype.isSilent = function (context) { - var isCompressed = context.compress && this.value[2] !== '!'; - return this.isLineComment || isCompressed; - }; - return Comment; -}(node_1.default)); -Comment.prototype.type = 'Comment'; -exports.default = Comment; -//# sourceMappingURL=comment.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/comment.js.map b/packages/less/lib/less/tree/comment.js.map deleted file mode 100644 index bfae4b855..000000000 --- a/packages/less/lib/less/tree/comment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/less/tree/comment.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,4DAAwC;AAExC;IAAsB,2BAAI;IACtB,iBAAY,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe;QAAxD,YACI,iBAAO,SAOV;QALG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;;IAC1B,CAAC;IAED,wBAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,MAAM,CAAC,GAAG,CAAC,oBAAY,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC7E;QACD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,0BAAQ,GAAR,UAAS,OAAO;QACZ,IAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;QAC/D,OAAO,IAAI,CAAC,aAAa,IAAI,YAAY,CAAC;IAC9C,CAAC;IACL,cAAC;AAAD,CAAC,AAtBD,CAAsB,cAAI,GAsBzB;AAED,OAAO,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC;AACnC,kBAAe,OAAO,CAAC","sourcesContent":["import Node from './node';\nimport getDebugInfo from './debug-info';\n\nclass Comment extends Node {\n constructor(value, isLineComment, index, currentFileInfo) {\n super();\n\n this.value = value;\n this.isLineComment = isLineComment;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.allowRoot = true;\n }\n\n genCSS(context, output) {\n if (this.debugInfo) {\n output.add(getDebugInfo(context, this), this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n }\n\n isSilent(context) {\n const isCompressed = context.compress && this.value[2] !== '!';\n return this.isLineComment || isCompressed;\n }\n}\n\nComment.prototype.type = 'Comment';\nexport default Comment;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/condition.js b/packages/less/lib/less/tree/condition.js deleted file mode 100644 index 52f0b3b1d..000000000 --- a/packages/less/lib/less/tree/condition.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var Condition = /** @class */ (function (_super) { - __extends(Condition, _super); - function Condition(op, l, r, i, negate) { - var _this = _super.call(this) || this; - _this.op = op.trim(); - _this.lvalue = l; - _this.rvalue = r; - _this._index = i; - _this.negate = negate; - return _this; - } - Condition.prototype.accept = function (visitor) { - this.lvalue = visitor.visit(this.lvalue); - this.rvalue = visitor.visit(this.rvalue); - }; - Condition.prototype.eval = function (context) { - var result = (function (op, a, b) { - switch (op) { - case 'and': return a && b; - case 'or': return a || b; - default: - switch (node_1.default.compare(a, b)) { - case -1: - return op === '<' || op === '=<' || op === '<='; - case 0: - return op === '=' || op === '>=' || op === '=<' || op === '<='; - case 1: - return op === '>' || op === '>='; - default: - return false; - } - } - })(this.op, this.lvalue.eval(context), this.rvalue.eval(context)); - return this.negate ? !result : result; - }; - return Condition; -}(node_1.default)); -Condition.prototype.type = 'Condition'; -exports.default = Condition; -//# sourceMappingURL=condition.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/condition.js.map b/packages/less/lib/less/tree/condition.js.map deleted file mode 100644 index 15623c40e..000000000 --- a/packages/less/lib/less/tree/condition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../src/less/tree/condition.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAwB,6BAAI;IACxB,mBAAY,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM;QAA/B,YACI,iBAAO,SAOV;QALG,KAAI,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;QACpB,KAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,KAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,KAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAED,0BAAM,GAAN,UAAO,OAAO;QACV,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK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class Condition extends Node {\n constructor(op, l, r, i, negate) {\n super();\n\n this.op = op.trim();\n this.lvalue = l;\n this.rvalue = r;\n this._index = i;\n this.negate = negate;\n }\n\n accept(visitor) {\n this.lvalue = visitor.visit(this.lvalue);\n this.rvalue = visitor.visit(this.rvalue);\n }\n\n eval(context) {\n const result = ((op, a, b) => {\n switch (op) {\n case 'and': return a && b;\n case 'or': return a || b;\n default:\n switch (Node.compare(a, b)) {\n case -1:\n return op === '<' || op === '=<' || op === '<=';\n case 0:\n return op === '=' || op === '>=' || op === '=<' || op === '<=';\n case 1:\n return op === '>' || op === '>=';\n default:\n return false;\n }\n }\n })(this.op, this.lvalue.eval(context), this.rvalue.eval(context));\n\n return this.negate ? !result : result;\n }\n}\n\nCondition.prototype.type = 'Condition';\nexport default Condition;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/debug-info.js b/packages/less/lib/less/tree/debug-info.js deleted file mode 100644 index f594287b5..000000000 --- a/packages/less/lib/less/tree/debug-info.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var debugInfo = function (context, ctx, lineSeparator) { - var result = ''; - if (context.dumpLineNumbers && !context.compress) { - switch (context.dumpLineNumbers) { - case 'comments': - result = debugInfo.asComment(ctx); - break; - case 'mediaquery': - result = debugInfo.asMediaQuery(ctx); - break; - case 'all': - result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx); - break; - } - } - return result; -}; -debugInfo.asComment = function (ctx) { return ctx.debugInfo ? "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n" : ''; }; -debugInfo.asMediaQuery = function (ctx) { - if (!ctx.debugInfo) { - return ''; - } - var filenameWithProtocol = ctx.debugInfo.fileName; - if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { - filenameWithProtocol = "file://" + filenameWithProtocol; - } - return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) { - if (a == '\\') { - a = '\/'; - } - return "\\" + a; - }) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n"; -}; -exports.default = debugInfo; -//# sourceMappingURL=debug-info.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/debug-info.js.map b/packages/less/lib/less/tree/debug-info.js.map deleted file mode 100644 index 756659332..000000000 --- a/packages/less/lib/less/tree/debug-info.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"debug-info.js","sourceRoot":"","sources":["../../../src/less/tree/debug-info.js"],"names":[],"mappings":";;AAAA,IAAM,SAAS,GAAG,UAAC,OAAO,EAAE,GAAG,EAAE,aAAa;IAC1C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,OAAO,CAAC,eAAe,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QAC9C,QAAQ,OAAO,CAAC,eAAe,EAAE;YAC7B,KAAK,UAAU;gBACX,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBAClC,MAAM;YACV,KAAK,YAAY;gBACb,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBACrC,MAAM;YACV,KAAK,KAAK;gBACN,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBACxF,MAAM;SACb;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,SAAS,CAAC,SAAS,GAAG,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,aAAW,GAAG,CAAC,SAAS,CAAC,UAAU,UAAK,GAAG,CAAC,SAAS,CAAC,QAAQ,UAAO,CAAC,CAAC,CAAC,EAAE,EAA1F,CAA0F,CAAC;AAExH,SAAS,CAAC,YAAY,GAAG,UAAA,GAAG;IACxB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;QAAE,OAAO,EAAE,CAAC;KAAE;IAClC,IAAI,oBAAoB,GAAG,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC;IAClD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE;QAC7C,oBAAoB,GAAG,YAAU,oBAAsB,CAAC;KAC3D;IACD,OAAO,kDAAgD,oBAAoB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAA,CAAC;QAChG,IAAI,CAAC,IAAI,IAAI,EAAE;YACX,CAAC,GAAG,IAAI,CAAC;SACZ;QACD,OAAO,OAAK,CAAG,CAAC;IACpB,CAAC,CAAC,iCAA4B,GAAG,CAAC,SAAS,CAAC,UAAU,SAAM,CAAC;AACjE,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["const debugInfo = (context, ctx, lineSeparator) => {\n let result = '';\n if (context.dumpLineNumbers && !context.compress) {\n switch (context.dumpLineNumbers) {\n case 'comments':\n result = debugInfo.asComment(ctx);\n break;\n case 'mediaquery':\n result = debugInfo.asMediaQuery(ctx);\n break;\n case 'all':\n result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);\n break;\n }\n }\n return result;\n};\n\ndebugInfo.asComment = ctx => ctx.debugInfo ? `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\\n` : '';\n\ndebugInfo.asMediaQuery = ctx => {\n if (!ctx.debugInfo) { return ''; }\n let filenameWithProtocol = ctx.debugInfo.fileName;\n if (!/^[a-z]+:\\/\\//i.test(filenameWithProtocol)) {\n filenameWithProtocol = `file://${filenameWithProtocol}`;\n }\n return `@media -sass-debug-info{filename{font-family:${filenameWithProtocol.replace(/([.:\\/\\\\])/g, a => {\n if (a == '\\\\') {\n a = '\\/';\n }\n return `\\\\${a}`;\n })}}line{font-family:\\\\00003${ctx.debugInfo.lineNumber}}}\\n`;\n};\n\nexport default debugInfo;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/declaration.js b/packages/less/lib/less/tree/declaration.js deleted file mode 100644 index 9aca97807..000000000 --- a/packages/less/lib/less/tree/declaration.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var value_1 = __importDefault(require("./value")); -var keyword_1 = __importDefault(require("./keyword")); -var anonymous_1 = __importDefault(require("./anonymous")); -var Constants = __importStar(require("../constants")); -var MATH = Constants.Math; -var Declaration = /** @class */ (function (_super) { - __extends(Declaration, _super); - function Declaration(name, value, important, merge, index, currentFileInfo, inline, variable) { - var _this = _super.call(this) || this; - _this.name = name; - _this.value = (value instanceof node_1.default) ? value : new value_1.default([value ? new anonymous_1.default(value) : null]); - _this.important = important ? " " + important.trim() : ''; - _this.merge = merge; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.inline = inline || false; - _this.variable = (variable !== undefined) ? variable - : (name.charAt && (name.charAt(0) === '@')); - _this.allowRoot = true; - _this.setParent(_this.value, _this); - return _this; - } - Declaration.prototype.genCSS = function (context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex()); - try { - this.value.genCSS(context, output); - } - catch (e) { - e.index = this._index; - e.filename = this._fileInfo.filename; - throw e; - } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index); - }; - Declaration.prototype.eval = function (context) { - var mathBypass = false; - var prevMath; - var name = this.name; - var evaldValue; - var variable = this.variable; - if (typeof name !== 'string') { - // expand 'primitive' name directly to get - // things faster (~10% for benchmark.less): - name = (name.length === 1) && (name[0] instanceof keyword_1.default) ? - name[0].value : evalName(context, name); - variable = false; // never treat expanded interpolation as new variable name - } - // @todo remove when parens-division is default - if (name === 'font' && context.math === MATH.ALWAYS) { - mathBypass = true; - prevMath = context.math; - context.math = MATH.PARENS_DIVISION; - } - try { - context.importantScope.push({}); - evaldValue = this.value.eval(context); - if (!this.variable && evaldValue.type === 'DetachedRuleset') { - throw { message: 'Rulesets cannot be evaluated on a property.', - index: this.getIndex(), filename: this.fileInfo().filename }; - } - var important = this.important; - var importantResult = context.importantScope.pop(); - if (!important && importantResult.important) { - important = importantResult.important; - } - return new Declaration(name, evaldValue, important, this.merge, this.getIndex(), this.fileInfo(), this.inline, variable); - } - catch (e) { - if (typeof e.index !== 'number') { - e.index = this.getIndex(); - e.filename = this.fileInfo().filename; - } - throw e; - } - finally { - if (mathBypass) { - context.math = prevMath; - } - } - }; - Declaration.prototype.makeImportant = function () { - return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline); - }; - return Declaration; -}(node_1.default)); -function evalName(context, name) { - var value = ''; - var i; - var n = name.length; - var output = { add: function (s) { value += s; } }; - for (i = 0; i < n; i++) { - name[i].eval(context).genCSS(context, output); - } - return value; -} -Declaration.prototype.type = 'Declaration'; -exports.default = Declaration; -//# sourceMappingURL=declaration.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/declaration.js.map b/packages/less/lib/less/tree/declaration.js.map deleted file mode 100644 index 04b86ae41..000000000 --- a/packages/less/lib/less/tree/declaration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/less/tree/declaration.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,kDAA4B;AAC5B,sDAAgC;AAChC,0DAAoC;AACpC,sDAA0C;AAC1C,IAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAG5B;IAA0B,+BAAI;IAC1B,qBAAY,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ;QAAnF,YACI,iBAAO,SAaV;QAXG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,KAAK,GAAG,CAAC,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,eAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAChG,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,MAAI,SAAS,CAAC,IAAI,EAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,KAAI,CAAC,MAAM,GAAG,MAAM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,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACpB,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACjD;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,WAAW,CAAC,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;AAC3C,kBAAe,WAAW,CAAC","sourcesContent":["import Node from './node';\nimport Value from './value';\nimport Keyword from './keyword';\nimport Anonymous from './anonymous';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\n\nclass Declaration extends Node {\n constructor(name, value, important, merge, index, currentFileInfo, inline, variable) {\n super();\n\n this.name = name;\n this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]);\n this.important = important ? ` ${important.trim()}` : '';\n this.merge = merge;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.inline = inline || false;\n this.variable = (variable !== undefined) ? variable\n : (name.charAt && (name.charAt(0) === '@'));\n this.allowRoot = true;\n this.setParent(this.value, this);\n }\n\n genCSS(context, output) {\n output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());\n try {\n this.value.genCSS(context, output);\n }\n catch (e) {\n e.index = this._index;\n e.filename = this._fileInfo.filename;\n throw e;\n }\n output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);\n }\n\n eval(context) {\n let mathBypass = false;\n let prevMath;\n let name = this.name;\n let evaldValue;\n let variable = this.variable;\n if (typeof name !== 'string') {\n // expand 'primitive' name directly to get\n // things faster (~10% for benchmark.less):\n name = (name.length === 1) && (name[0] instanceof Keyword) ?\n name[0].value : evalName(context, name);\n variable = false; // never treat expanded interpolation as new variable name\n }\n\n // @todo remove when parens-division is default\n if (name === 'font' && context.math === MATH.ALWAYS) {\n mathBypass = true;\n prevMath = context.math;\n context.math = MATH.PARENS_DIVISION;\n }\n try {\n context.importantScope.push({});\n evaldValue = this.value.eval(context);\n\n if (!this.variable && evaldValue.type === 'DetachedRuleset') {\n throw { message: 'Rulesets cannot be evaluated on a property.',\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n let important = this.important;\n const importantResult = context.importantScope.pop();\n if (!important && importantResult.important) {\n important = importantResult.important;\n }\n\n return new Declaration(name,\n evaldValue,\n important,\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline,\n variable);\n }\n catch (e) {\n if (typeof e.index !== 'number') {\n e.index = this.getIndex();\n e.filename = this.fileInfo().filename;\n }\n throw e;\n }\n finally {\n if (mathBypass) {\n context.math = prevMath;\n }\n }\n }\n\n makeImportant() {\n return new Declaration(this.name,\n this.value,\n '!important',\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline);\n }\n}\n\nfunction evalName(context, name) {\n let value = '';\n let i;\n const n = name.length;\n const output = {add: function (s) {value += s;}};\n for (i = 0; i < n; i++) {\n name[i].eval(context).genCSS(context, output);\n }\n return value;\n}\n\nDeclaration.prototype.type = 'Declaration';\nexport default Declaration;"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/detached-ruleset.js b/packages/less/lib/less/tree/detached-ruleset.js deleted file mode 100644 index e9e067786..000000000 --- a/packages/less/lib/less/tree/detached-ruleset.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var contexts_1 = __importDefault(require("../contexts")); -var utils = __importStar(require("../utils")); -var DetachedRuleset = /** @class */ (function (_super) { - __extends(DetachedRuleset, _super); - function DetachedRuleset(ruleset, frames) { - var _this = _super.call(this) || this; - _this.ruleset = ruleset; - _this.frames = frames; - _this.setParent(_this.ruleset, _this); - return _this; - } - DetachedRuleset.prototype.accept = function (visitor) { - this.ruleset = visitor.visit(this.ruleset); - }; - DetachedRuleset.prototype.eval = function (context) { - var frames = this.frames || utils.copyArray(context.frames); - return new DetachedRuleset(this.ruleset, frames); - }; - DetachedRuleset.prototype.callEval = function (context) { - return this.ruleset.eval(this.frames ? new contexts_1.default.Eval(context, this.frames.concat(context.frames)) : context); - }; - return DetachedRuleset; -}(node_1.default)); -DetachedRuleset.prototype.type = 'DetachedRuleset'; -DetachedRuleset.prototype.evalFirst = true; -exports.default = DetachedRuleset; -//# sourceMappingURL=detached-ruleset.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/detached-ruleset.js.map b/packages/less/lib/less/tree/detached-ruleset.js.map deleted file mode 100644 index 955ada60d..000000000 --- a/packages/less/lib/less/tree/detached-ruleset.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"detached-ruleset.js","sourceRoot":"","sources":["../../../src/less/tree/detached-ruleset.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,yDAAmC;AACnC,8CAAkC;AAElC;IAA8B,mCAAI;IAC9B,yBAAY,OAAO,EAAE,MAAM;QAA3B,YACI,iBAAO,SAKV;QAHG,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,OAAO,EAAE,KAAI,CAAC,CAAC;;IACvC,CAAC;IAED,gCAAM,GAAN,UAAO,OAAO;QACV,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,8BAAI,GAAJ,UAAK,OAAO;QACR,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,kCAAQ,GAAR,UAAS,OAAO;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,kBAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACrH,CAAC;IACL,sBAAC;AAAD,CAAC,AArBD,CAA8B,cAAI,GAqBjC;AAED,eAAe,CAAC,SAAS,CAAC,IAAI,GAAG,iBAAiB,CAAC;AACnD,eAAe,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;AAC3C,kBAAe,eAAe,CAAC","sourcesContent":["import Node from './node';\nimport contexts from '../contexts';\nimport * as utils from '../utils';\n\nclass DetachedRuleset extends Node {\n constructor(ruleset, frames) {\n super();\n\n this.ruleset = ruleset;\n this.frames = frames;\n this.setParent(this.ruleset, this);\n }\n\n accept(visitor) {\n this.ruleset = visitor.visit(this.ruleset);\n }\n\n eval(context) {\n const frames = this.frames || utils.copyArray(context.frames);\n return new DetachedRuleset(this.ruleset, frames);\n }\n\n callEval(context) {\n return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context);\n }\n}\n\nDetachedRuleset.prototype.type = 'DetachedRuleset';\nDetachedRuleset.prototype.evalFirst = true;\nexport default DetachedRuleset;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/dimension.js b/packages/less/lib/less/tree/dimension.js deleted file mode 100644 index d21538703..000000000 --- a/packages/less/lib/less/tree/dimension.js +++ /dev/null @@ -1,177 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var unit_conversions_1 = __importDefault(require("../data/unit-conversions")); -var unit_1 = __importDefault(require("./unit")); -var color_1 = __importDefault(require("./color")); -// -// A number with a unit -// -var Dimension = /** @class */ (function (_super) { - __extends(Dimension, _super); - function Dimension(value, unit) { - var _this = _super.call(this) || this; - _this.value = parseFloat(value); - if (isNaN(_this.value)) { - throw new Error('Dimension is not a number.'); - } - _this.unit = (unit && unit instanceof unit_1.default) ? unit : - new unit_1.default(unit ? [unit] : undefined); - _this.setParent(_this.unit, _this); - return _this; - } - Dimension.prototype.accept = function (visitor) { - this.unit = visitor.visit(this.unit); - }; - Dimension.prototype.eval = function (context) { - return this; - }; - Dimension.prototype.toColor = function () { - return new color_1.default([this.value, this.value, this.value]); - }; - Dimension.prototype.genCSS = function (context, output) { - if ((context && context.strictUnits) && !this.unit.isSingular()) { - throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString()); - } - var value = this.fround(context, this.value); - var strValue = String(value); - if (value !== 0 && value < 0.000001 && value > -0.000001) { - // would be output 1e-6 etc. - strValue = value.toFixed(20).replace(/0+$/, ''); - } - if (context && context.compress) { - // Zero values doesn't need a unit - if (value === 0 && this.unit.isLength()) { - output.add(strValue); - return; - } - // Float values doesn't need a leading zero - if (value > 0 && value < 1) { - strValue = (strValue).substr(1); - } - } - output.add(strValue); - this.unit.genCSS(context, output); - }; - // In an operation between two Dimensions, - // we default to the first Dimension's unit, - // so `1px + 2` will yield `3px`. - Dimension.prototype.operate = function (context, op, other) { - /* jshint noempty:false */ - var value = this._operate(context, op, this.value, other.value); - var unit = this.unit.clone(); - if (op === '+' || op === '-') { - if (unit.numerator.length === 0 && unit.denominator.length === 0) { - unit = other.unit.clone(); - if (this.unit.backupUnit) { - unit.backupUnit = this.unit.backupUnit; - } - } - else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) { - // do nothing - } - else { - other = other.convertTo(this.unit.usedUnits()); - if (context.strictUnits && other.unit.toString() !== unit.toString()) { - throw new Error("Incompatible units. Change the units or use the unit function. " + - ("Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'.")); - } - value = this._operate(context, op, this.value, other.value); - } - } - else if (op === '*') { - unit.numerator = unit.numerator.concat(other.unit.numerator).sort(); - unit.denominator = unit.denominator.concat(other.unit.denominator).sort(); - unit.cancel(); - } - else if (op === '/') { - unit.numerator = unit.numerator.concat(other.unit.denominator).sort(); - unit.denominator = unit.denominator.concat(other.unit.numerator).sort(); - unit.cancel(); - } - return new Dimension(value, unit); - }; - Dimension.prototype.compare = function (other) { - var a; - var b; - if (!(other instanceof Dimension)) { - return undefined; - } - if (this.unit.isEmpty() || other.unit.isEmpty()) { - a = this; - b = other; - } - else { - a = this.unify(); - b = other.unify(); - if (a.unit.compare(b.unit) !== 0) { - return undefined; - } - } - return node_1.default.numericCompare(a.value, b.value); - }; - Dimension.prototype.unify = function () { - return this.convertTo({ length: 'px', duration: 's', angle: 'rad' }); - }; - Dimension.prototype.convertTo = function (conversions) { - var value = this.value; - var unit = this.unit.clone(); - var i; - var groupName; - var group; - var targetUnit; - var derivedConversions = {}; - var applyUnit; - if (typeof conversions === 'string') { - for (i in unit_conversions_1.default) { - if (unit_conversions_1.default[i].hasOwnProperty(conversions)) { - derivedConversions = {}; - derivedConversions[i] = conversions; - } - } - conversions = derivedConversions; - } - applyUnit = function (atomicUnit, denominator) { - /* jshint loopfunc:true */ - if (group.hasOwnProperty(atomicUnit)) { - if (denominator) { - value = value / (group[atomicUnit] / group[targetUnit]); - } - else { - value = value * (group[atomicUnit] / group[targetUnit]); - } - return targetUnit; - } - return atomicUnit; - }; - for (groupName in conversions) { - if (conversions.hasOwnProperty(groupName)) { - targetUnit = conversions[groupName]; - group = unit_conversions_1.default[groupName]; - unit.map(applyUnit); - } - } - unit.cancel(); - return new Dimension(value, unit); - }; - return Dimension; -}(node_1.default)); -Dimension.prototype.type = 'Dimension'; -exports.default = Dimension; -//# sourceMappingURL=dimension.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/dimension.js.map b/packages/less/lib/less/tree/dimension.js.map deleted file mode 100644 index 10a9a5202..000000000 --- a/packages/less/lib/less/tree/dimension.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dimension.js","sourceRoot":"","sources":["../../../src/less/tree/dimension.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,8EAAuD;AACvD,gDAA0B;AAC1B,kDAA4B;AAE5B,EAAE;AACF,uBAAuB;AACvB,EAAE;AACF;IAAwB,6BAAI;IACxB,mBAAY,KAAK,EAAE,IAA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AC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IACL,gBAAC;AAAD,CAAC,AAvKD,CAAwB,cAAI,GAuK3B;AAED,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,WAAW,CAAC;AACvC,kBAAe,SAAS,CAAC","sourcesContent":["import Node from './node';\nimport unitConversions from '../data/unit-conversions';\nimport Unit from './unit';\nimport Color from './color';\n\n//\n// A number with a unit\n//\nclass Dimension extends Node {\n constructor(value, unit) {\n super();\n\n this.value = parseFloat(value);\n if (isNaN(this.value)) {\n throw new Error('Dimension is not a number.');\n }\n this.unit = (unit && unit instanceof Unit) ? unit :\n new Unit(unit ? [unit] : undefined);\n this.setParent(this.unit, this);\n }\n\n accept(visitor) {\n this.unit = visitor.visit(this.unit);\n }\n\n eval(context) {\n return this;\n }\n\n toColor() {\n return new Color([this.value, this.value, this.value]);\n }\n\n genCSS(context, output) {\n if ((context && context.strictUnits) && !this.unit.isSingular()) {\n throw new Error(`Multiple units in dimension. Correct the units or use the unit function. Bad unit: ${this.unit.toString()}`);\n }\n\n const value = this.fround(context, this.value);\n let strValue = String(value);\n\n if (value !== 0 && value < 0.000001 && value > -0.000001) {\n // would be output 1e-6 etc.\n strValue = value.toFixed(20).replace(/0+$/, '');\n }\n\n if (context && context.compress) {\n // Zero values doesn't need a unit\n if (value === 0 && this.unit.isLength()) {\n output.add(strValue);\n return;\n }\n\n // Float values doesn't need a leading zero\n if (value > 0 && value < 1) {\n strValue = (strValue).substr(1);\n }\n }\n\n output.add(strValue);\n this.unit.genCSS(context, output);\n }\n\n // In an operation between two Dimensions,\n // we default to the first Dimension's unit,\n // so `1px + 2` will yield `3px`.\n operate(context, op, other) {\n /* jshint noempty:false */\n let value = this._operate(context, op, this.value, other.value);\n\n let unit = this.unit.clone();\n\n if (op === '+' || op === '-') {\n if (unit.numerator.length === 0 && unit.denominator.length === 0) {\n unit = other.unit.clone();\n if (this.unit.backupUnit) {\n unit.backupUnit = this.unit.backupUnit;\n }\n } else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {\n // do nothing\n } else {\n other = other.convertTo(this.unit.usedUnits());\n\n if (context.strictUnits && other.unit.toString() !== unit.toString()) {\n throw new Error(`Incompatible units. Change the units or use the unit function. ` + \n `Bad units: '${unit.toString()}' and '${other.unit.toString()}'.`);\n }\n\n value = this._operate(context, op, this.value, other.value);\n }\n } else if (op === '*') {\n unit.numerator = unit.numerator.concat(other.unit.numerator).sort();\n unit.denominator = unit.denominator.concat(other.unit.denominator).sort();\n unit.cancel();\n } else if (op === '/') {\n unit.numerator = unit.numerator.concat(other.unit.denominator).sort();\n unit.denominator = unit.denominator.concat(other.unit.numerator).sort();\n unit.cancel();\n }\n return new Dimension(value, unit);\n }\n\n compare(other) {\n let a;\n let b;\n\n if (!(other instanceof Dimension)) {\n return undefined;\n }\n\n if (this.unit.isEmpty() || other.unit.isEmpty()) {\n a = this;\n b = other;\n } else {\n a = this.unify();\n b = other.unify();\n if (a.unit.compare(b.unit) !== 0) {\n return undefined;\n }\n }\n\n return Node.numericCompare(a.value, b.value);\n }\n\n unify() {\n return this.convertTo({ length: 'px', duration: 's', angle: 'rad' });\n }\n\n convertTo(conversions) {\n let value = this.value;\n const unit = this.unit.clone();\n let i;\n let groupName;\n let group;\n let targetUnit;\n let derivedConversions = {};\n let applyUnit;\n\n if (typeof conversions === 'string') {\n for (i in unitConversions) {\n if (unitConversions[i].hasOwnProperty(conversions)) {\n derivedConversions = {};\n derivedConversions[i] = conversions;\n }\n }\n conversions = derivedConversions;\n }\n applyUnit = (atomicUnit, denominator) => {\n /* jshint loopfunc:true */\n if (group.hasOwnProperty(atomicUnit)) {\n if (denominator) {\n value = value / (group[atomicUnit] / group[targetUnit]);\n } else {\n value = value * (group[atomicUnit] / group[targetUnit]);\n }\n\n return targetUnit;\n }\n\n return atomicUnit;\n };\n\n for (groupName in conversions) {\n if (conversions.hasOwnProperty(groupName)) {\n targetUnit = conversions[groupName];\n group = unitConversions[groupName];\n\n unit.map(applyUnit);\n }\n }\n\n unit.cancel();\n\n return new Dimension(value, unit);\n }\n}\n\nDimension.prototype.type = 'Dimension';\nexport default Dimension;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/element.js b/packages/less/lib/less/tree/element.js deleted file mode 100644 index d96ba2d2d..000000000 --- a/packages/less/lib/less/tree/element.js +++ /dev/null @@ -1,82 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var paren_1 = __importDefault(require("./paren")); -var combinator_1 = __importDefault(require("./combinator")); -var Element = /** @class */ (function (_super) { - __extends(Element, _super); - function Element(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) { - var _this = _super.call(this) || this; - _this.combinator = combinator instanceof combinator_1.default ? - combinator : new combinator_1.default(combinator); - if (typeof value === 'string') { - _this.value = value.trim(); - } - else if (value) { - _this.value = value; - } - else { - _this.value = ''; - } - _this.isVariable = isVariable; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.copyVisibilityInfo(visibilityInfo); - _this.setParent(_this.combinator, _this); - return _this; - } - Element.prototype.accept = function (visitor) { - var value = this.value; - this.combinator = visitor.visit(this.combinator); - if (typeof value === 'object') { - this.value = visitor.visit(value); - } - }; - Element.prototype.eval = function (context) { - return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }; - Element.prototype.clone = function () { - return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }; - Element.prototype.genCSS = function (context, output) { - output.add(this.toCSS(context), this.fileInfo(), this.getIndex()); - }; - Element.prototype.toCSS = function (context) { - if (context === void 0) { context = {}; } - var value = this.value; - var firstSelector = context.firstSelector; - if (value instanceof paren_1.default) { - // selector in parens should not be affected by outer selector - // flags (breaks only interpolated selectors - see #1973) - context.firstSelector = true; - } - value = value.toCSS ? value.toCSS(context) : value; - context.firstSelector = firstSelector; - if (value === '' && this.combinator.value.charAt(0) === '&') { - return ''; - } - else { - return this.combinator.toCSS(context) + value; - } - }; - return Element; -}(node_1.default)); -Element.prototype.type = 'Element'; -exports.default = Element; -//# sourceMappingURL=element.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/element.js.map b/packages/less/lib/less/tree/element.js.map deleted file mode 100644 index 1cd318444..000000000 --- a/packages/less/lib/less/tree/element.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/less/tree/element.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,kDAA4B;AAC5B,4DAAsC;AAEtC;IAAsB,2BAAI;IACtB,iBAAY,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc;QAAjF,YACI,iBAAO,SAiBV;QAfG,KAAI,CAAC,UAAU,GAAG,UAAU,YAAY,oBAAU,CAAC,CAAC;YAChD,UAAU,CAAC,CAAC,CAAC,IAAI,oBAAU,CAAC,UAAU,CAAC,CAAC;QAE5C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC3B,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;SAC7B;aAAM,IAAI,KAAK,EAAE;YACd,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;aAAM;YACH,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;S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AAK,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,uBAAK,GAAL,UAAM,OAAY;QAAZ,wBAAA,EAAA,YAAY;QACd,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,IAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC5C,IAAI,KAAK,YAAY,eAAK,EAAE;YACxB,8DAA8D;YAC9D,yDAAyD;YACzD,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;SAChC;QACD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnD,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;QACtC,IAAI,KAAK,KAAK,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACzD,OAAO,EAAE,CAAC;SACb;aAAM;YACH,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;SACjD;IACL,CAAC;IACL,cAAC;AAAD,CAAC,AAjED,CAAsB,cAAI,GAiEzB;AAED,OAAO,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC;AACnC,kBAAe,OAAO,CAAC","sourcesContent":["import Node from './node';\nimport Paren from './paren';\nimport Combinator from './combinator';\n\nclass Element extends Node {\n constructor(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {\n super();\n\n this.combinator = combinator instanceof Combinator ?\n combinator : new Combinator(combinator);\n\n if (typeof value === 'string') {\n this.value = value.trim();\n } else if (value) {\n this.value = value;\n } else {\n this.value = '';\n }\n this.isVariable = isVariable;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.combinator, this);\n }\n\n accept(visitor) {\n const value = this.value;\n this.combinator = visitor.visit(this.combinator);\n if (typeof value === 'object') {\n this.value = visitor.visit(value);\n }\n }\n\n eval(context) {\n return new Element(this.combinator,\n this.value.eval ? this.value.eval(context) : this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n }\n\n clone() {\n return new Element(this.combinator,\n this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n }\n\n genCSS(context, output) {\n output.add(this.toCSS(context), this.fileInfo(), this.getIndex());\n }\n\n toCSS(context = {}) {\n let value = this.value;\n const firstSelector = context.firstSelector;\n if (value instanceof Paren) {\n // selector in parens should not be affected by outer selector\n // flags (breaks only interpolated selectors - see #1973)\n context.firstSelector = true;\n }\n value = value.toCSS ? value.toCSS(context) : value;\n context.firstSelector = firstSelector;\n if (value === '' && this.combinator.value.charAt(0) === '&') {\n return '';\n } else {\n return this.combinator.toCSS(context) + value;\n }\n }\n}\n\nElement.prototype.type = 'Element';\nexport default Element;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/expression.js b/packages/less/lib/less/tree/expression.js deleted file mode 100644 index 74178eba7..000000000 --- a/packages/less/lib/less/tree/expression.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var paren_1 = __importDefault(require("./paren")); -var comment_1 = __importDefault(require("./comment")); -var dimension_1 = __importDefault(require("./dimension")); -var Constants = __importStar(require("../constants")); -var MATH = Constants.Math; -var Expression = /** @class */ (function (_super) { - __extends(Expression, _super); - function Expression(value, noSpacing) { - var _this = _super.call(this) || this; - _this.value = value; - _this.noSpacing = noSpacing; - if (!value) { - throw new Error('Expression requires an array parameter'); - } - return _this; - } - Expression.prototype.accept = function (visitor) { - this.value = visitor.visitArray(this.value); - }; - Expression.prototype.eval = function (context) { - var returnValue; - var mathOn = context.isMathOn(); - var inParenthesis = this.parens && - (context.math !== MATH.STRICT_LEGACY || !this.parensInOp); - var doubleParen = false; - if (inParenthesis) { - context.inParenthesis(); - } - if (this.value.length > 1) { - returnValue = new Expression(this.value.map(function (e) { - if (!e.eval) { - return e; - } - return e.eval(context); - }), this.noSpacing); - } - else if (this.value.length === 1) { - if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) { - doubleParen = true; - } - returnValue = this.value[0].eval(context); - } - else { - returnValue = this; - } - if (inParenthesis) { - context.outOfParenthesis(); - } - if (this.parens && this.parensInOp && !mathOn && !doubleParen - && (!(returnValue instanceof dimension_1.default))) { - returnValue = new paren_1.default(returnValue); - } - return returnValue; - }; - Expression.prototype.genCSS = function (context, output) { - for (var i = 0; i < this.value.length; i++) { - this.value[i].genCSS(context, output); - if (!this.noSpacing && i + 1 < this.value.length) { - output.add(' '); - } - } - }; - Expression.prototype.throwAwayComments = function () { - this.value = this.value.filter(function (v) { return !(v instanceof comment_1.default); }); - }; - return Expression; -}(node_1.default)); -Expression.prototype.type = 'Expression'; -exports.default = Expression; -//# sourceMappingURL=expression.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/expression.js.map b/packages/less/lib/less/tree/expression.js.map deleted file mode 100644 index 6679b7b8a..000000000 --- a/packages/less/lib/less/tree/expression.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../src/less/tree/expression.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,kDAA4B;AAC5B,sDAAgC;AAChC,0DAAoC;AACpC,sDAA0C;AAC1C,IAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAE5B;IAAyB,8BAAI;IACzB,oBAAY,KAAK,EAAE,SAAS;QAA5B,YACI,iBAAO,SAOV;QALG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC7D;;IACL,CAAC;IAED,2BAAM,GAAN,UAAO,OAAO;QACV,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,yBAAI,GAAJ,UAAK,OAAO;QACR,IAAI,WAAW,CAAC;QAChB,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QAElC,IAAM,aAAa,GAAG,IAAI,CAAC,MAAM;YAC7B,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE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G,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACnB;SACJ;IACL,CAAC;IAED,sCAAiB,GAAjB;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,YAAY,iBAAO,CAAC,EAAvB,CAAuB,CAAC,CAAC;IACjE,CAAC;IACL,iBAAC;AAAD,CAAC,AA/DD,CAAyB,cAAI,GA+D5B;AAED,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,YAAY,CAAC;AACzC,kBAAe,UAAU,CAAC","sourcesContent":["import Node from './node';\nimport Paren from './paren';\nimport Comment from './comment';\nimport Dimension from './dimension';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\nclass Expression extends Node {\n constructor(value, noSpacing) {\n super();\n\n this.value = value;\n this.noSpacing = noSpacing;\n if (!value) {\n throw new Error('Expression requires an array parameter');\n }\n }\n\n accept(visitor) {\n this.value = visitor.visitArray(this.value);\n }\n\n eval(context) {\n let returnValue;\n const mathOn = context.isMathOn();\n\n const inParenthesis = this.parens && \n (context.math !== MATH.STRICT_LEGACY || !this.parensInOp);\n\n let doubleParen = false;\n if (inParenthesis) {\n context.inParenthesis();\n }\n if (this.value.length > 1) {\n returnValue = new Expression(this.value.map(e => {\n if (!e.eval) {\n return e;\n }\n return e.eval(context);\n }), this.noSpacing);\n } else if (this.value.length === 1) {\n if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) {\n doubleParen = true;\n }\n returnValue = this.value[0].eval(context);\n } else {\n returnValue = this;\n }\n if (inParenthesis) {\n context.outOfParenthesis();\n }\n if (this.parens && this.parensInOp && !mathOn && !doubleParen \n && (!(returnValue instanceof Dimension))) {\n returnValue = new Paren(returnValue);\n }\n return returnValue;\n }\n\n genCSS(context, output) {\n for (let i = 0; i < this.value.length; i++) {\n this.value[i].genCSS(context, output);\n if (!this.noSpacing && i + 1 < this.value.length) {\n output.add(' ');\n }\n }\n }\n\n throwAwayComments() {\n this.value = this.value.filter(v => !(v instanceof Comment));\n }\n}\n\nExpression.prototype.type = 'Expression';\nexport default Expression;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/extend.js b/packages/less/lib/less/tree/extend.js deleted file mode 100644 index d0b0a35f6..000000000 --- a/packages/less/lib/less/tree/extend.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var selector_1 = __importDefault(require("./selector")); -var Extend = /** @class */ (function (_super) { - __extends(Extend, _super); - function Extend(selector, option, index, currentFileInfo, visibilityInfo) { - var _this = _super.call(this) || this; - _this.selector = selector; - _this.option = option; - _this.object_id = Extend.next_id++; - _this.parent_ids = [_this.object_id]; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.copyVisibilityInfo(visibilityInfo); - _this.allowRoot = true; - switch (option) { - case 'all': - _this.allowBefore = true; - _this.allowAfter = true; - break; - default: - _this.allowBefore = false; - _this.allowAfter = false; - break; - } - _this.setParent(_this.selector, _this); - return _this; - } - Extend.prototype.accept = function (visitor) { - this.selector = visitor.visit(this.selector); - }; - Extend.prototype.eval = function (context) { - return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }; - Extend.prototype.clone = function (context) { - return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }; - // it concatenates (joins) all selectors in selector array - Extend.prototype.findSelfSelectors = function (selectors) { - var selfElements = []; - var i; - var selectorElements; - for (i = 0; i < selectors.length; i++) { - selectorElements = selectors[i].elements; - // duplicate the logic in genCSS function inside the selector node. - // future TODO - move both logics into the selector joiner visitor - if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') { - selectorElements[0].combinator.value = ' '; - } - selfElements = selfElements.concat(selectors[i].elements); - } - this.selfSelectors = [new selector_1.default(selfElements)]; - this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo()); - }; - return Extend; -}(node_1.default)); -Extend.next_id = 0; -Extend.prototype.type = 'Extend'; -exports.default = Extend; -//# sourceMappingURL=extend.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/extend.js.map b/packages/less/lib/less/tree/extend.js.map deleted file mode 100644 index 6d7c9146a..000000000 --- a/packages/less/lib/less/tree/extend.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../../src/less/tree/extend.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAElC;IAAqB,0BAAI;IACrB,gBAAY,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc;QAApE,YACI,iBAAO,SAsBV;QApBG,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAClC,KAAI,CAA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AG,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC;QACN,IAAI,gBAAgB,CAAC;QAErB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACzC,mEAAmE;YACnE,kEAAkE;YAClE,IAAI,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,MAAM,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,EAAE;gBACjF,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,GAAG,GAAG,CAAC;aAC9C;YACD,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC7D;QAED,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,kBAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACpE,CAAC;IACL,aAAC;AAAD,CAAC,AAzDD,CAAqB,cAAI,GAyDxB;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;AAEnB,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAC;AACjC,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Selector from './selector';\n\nclass Extend extends Node {\n constructor(selector, option, index, currentFileInfo, visibilityInfo) {\n super();\n\n this.selector = selector;\n this.option = option;\n this.object_id = Extend.next_id++;\n this.parent_ids = [this.object_id];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n switch (option) {\n case 'all':\n this.allowBefore = true;\n this.allowAfter = true;\n break;\n default:\n this.allowBefore = false;\n this.allowAfter = false;\n break;\n }\n this.setParent(this.selector, this);\n }\n\n accept(visitor) {\n this.selector = visitor.visit(this.selector);\n }\n\n eval(context) {\n return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n }\n\n clone(context) {\n return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n }\n\n // it concatenates (joins) all selectors in selector array\n findSelfSelectors(selectors) {\n let selfElements = [];\n let i;\n let selectorElements;\n\n for (i = 0; i < selectors.length; i++) {\n selectorElements = selectors[i].elements;\n // duplicate the logic in genCSS function inside the selector node.\n // future TODO - move both logics into the selector joiner visitor\n if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {\n selectorElements[0].combinator.value = ' ';\n }\n selfElements = selfElements.concat(selectors[i].elements);\n }\n\n this.selfSelectors = [new Selector(selfElements)];\n this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());\n }\n}\n\nExtend.next_id = 0;\n\nExtend.prototype.type = 'Extend';\nexport default Extend;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/import.js b/packages/less/lib/less/tree/import.js deleted file mode 100644 index 77ce3bc62..000000000 --- a/packages/less/lib/less/tree/import.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var media_1 = __importDefault(require("./media")); -var url_1 = __importDefault(require("./url")); -var quoted_1 = __importDefault(require("./quoted")); -var ruleset_1 = __importDefault(require("./ruleset")); -var anonymous_1 = __importDefault(require("./anonymous")); -var utils = __importStar(require("../utils")); -var less_error_1 = __importDefault(require("../less-error")); -// -// CSS @import node -// -// The general strategy here is that we don't want to wait -// for the parsing to be completed, before we start importing -// the file. That's because in the context of a browser, -// most of the time will be spent waiting for the server to respond. -// -// On creation, we push the import path to our import queue, though -// `import,push`, we also pass it a callback, which it'll call once -// the file has been fetched, and parsed. -// -var Import = /** @class */ (function (_super) { - __extends(Import, _super); - function Import(path, features, options, index, currentFileInfo, visibilityInfo) { - var _this = _super.call(this) || this; - _this.options = options; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.path = path; - _this.features = features; - _this.allowRoot = true; - if (_this.options.less !== undefined || _this.options.inline) { - _this.css = !_this.options.less || _this.options.inline; - } - else { - var pathValue = _this.getPath(); - if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) { - _this.css = true; - } - } - _this.copyVisibilityInfo(visibilityInfo); - _this.setParent(_this.features, _this); - _this.setParent(_this.path, _this); - return _this; - } - Import.prototype.accept = function (visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - this.path = visitor.visit(this.path); - if (!this.options.isPlugin && !this.options.inline && this.root) { - this.root = visitor.visit(this.root); - } - }; - Import.prototype.genCSS = function (context, output) { - if (this.css && this.path._fileInfo.reference === undefined) { - output.add('@import ', this._fileInfo, this._index); - this.path.genCSS(context, output); - if (this.features) { - output.add(' '); - this.features.genCSS(context, output); - } - output.add(';'); - } - }; - Import.prototype.getPath = function () { - return (this.path instanceof url_1.default) ? - this.path.value.value : this.path.value; - }; - Import.prototype.isVariableImport = function () { - var path = this.path; - if (path instanceof url_1.default) { - path = path.value; - } - if (path instanceof quoted_1.default) { - return path.containsVariables(); - } - return true; - }; - Import.prototype.evalForImport = function (context) { - var path = this.path; - if (path instanceof url_1.default) { - path = path.value; - } - return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo()); - }; - Import.prototype.evalPath = function (context) { - var path = this.path.eval(context); - var fileInfo = this._fileInfo; - if (!(path instanceof url_1.default)) { - // Add the rootpath if the URL requires a rewrite - var pathValue = path.value; - if (fileInfo && - pathValue && - context.pathRequiresRewrite(pathValue)) { - path.value = context.rewritePath(pathValue, fileInfo.rootpath); - } - else { - path.value = context.normalizePath(path.value); - } - } - return path; - }; - Import.prototype.eval = function (context) { - var result = this.doEval(context); - if (this.options.reference || this.blocksVisibility()) { - if (result.length || result.length === 0) { - result.forEach(function (node) { - node.addVisibilityBlock(); - }); - } - else { - result.addVisibilityBlock(); - } - } - return result; - }; - Import.prototype.doEval = function (context) { - var ruleset; - var registry; - var features = this.features && this.features.eval(context); - if (this.options.isPlugin) { - if (this.root && this.root.eval) { - try { - this.root.eval(context); - } - catch (e) { - e.message = 'Plugin error during evaluation'; - throw new less_error_1.default(e, this.root.imports, this.root.filename); - } - } - registry = context.frames[0] && context.frames[0].functionRegistry; - if (registry && this.root && this.root.functions) { - registry.addMultiple(this.root.functions); - } - return []; - } - if (this.skip) { - if (typeof this.skip === 'function') { - this.skip = this.skip(); - } - if (this.skip) { - return []; - } - } - if (this.options.inline) { - var contents = new anonymous_1.default(this.root, 0, { - filename: this.importedFilename, - reference: this.path._fileInfo && this.path._fileInfo.reference - }, true, true); - return this.features ? new media_1.default([contents], this.features.value) : [contents]; - } - else if (this.css) { - var newImport = new Import(this.evalPath(context), features, this.options, this._index); - if (!newImport.css && this.error) { - throw this.error; - } - return newImport; - } - else if (this.root) { - ruleset = new ruleset_1.default(null, utils.copyArray(this.root.rules)); - ruleset.evalImports(context); - return this.features ? new media_1.default(ruleset.rules, this.features.value) : ruleset.rules; - } - else { - return []; - } - }; - return Import; -}(node_1.default)); -Import.prototype.type = 'Import'; -exports.default = Import; -//# sourceMappingURL=import.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/import.js.map b/packages/less/lib/less/tree/import.js.map deleted file mode 100644 index bbd1f9c7b..000000000 --- a/packages/less/lib/less/tree/import.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../src/less/tree/import.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,kDAA4B;AAC5B,8CAAwB;AACxB,oDAA8B;AAC9B,sDAAgC;AAChC,0DAAoC;AACpC,8CAAkC;AAClC,6DAAsC;AAEtC,EAAE;AACF,mBAAmB;AACnB,EAAE;AACF,0DAA0D;AAC1D,6DAA6D;AAC7D,wDAAwD;AACxD,oEAAoE;AACpE,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AACnE,yCAAyC;AACzC,EAAE;AACF;IAAqB,0BAAI;IACrB,gBAAY,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc;QAA3E,YACI,iBAAO,SAoBV;QAlBG,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,K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C,SAAS,CAAC,SAAS;aAClE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAEnB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,eAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;SAClF;aAAM,IAAI,IAAI,CAAC,GAAG,EAAE;YACjB,IAAM,SAAS,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1F,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;gBAC9B,MAAM,IAAI,CAAC,KAAK,CAAC;aACpB;YACD,OAAO,SAAS,CAAC;SACpB;aAAM,IAAI,IAAI,CAAC,IAAI,EAAE;YAClB,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9D,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAE7B,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,eAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;SACxF;aAAM;YACH,OAAO,EAAE,CAAC;SACb;IACL,CAAC;IACL,aAAC;AAAD,CAAC,AAjKD,CAAqB,cAAI,GAiKxB;AAED,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAC;AACjC,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Media from './media';\nimport URL from './url';\nimport Quoted from './quoted';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\nimport * as utils from '../utils';\nimport LessError from '../less-error';\n\n//\n// CSS @import node\n//\n// The general strategy here is that we don't want to wait\n// for the parsing to be completed, before we start importing\n// the file. That's because in the context of a browser,\n// most of the time will be spent waiting for the server to respond.\n//\n// On creation, we push the import path to our import queue, though\n// `import,push`, we also pass it a callback, which it'll call once\n// the file has been fetched, and parsed.\n//\nclass Import extends Node {\n constructor(path, features, options, index, currentFileInfo, visibilityInfo) {\n super();\n\n this.options = options;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.path = path;\n this.features = features;\n this.allowRoot = true;\n\n if (this.options.less !== undefined || this.options.inline) {\n this.css = !this.options.less || this.options.inline;\n } else {\n const pathValue = this.getPath();\n if (pathValue && /[#\\.\\&\\?]css([\\?;].*)?$/.test(pathValue)) {\n this.css = true;\n }\n }\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.features, this);\n this.setParent(this.path, this);\n }\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n this.path = visitor.visit(this.path);\n if (!this.options.isPlugin && !this.options.inline && this.root) {\n this.root = visitor.visit(this.root);\n }\n }\n\n genCSS(context, output) {\n if (this.css && this.path._fileInfo.reference === undefined) {\n output.add('@import ', this._fileInfo, this._index);\n this.path.genCSS(context, output);\n if (this.features) {\n output.add(' ');\n this.features.genCSS(context, output);\n }\n output.add(';');\n }\n }\n\n getPath() {\n return (this.path instanceof URL) ?\n this.path.value.value : this.path.value;\n }\n\n isVariableImport() {\n let path = this.path;\n if (path instanceof URL) {\n path = path.value;\n }\n if (path instanceof Quoted) {\n return path.containsVariables();\n }\n\n return true;\n }\n\n evalForImport(context) {\n let path = this.path;\n\n if (path instanceof URL) {\n path = path.value;\n }\n\n return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());\n }\n\n evalPath(context) {\n const path = this.path.eval(context);\n const fileInfo = this._fileInfo;\n\n if (!(path instanceof URL)) {\n // Add the rootpath if the URL requires a rewrite\n const pathValue = path.value;\n if (fileInfo &&\n pathValue &&\n context.pathRequiresRewrite(pathValue)) {\n path.value = context.rewritePath(pathValue, fileInfo.rootpath);\n } else {\n path.value = context.normalizePath(path.value);\n }\n }\n\n return path;\n }\n\n eval(context) {\n const result = this.doEval(context);\n if (this.options.reference || this.blocksVisibility()) {\n if (result.length || result.length === 0) {\n result.forEach(node => {\n node.addVisibilityBlock();\n }\n );\n } else {\n result.addVisibilityBlock();\n }\n }\n return result;\n }\n\n doEval(context) {\n let ruleset;\n let registry;\n const features = this.features && this.features.eval(context);\n\n if (this.options.isPlugin) {\n if (this.root && this.root.eval) {\n try {\n this.root.eval(context);\n }\n catch (e) {\n e.message = 'Plugin error during evaluation';\n throw new LessError(e, this.root.imports, this.root.filename);\n }\n }\n registry = context.frames[0] && context.frames[0].functionRegistry;\n if ( registry && this.root && this.root.functions ) {\n registry.addMultiple( this.root.functions );\n }\n\n return [];\n }\n\n if (this.skip) {\n if (typeof this.skip === 'function') {\n this.skip = this.skip();\n }\n if (this.skip) {\n return [];\n }\n }\n if (this.options.inline) {\n const contents = new Anonymous(this.root, 0,\n {\n filename: this.importedFilename,\n reference: this.path._fileInfo && this.path._fileInfo.reference\n }, true, true);\n\n return this.features ? new Media([contents], this.features.value) : [contents];\n } else if (this.css) {\n const newImport = new Import(this.evalPath(context), features, this.options, this._index);\n if (!newImport.css && this.error) {\n throw this.error;\n }\n return newImport;\n } else if (this.root) {\n ruleset = new Ruleset(null, utils.copyArray(this.root.rules));\n ruleset.evalImports(context);\n\n return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules;\n } else {\n return [];\n }\n }\n}\n\nImport.prototype.type = 'Import';\nexport default Import;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/index.js b/packages/less/lib/less/tree/index.js deleted file mode 100644 index 33788cf1d..000000000 --- a/packages/less/lib/less/tree/index.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var tree = Object.create(null); -var node_1 = __importDefault(require("./node")); -var color_1 = __importDefault(require("./color")); -var atrule_1 = __importDefault(require("./atrule")); -var detached_ruleset_1 = __importDefault(require("./detached-ruleset")); -var operation_1 = __importDefault(require("./operation")); -var dimension_1 = __importDefault(require("./dimension")); -var unit_1 = __importDefault(require("./unit")); -var keyword_1 = __importDefault(require("./keyword")); -var variable_1 = __importDefault(require("./variable")); -var property_1 = __importDefault(require("./property")); -var ruleset_1 = __importDefault(require("./ruleset")); -var element_1 = __importDefault(require("./element")); -var attribute_1 = __importDefault(require("./attribute")); -var combinator_1 = __importDefault(require("./combinator")); -var selector_1 = __importDefault(require("./selector")); -var quoted_1 = __importDefault(require("./quoted")); -var expression_1 = __importDefault(require("./expression")); -var declaration_1 = __importDefault(require("./declaration")); -var call_1 = __importDefault(require("./call")); -var url_1 = __importDefault(require("./url")); -var import_1 = __importDefault(require("./import")); -var comment_1 = __importDefault(require("./comment")); -var anonymous_1 = __importDefault(require("./anonymous")); -var value_1 = __importDefault(require("./value")); -var javascript_1 = __importDefault(require("./javascript")); -var assignment_1 = __importDefault(require("./assignment")); -var condition_1 = __importDefault(require("./condition")); -var paren_1 = __importDefault(require("./paren")); -var media_1 = __importDefault(require("./media")); -var unicode_descriptor_1 = __importDefault(require("./unicode-descriptor")); -var negative_1 = __importDefault(require("./negative")); -var extend_1 = __importDefault(require("./extend")); -var variable_call_1 = __importDefault(require("./variable-call")); -var namespace_value_1 = __importDefault(require("./namespace-value")); -// mixins -var mixin_call_1 = __importDefault(require("./mixin-call")); -var mixin_definition_1 = __importDefault(require("./mixin-definition")); -exports.default = { - Node: node_1.default, Color: color_1.default, AtRule: atrule_1.default, DetachedRuleset: detached_ruleset_1.default, Operation: operation_1.default, - Dimension: dimension_1.default, Unit: unit_1.default, Keyword: keyword_1.default, Variable: variable_1.default, Property: property_1.default, - Ruleset: ruleset_1.default, Element: element_1.default, Attribute: attribute_1.default, Combinator: combinator_1.default, Selector: selector_1.default, - Quoted: quoted_1.default, Expression: expression_1.default, Declaration: declaration_1.default, Call: call_1.default, URL: url_1.default, Import: import_1.default, - Comment: comment_1.default, Anonymous: anonymous_1.default, Value: value_1.default, JavaScript: javascript_1.default, Assignment: assignment_1.default, - Condition: condition_1.default, Paren: paren_1.default, Media: media_1.default, UnicodeDescriptor: unicode_descriptor_1.default, Negative: negative_1.default, - Extend: extend_1.default, VariableCall: variable_call_1.default, NamespaceValue: namespace_value_1.default, - mixin: { - Call: mixin_call_1.default, - Definition: mixin_definition_1.default - } -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/index.js.map b/packages/less/lib/less/tree/index.js.map deleted file mode 100644 index 88617a859..000000000 --- a/packages/less/lib/less/tree/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/less/tree/index.js"],"names":[],"mappings":";;;;;AAAA,IAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEjC,gDAA0B;AAC1B,kDAA4B;AAC5B,oDAA8B;AAC9B,wEAAiD;AACjD,0DAAoC;AACpC,0DAAoC;AACpC,gDAA0B;AAC1B,sDAAgC;AAChC,wDAAkC;AAClC,wDAAkC;AAClC,sDAAgC;AAChC,sDAAgC;AAChC,0DAAoC;AACpC,4DAAsC;AACtC,wDAAkC;AAClC,oDAA8B;AAC9B,4DAAsC;AACtC,8DAAwC;AACxC,gDAA0B;AAC1B,8CAAwB;AACxB,oDAA8B;AAC9B,sDAAgC;AAChC,0DAAoC;AACpC,kDAA4B;AAC5B,4DAAsC;AACtC,4DAAsC;AACtC,0DAAoC;AACpC,kDAA4B;AAC5B,kDAA4B;AAC5B,4EAAqD;AACrD,wDAAkC;AAClC,oDAA8B;AAC9B,kEAA2C;AAC3C,sEAA+C;AAE/C,SAAS;AACT,4DAAqC;AACrC,wEAAiD;AAEjD,kBAAe;IACX,IAAI,gBAAA,EAAE,KAAK,iBAAA,EAAE,MAAM,kBAAA,EAAE,eAAe,4BAAA,EAAE,SAAS,qBAAA;IAC/C,SAAS,qBAAA,EAAE,IAAI,gBAAA,EAAE,OAAO,mBAAA,EAAE,QAAQ,oBAAA,EAAE,QAAQ,oBAAA;IAC5C,OAAO,mBAAA,EAAE,OAAO,mBAAA,EAAE,SAAS,qBAAA,EAAE,UAAU,sBAAA,EAAE,QAAQ,oBAAA;IACjD,MAAM,kBAAA,EAAE,UAAU,sBAAA,EAAE,WAAW,uBAAA,EAAE,IAAI,gBAAA,EAAE,GAAG,eAAA,EAAE,MAAM,kBAAA;IAClD,OAAO,mBAAA,EAAE,SAAS,qBAAA,EAAE,KAAK,iBAAA,EAAE,UAAU,sBAAA,EAAE,UAAU,sBAAA;IACjD,SAAS,qBAAA,EAAE,KAAK,iBAAA,EAAE,KAAK,iBAAA,EAAE,iBAAiB,8BAAA,EAAE,QAAQ,oBAAA;IACpD,MAAM,kBAAA,EAAE,YAAY,yBAAA,EAAE,cAAc,2BAAA;IACpC,KAAK,EAAE;QACH,IAAI,EAAE,oBAAS;QACf,UAAU,EAAE,0BAAe;KAC9B;CACJ,CAAC","sourcesContent":["const tree = Object.create(null);\n\nimport Node from './node';\nimport Color from './color';\nimport AtRule from './atrule';\nimport DetachedRuleset from './detached-ruleset';\nimport Operation from './operation';\nimport Dimension from './dimension';\nimport Unit from './unit';\nimport Keyword from './keyword';\nimport Variable from './variable';\nimport Property from './property';\nimport Ruleset from './ruleset';\nimport Element from './element';\nimport Attribute from './attribute';\nimport Combinator from './combinator';\nimport Selector from './selector';\nimport Quoted from './quoted';\nimport Expression from './expression';\nimport Declaration from './declaration';\nimport Call from './call';\nimport URL from './url';\nimport Import from './import';\nimport Comment from './comment';\nimport Anonymous from './anonymous';\nimport Value from './value';\nimport JavaScript from './javascript';\nimport Assignment from './assignment';\nimport Condition from './condition';\nimport Paren from './paren';\nimport Media from './media';\nimport UnicodeDescriptor from './unicode-descriptor';\nimport Negative from './negative';\nimport Extend from './extend';\nimport VariableCall from './variable-call';\nimport NamespaceValue from './namespace-value';\n\n// mixins\nimport MixinCall from './mixin-call';\nimport MixinDefinition from './mixin-definition';\n\nexport default {\n Node, Color, AtRule, DetachedRuleset, Operation,\n Dimension, Unit, Keyword, Variable, Property,\n Ruleset, Element, Attribute, Combinator, Selector,\n Quoted, Expression, Declaration, Call, URL, Import,\n Comment, Anonymous, Value, JavaScript, Assignment,\n Condition, Paren, Media, UnicodeDescriptor, Negative,\n Extend, VariableCall, NamespaceValue,\n mixin: {\n Call: MixinCall,\n Definition: MixinDefinition\n }\n};"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/javascript.js b/packages/less/lib/less/tree/javascript.js deleted file mode 100644 index 0190a387d..000000000 --- a/packages/less/lib/less/tree/javascript.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var js_eval_node_1 = __importDefault(require("./js-eval-node")); -var dimension_1 = __importDefault(require("./dimension")); -var quoted_1 = __importDefault(require("./quoted")); -var anonymous_1 = __importDefault(require("./anonymous")); -var JavaScript = /** @class */ (function (_super) { - __extends(JavaScript, _super); - function JavaScript(string, escaped, index, currentFileInfo) { - var _this = _super.call(this) || this; - _this.escaped = escaped; - _this.expression = string; - _this._index = index; - _this._fileInfo = currentFileInfo; - return _this; - } - JavaScript.prototype.eval = function (context) { - var result = this.evaluateJavaScript(this.expression, context); - var type = typeof result; - if (type === 'number' && !isNaN(result)) { - return new dimension_1.default(result); - } - else if (type === 'string') { - return new quoted_1.default("\"" + result + "\"", result, this.escaped, this._index); - } - else if (Array.isArray(result)) { - return new anonymous_1.default(result.join(', ')); - } - else { - return new anonymous_1.default(result); - } - }; - return JavaScript; -}(js_eval_node_1.default)); -JavaScript.prototype.type = 'JavaScript'; -exports.default = JavaScript; -//# sourceMappingURL=javascript.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/javascript.js.map b/packages/less/lib/less/tree/javascript.js.map deleted file mode 100644 index 2ea6b85a5..000000000 --- a/packages/less/lib/less/tree/javascript.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"javascript.js","sourceRoot":"","sources":["../../../src/less/tree/javascript.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gEAAwC;AACxC,0DAAoC;AACpC,oDAA8B;AAC9B,0DAAoC;AAEpC;IAAyB,8BAAU;IAC/B,oBAAY,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe;QAAnD,YACI,iBAAO,SAMV;QAJG,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;;IACrC,CAAC;IAED,yBAAI,GAAJ,UAAK,OAAO;QACR,IAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjE,IAAM,IAAI,GAAG,OAAO,MAAM,CAAC;QAE3B,IAAI,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;YACrC,OAAO,IAAI,mBAAS,CAAC,MAAM,CAAC,CAAC;SAChC;aAAM,IAAI,IAAI,KAAK,QAAQ,EAAE;YAC1B,OAAO,IAAI,gBAAM,CAAC,OAAI,MAAM,OAAG,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACvE;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC9B,OAAO,IAAI,mBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3C;aAAM;YACH,OAAO,IAAI,mBAAS,CAAC,MAAM,CAAC,CAAC;SAChC;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAxBD,CAAyB,sBAAU,GAwBlC;AAED,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,YAAY,CAAC;AACzC,kBAAe,UAAU,CAAC","sourcesContent":["import JsEvalNode from './js-eval-node';\nimport Dimension from './dimension';\nimport Quoted from './quoted';\nimport Anonymous from './anonymous';\n\nclass JavaScript extends JsEvalNode {\n constructor(string, escaped, index, currentFileInfo) {\n super();\n\n this.escaped = escaped;\n this.expression = string;\n this._index = index;\n this._fileInfo = currentFileInfo;\n }\n\n eval(context) {\n const result = this.evaluateJavaScript(this.expression, context);\n const type = typeof result;\n\n if (type === 'number' && !isNaN(result)) {\n return new Dimension(result);\n } else if (type === 'string') {\n return new Quoted(`\"${result}\"`, result, this.escaped, this._index);\n } else if (Array.isArray(result)) {\n return new Anonymous(result.join(', '));\n } else {\n return new Anonymous(result);\n }\n }\n}\n\nJavaScript.prototype.type = 'JavaScript';\nexport default JavaScript;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/js-eval-node.js b/packages/less/lib/less/tree/js-eval-node.js deleted file mode 100644 index 622c82946..000000000 --- a/packages/less/lib/less/tree/js-eval-node.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var variable_1 = __importDefault(require("./variable")); -var JsEvalNode = /** @class */ (function (_super) { - __extends(JsEvalNode, _super); - function JsEvalNode() { - return _super !== null && _super.apply(this, arguments) || this; - } - JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { - var result; - var that = this; - var evalContext = {}; - if (!context.javascriptEnabled) { - throw { message: 'Inline JavaScript is not enabled. Is it set in your options?', - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { return that.jsify(new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context)); }); - try { - expression = new Function("return (" + expression + ")"); - } - catch (e) { - throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`", filename: this.fileInfo().filename, - index: this.getIndex() }; - } - var variables = context.frames[0].variables(); - for (var k in variables) { - if (variables.hasOwnProperty(k)) { - /* jshint loopfunc:true */ - evalContext[k.slice(1)] = { - value: variables[k].value, - toJS: function () { - return this.value.eval(context).toCSS(); - } - }; - } - } - try { - result = expression.call(evalContext); - } - catch (e) { - throw { message: "JavaScript evaluation error: '" + e.name + ": " + e.message.replace(/["]/g, '\'') + "'", filename: this.fileInfo().filename, - index: this.getIndex() }; - } - return result; - }; - JsEvalNode.prototype.jsify = function (obj) { - if (Array.isArray(obj.value) && (obj.value.length > 1)) { - return "[" + obj.value.map(function (v) { return v.toCSS(); }).join(', ') + "]"; - } - else { - return obj.toCSS(); - } - }; - return JsEvalNode; -}(node_1.default)); -exports.default = JsEvalNode; -//# sourceMappingURL=js-eval-node.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/js-eval-node.js.map b/packages/less/lib/less/tree/js-eval-node.js.map deleted file mode 100644 index b7f5df1a9..000000000 --- a/packages/less/lib/less/tree/js-eval-node.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"js-eval-node.js","sourceRoot":"","sources":["../../../src/less/tree/js-eval-node.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAElC;IAAyB,8BAAI;IAA7B;;IAoDA,CAAC;IAnDG,uCAAkB,GAAlB,UAAmB,UAAU,EAAE,OAAO;QAClC,IAAI,MAAM,CAAC;QACX,IAAM,IAAI,GAAG,IAAI,CAAC;QAClB,IAAM,WAAW,GAAG,EAAE,CAAC;QAEvB,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE;YAC5B,MAAM,EAAE,OAAO,EAAE,8DAA8D;gBAC3E,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ;gBAClC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;SAChC;QAED,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,gBAAgB,EAAE,UAAC,CAAC,EAAE,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,IAAI,kBAAQ,CAAC,MAAI,IAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAApF,CAAoF,CAAC,CAAC;QAErJ,IAAI;YACA,UAAU,GAAG,IAAI,QAAQ,CAAC,aAAW,UAAU,MAAG,CAAC,CAAC;SACvD;QAAC,OAAO,CAAC,EAAE;YACR,MAAM,EAAE,OAAO,EAAE,kCAAgC,CAAC,CAAC,OAAO,eAAW,UAAU,MAAI,EAC/E,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ;gBAClC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE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AAC;SACtB;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AApDD,CAAyB,cAAI,GAoD5B;AAED,kBAAe,UAAU,CAAC","sourcesContent":["import Node from './node';\nimport Variable from './variable';\n\nclass JsEvalNode extends Node {\n evaluateJavaScript(expression, context) {\n let result;\n const that = this;\n const evalContext = {};\n\n if (!context.javascriptEnabled) {\n throw { message: 'Inline JavaScript is not enabled. Is it set in your options?',\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n expression = expression.replace(/@\\{([\\w-]+)\\}/g, (_, name) => that.jsify(new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context)));\n\n try {\n expression = new Function(`return (${expression})`);\n } catch (e) {\n throw { message: `JavaScript evaluation error: ${e.message} from \\`${expression}\\`` ,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n const variables = context.frames[0].variables();\n for (const k in variables) {\n if (variables.hasOwnProperty(k)) {\n /* jshint loopfunc:true */\n evalContext[k.slice(1)] = {\n value: variables[k].value,\n toJS: function () {\n return this.value.eval(context).toCSS();\n }\n };\n }\n }\n\n try {\n result = expression.call(evalContext);\n } catch (e) {\n throw { message: `JavaScript evaluation error: '${e.name}: ${e.message.replace(/[\"]/g, '\\'')}'` ,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n return result;\n }\n\n jsify(obj) {\n if (Array.isArray(obj.value) && (obj.value.length > 1)) {\n return `[${obj.value.map(v => v.toCSS()).join(', ')}]`;\n } else {\n return obj.toCSS();\n }\n }\n}\n\nexport default JsEvalNode;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/keyword.js b/packages/less/lib/less/tree/keyword.js deleted file mode 100644 index 099ff36fd..000000000 --- a/packages/less/lib/less/tree/keyword.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var Keyword = /** @class */ (function (_super) { - __extends(Keyword, _super); - function Keyword(value) { - var _this = _super.call(this) || this; - _this.value = value; - return _this; - } - Keyword.prototype.genCSS = function (context, output) { - if (this.value === '%') { - throw { type: 'Syntax', message: 'Invalid % without number' }; - } - output.add(this.value); - }; - return Keyword; -}(node_1.default)); -Keyword.prototype.type = 'Keyword'; -Keyword.True = new Keyword('true'); -Keyword.False = new Keyword('false'); -exports.default = Keyword; -//# sourceMappingURL=keyword.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/keyword.js.map b/packages/less/lib/less/tree/keyword.js.map deleted file mode 100644 index 9eab4d177..000000000 --- a/packages/less/lib/less/tree/keyword.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keyword.js","sourceRoot":"","sources":["../../../src/less/tree/keyword.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAsB,2BAAI;IACtB,iBAAY,KAAK;QAAjB,YACI,iBAAO,SAGV;QADG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACvB,CAAC;IAED,wBAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,IAAI,IAAI,CAAC,KAAK,KAAK,GAAG,EAAE;YAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;SAAE;QAC1F,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IACL,cAAC;AAAD,CAAC,AAXD,CAAsB,cAAI,GAWzB;AAED,OAAO,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC;AAEnC,OAAO,CAAC,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;AACnC,OAAO,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;AAErC,kBAAe,OAAO,CAAC","sourcesContent":["import Node from './node';\n\nclass Keyword extends Node {\n constructor(value) {\n super();\n\n this.value = value;\n }\n\n genCSS(context, output) {\n if (this.value === '%') { throw { type: 'Syntax', message: 'Invalid % without number' }; }\n output.add(this.value);\n }\n}\n\nKeyword.prototype.type = 'Keyword';\n\nKeyword.True = new Keyword('true');\nKeyword.False = new Keyword('false');\n\nexport default Keyword;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/media.js b/packages/less/lib/less/tree/media.js deleted file mode 100644 index 52c7125af..000000000 --- a/packages/less/lib/less/tree/media.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var ruleset_1 = __importDefault(require("./ruleset")); -var value_1 = __importDefault(require("./value")); -var selector_1 = __importDefault(require("./selector")); -var anonymous_1 = __importDefault(require("./anonymous")); -var expression_1 = __importDefault(require("./expression")); -var atrule_1 = __importDefault(require("./atrule")); -var utils = __importStar(require("../utils")); -var Media = /** @class */ (function (_super) { - __extends(Media, _super); - function Media(value, features, index, currentFileInfo, visibilityInfo) { - var _this = _super.call(this) || this; - _this._index = index; - _this._fileInfo = currentFileInfo; - var selectors = (new selector_1.default([], null, null, _this._index, _this._fileInfo)).createEmptySelectors(); - _this.features = new value_1.default(features); - _this.rules = [new ruleset_1.default(selectors, value)]; - _this.rules[0].allowImports = true; - _this.copyVisibilityInfo(visibilityInfo); - _this.allowRoot = true; - _this.setParent(selectors, _this); - _this.setParent(_this.features, _this); - _this.setParent(_this.rules, _this); - return _this; - } - Media.prototype.isRulesetLike = function () { - return true; - }; - Media.prototype.accept = function (visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - if (this.rules) { - this.rules = visitor.visitArray(this.rules); - } - }; - Media.prototype.genCSS = function (context, output) { - output.add('@media ', this._fileInfo, this._index); - this.features.genCSS(context, output); - this.outputRuleset(context, output, this.rules); - }; - Media.prototype.eval = function (context) { - if (!context.mediaBlocks) { - context.mediaBlocks = []; - context.mediaPath = []; - } - var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo()); - if (this.debugInfo) { - this.rules[0].debugInfo = this.debugInfo; - media.debugInfo = this.debugInfo; - } - media.features = this.features.eval(context); - context.mediaPath.push(media); - context.mediaBlocks.push(media); - this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - context.frames.unshift(this.rules[0]); - media.rules = [this.rules[0].eval(context)]; - context.frames.shift(); - context.mediaPath.pop(); - return context.mediaPath.length === 0 ? media.evalTop(context) : - media.evalNested(context); - }; - Media.prototype.evalTop = function (context) { - var result = this; - // Render all dependent Media blocks. - if (context.mediaBlocks.length > 1) { - var selectors = (new selector_1.default([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors(); - result = new ruleset_1.default(selectors, context.mediaBlocks); - result.multiMedia = true; - result.copyVisibilityInfo(this.visibilityInfo()); - this.setParent(result, this); - } - delete context.mediaBlocks; - delete context.mediaPath; - return result; - }; - Media.prototype.evalNested = function (context) { - var i; - var value; - var path = context.mediaPath.concat([this]); - // Extract the media-query conditions separated with `,` (OR). - for (i = 0; i < path.length; i++) { - value = path[i].features instanceof value_1.default ? - path[i].features.value : path[i].features; - path[i] = Array.isArray(value) ? value : [value]; - } - // Trace all permutations to generate the resulting media-query. - // - // (a, b and c) with nested (d, e) -> - // a and d - // a and e - // b and c and d - // b and c and e - this.features = new value_1.default(this.permute(path).map(function (path) { - path = path.map(function (fragment) { return fragment.toCSS ? fragment : new anonymous_1.default(fragment); }); - for (i = path.length - 1; i > 0; i--) { - path.splice(i, 0, new anonymous_1.default('and')); - } - return new expression_1.default(path); - })); - this.setParent(this.features, this); - // Fake a tree-node that doesn't output anything. - return new ruleset_1.default([], []); - }; - Media.prototype.permute = function (arr) { - if (arr.length === 0) { - return []; - } - else if (arr.length === 1) { - return arr[0]; - } - else { - var result = []; - var rest = this.permute(arr.slice(1)); - for (var i = 0; i < rest.length; i++) { - for (var j = 0; j < arr[0].length; j++) { - result.push([arr[0][j]].concat(rest[i])); - } - } - return result; - } - }; - Media.prototype.bubbleSelectors = function (selectors) { - if (!selectors) { - return; - } - this.rules = [new ruleset_1.default(utils.copyArray(selectors), [this.rules[0]])]; - this.setParent(this.rules, this); - }; - return Media; -}(atrule_1.default)); -Media.prototype.type = 'Media'; -exports.default = Media; -//# sourceMappingURL=media.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/media.js.map b/packages/less/lib/less/tree/media.js.map deleted file mode 100644 index abe940bea..000000000 --- a/packages/less/lib/less/tree/media.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/less/tree/media.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAgC;AAChC,kDAA4B;AAC5B,wDAAkC;AAClC,0DAAoC;AACpC,4DAAsC;AACtC,oDAA8B;AAC9B,8CAAkC;AAElC;IAAoB,yBAAM;IACtB,eAAY,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc;QAAnE,YACI,iBAAO,SAeV;QAbG,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QAEjC,IAAM,SAAS,GAAG,CAAC,IAAI,kBAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAI,CAAC,MAAM,EAAE,KAAI,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC;QAErG,KAAI,CAAC,QAAQ,GAAG,IAAI,eAAK,CAAC,QAAQ,CAAC,CAAC;QACpC,KAAI,CAAC,KAAK,GAAG,CAAC,IAAI,iBAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;QAC7C,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC;QAClC,KAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QACxC,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAI,CAAC,SAAS,CAAC,SAAS,EAAE,KAAI,CAAC,CAAC;QAChC,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,QAAQ,EAAE,KAAI,CAAC,CAAC;QACpC,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;;IAC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B,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO;SACV;QACD,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,iBAAO,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IACL,YAAC;AAAD,CAAC,AA9ID,CAAoB,gBAAM,GA8IzB;AAED,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,OAAO,CAAC;AAC/B,kBAAe,KAAK,CAAC","sourcesContent":["import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport Anonymous from './anonymous';\nimport Expression from './expression';\nimport AtRule from './atrule';\nimport * as utils from '../utils';\n\nclass Media extends AtRule {\n constructor(value, features, index, currentFileInfo, visibilityInfo) {\n super();\n\n this._index = index;\n this._fileInfo = currentFileInfo;\n\n const selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.features = new Value(features);\n this.rules = [new Ruleset(selectors, value)];\n this.rules[0].allowImports = true;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n this.setParent(selectors, this);\n this.setParent(this.features, this);\n this.setParent(this.rules, this);\n }\n\n isRulesetLike() {\n return true;\n }\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n if (this.rules) {\n this.rules = visitor.visitArray(this.rules);\n }\n }\n\n genCSS(context, output) {\n output.add('@media ', this._fileInfo, this._index);\n this.features.genCSS(context, output);\n this.outputRuleset(context, output, this.rules);\n }\n\n eval(context) {\n if (!context.mediaBlocks) {\n context.mediaBlocks = [];\n context.mediaPath = [];\n }\n\n const media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo());\n if (this.debugInfo) {\n this.rules[0].debugInfo = this.debugInfo;\n media.debugInfo = this.debugInfo;\n }\n \n media.features = this.features.eval(context);\n\n context.mediaPath.push(media);\n context.mediaBlocks.push(media);\n\n this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n context.frames.unshift(this.rules[0]);\n media.rules = [this.rules[0].eval(context)];\n context.frames.shift();\n\n context.mediaPath.pop();\n\n return context.mediaPath.length === 0 ? media.evalTop(context) :\n media.evalNested(context);\n }\n\n evalTop(context) {\n let result = this;\n\n // Render all dependent Media blocks.\n if (context.mediaBlocks.length > 1) {\n const selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();\n result = new Ruleset(selectors, context.mediaBlocks);\n result.multiMedia = true;\n result.copyVisibilityInfo(this.visibilityInfo());\n this.setParent(result, this);\n }\n\n delete context.mediaBlocks;\n delete context.mediaPath;\n\n return result;\n }\n\n evalNested(context) {\n let i;\n let value;\n const path = context.mediaPath.concat([this]);\n\n // Extract the media-query conditions separated with `,` (OR).\n for (i = 0; i < path.length; i++) {\n value = path[i].features instanceof Value ?\n path[i].features.value : path[i].features;\n path[i] = Array.isArray(value) ? value : [value];\n }\n\n // Trace all permutations to generate the resulting media-query.\n //\n // (a, b and c) with nested (d, e) ->\n // a and d\n // a and e\n // b and c and d\n // b and c and e\n this.features = new Value(this.permute(path).map(path => {\n path = path.map(fragment => fragment.toCSS ? fragment : new Anonymous(fragment));\n\n for (i = path.length - 1; i > 0; i--) {\n path.splice(i, 0, new Anonymous('and'));\n }\n\n return new Expression(path);\n }));\n this.setParent(this.features, this);\n\n // Fake a tree-node that doesn't output anything.\n return new Ruleset([], []);\n }\n\n permute(arr) {\n if (arr.length === 0) {\n return [];\n } else if (arr.length === 1) {\n return arr[0];\n } else {\n const result = [];\n const rest = this.permute(arr.slice(1));\n for (let i = 0; i < rest.length; i++) {\n for (let j = 0; j < arr[0].length; j++) {\n result.push([arr[0][j]].concat(rest[i]));\n }\n }\n return result;\n }\n }\n\n bubbleSelectors(selectors) {\n if (!selectors) {\n return;\n }\n this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])];\n this.setParent(this.rules, this);\n }\n}\n\nMedia.prototype.type = 'Media';\nexport default Media;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/mixin-call.js b/packages/less/lib/less/tree/mixin-call.js deleted file mode 100644 index 8b3c52472..000000000 --- a/packages/less/lib/less/tree/mixin-call.js +++ /dev/null @@ -1,212 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var selector_1 = __importDefault(require("./selector")); -var mixin_definition_1 = __importDefault(require("./mixin-definition")); -var default_1 = __importDefault(require("../functions/default")); -var MixinCall = /** @class */ (function (_super) { - __extends(MixinCall, _super); - function MixinCall(elements, args, index, currentFileInfo, important) { - var _this = _super.call(this) || this; - _this.selector = new selector_1.default(elements); - _this.arguments = args || []; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.important = important; - _this.allowRoot = true; - _this.setParent(_this.selector, _this); - return _this; - } - MixinCall.prototype.accept = function (visitor) { - if (this.selector) { - this.selector = visitor.visit(this.selector); - } - if (this.arguments.length) { - this.arguments = visitor.visitArray(this.arguments); - } - }; - MixinCall.prototype.eval = function (context) { - var mixins; - var mixin; - var mixinPath; - var args = []; - var arg; - var argValue; - var rules = []; - var match = false; - var i; - var m; - var f; - var isRecursive; - var isOneFound; - var candidates = []; - var candidate; - var conditionResult = []; - var defaultResult; - var defFalseEitherCase = -1; - var defNone = 0; - var defTrue = 1; - var defFalse = 2; - var count; - var originalRuleset; - var noArgumentsFilter; - this.selector = this.selector.eval(context); - function calcDefGroup(mixin, mixinPath) { - var f; - var p; - var namespace; - for (f = 0; f < 2; f++) { - conditionResult[f] = true; - default_1.default.value(f); - for (p = 0; p < mixinPath.length && conditionResult[f]; p++) { - namespace = mixinPath[p]; - if (namespace.matchCondition) { - conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context); - } - } - if (mixin.matchCondition) { - conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context); - } - } - if (conditionResult[0] || conditionResult[1]) { - if (conditionResult[0] != conditionResult[1]) { - return conditionResult[1] ? - defTrue : defFalse; - } - return defNone; - } - return defFalseEitherCase; - } - for (i = 0; i < this.arguments.length; i++) { - arg = this.arguments[i]; - argValue = arg.value.eval(context); - if (arg.expand && Array.isArray(argValue.value)) { - argValue = argValue.value; - for (m = 0; m < argValue.length; m++) { - args.push({ value: argValue[m] }); - } - } - else { - args.push({ name: arg.name, value: argValue }); - } - } - noArgumentsFilter = function (rule) { return rule.matchArgs(null, context); }; - for (i = 0; i < context.frames.length; i++) { - if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) { - isOneFound = true; - // To make `default()` function independent of definition order we have two "subpasses" here. - // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`), - // and build candidate list with corresponding flags. Then, when we know all possible matches, - // we make a final decision. - for (m = 0; m < mixins.length; m++) { - mixin = mixins[m].rule; - mixinPath = mixins[m].path; - isRecursive = false; - for (f = 0; f < context.frames.length; f++) { - if ((!(mixin instanceof mixin_definition_1.default)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) { - isRecursive = true; - break; - } - } - if (isRecursive) { - continue; - } - if (mixin.matchArgs(args, context)) { - candidate = { mixin: mixin, group: calcDefGroup(mixin, mixinPath) }; - if (candidate.group !== defFalseEitherCase) { - candidates.push(candidate); - } - match = true; - } - } - default_1.default.reset(); - count = [0, 0, 0]; - for (m = 0; m < candidates.length; m++) { - count[candidates[m].group]++; - } - if (count[defNone] > 0) { - defaultResult = defFalse; - } - else { - defaultResult = defTrue; - if ((count[defTrue] + count[defFalse]) > 1) { - throw { type: 'Runtime', message: "Ambiguous use of `default()` found when matching for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename }; - } - } - for (m = 0; m < candidates.length; m++) { - candidate = candidates[m].group; - if ((candidate === defNone) || (candidate === defaultResult)) { - try { - mixin = candidates[m].mixin; - if (!(mixin instanceof mixin_definition_1.default)) { - originalRuleset = mixin.originalRuleset || mixin; - mixin = new mixin_definition_1.default('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo()); - mixin.originalRuleset = originalRuleset; - } - var newRules = mixin.evalCall(context, args, this.important).rules; - this._setVisibilityToReplacement(newRules); - Array.prototype.push.apply(rules, newRules); - } - catch (e) { - throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack }; - } - } - } - if (match) { - return rules; - } - } - } - if (isOneFound) { - throw { type: 'Runtime', message: "No matching definition was found for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename }; - } - else { - throw { type: 'Name', message: this.selector.toCSS().trim() + " is undefined", index: this.getIndex(), filename: this.fileInfo().filename }; - } - }; - MixinCall.prototype._setVisibilityToReplacement = function (replacement) { - var i; - var rule; - if (this.blocksVisibility()) { - for (i = 0; i < replacement.length; i++) { - rule = replacement[i]; - rule.addVisibilityBlock(); - } - } - }; - MixinCall.prototype.format = function (args) { - return this.selector.toCSS().trim() + "(" + (args ? args.map(function (a) { - var argValue = ''; - if (a.name) { - argValue += a.name + ":"; - } - if (a.value.toCSS) { - argValue += a.value.toCSS(); - } - else { - argValue += '???'; - } - return argValue; - }).join(', ') : '') + ")"; - }; - return MixinCall; -}(node_1.default)); -MixinCall.prototype.type = 'MixinCall'; -exports.default = MixinCall; -//# sourceMappingURL=mixin-call.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/mixin-call.js.map b/packages/less/lib/less/tree/mixin-call.js.map deleted file mode 100644 index 537140b9d..000000000 --- a/packages/less/lib/less/tree/mixin-call.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mixin-call.js","sourceRoot":"","sources":["../../../src/less/tree/mixin-call.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAClC,wEAAiD;AACjD,iEAA+C;AAE/C;IAAwB,6BAAI;IACxB,mBAAY,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS;QAA7D,YACI,iBAAO,SASV;QAPG,KAAI,CAAC,QAAQ,GAAG,IAAI,kBAAQ,CAAC,QAAQ,CAAC,CAAC;QACvC,KAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC5B,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,QAAQ,EAAE,KAAI,CAAC,CAAC;;IACxC,CAAC;IAED,0BAAM,GAAN,UAAO,OAAO;QACV,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAChD;QACD,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACvB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACvD;IACL,CAAC;IAED,wBAAI,GAAJ,UAAK,OAAO;QACR,IAAI,MAAM,CAAC;QACX,IAAI,KAAK,CAAC;QACV,IAAI,SAAS,CAAC;QACd,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,IAAI,GAAG,CAAC;QACR,IAAI,QAAQ,CA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C","sourcesContent":["import Node from './node';\nimport Selector from './selector';\nimport MixinDefinition from './mixin-definition';\nimport defaultFunc from '../functions/default';\n\nclass MixinCall extends Node {\n constructor(elements, args, index, currentFileInfo, important) {\n super();\n\n this.selector = new Selector(elements);\n this.arguments = args || [];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.important = important;\n this.allowRoot = true;\n this.setParent(this.selector, this);\n }\n\n accept(visitor) {\n if (this.selector) {\n this.selector = visitor.visit(this.selector);\n }\n if (this.arguments.length) {\n this.arguments = visitor.visitArray(this.arguments);\n }\n }\n\n eval(context) {\n let mixins;\n let mixin;\n let mixinPath;\n const args = [];\n let arg;\n let argValue;\n const rules = [];\n let match = false;\n let i;\n let m;\n let f;\n let isRecursive;\n let isOneFound;\n const candidates = [];\n let candidate;\n const conditionResult = [];\n let defaultResult;\n const defFalseEitherCase = -1;\n const defNone = 0;\n const defTrue = 1;\n const defFalse = 2;\n let count;\n let originalRuleset;\n let noArgumentsFilter;\n\n this.selector = this.selector.eval(context);\n\n function calcDefGroup(mixin, mixinPath) {\n let f;\n let p;\n let namespace;\n\n for (f = 0; f < 2; f++) {\n conditionResult[f] = true;\n defaultFunc.value(f);\n for (p = 0; p < mixinPath.length && conditionResult[f]; p++) {\n namespace = mixinPath[p];\n if (namespace.matchCondition) {\n conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context);\n }\n }\n if (mixin.matchCondition) {\n conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context);\n }\n }\n if (conditionResult[0] || conditionResult[1]) {\n if (conditionResult[0] != conditionResult[1]) {\n return conditionResult[1] ?\n defTrue : defFalse;\n }\n\n return defNone;\n }\n return defFalseEitherCase;\n }\n\n for (i = 0; i < this.arguments.length; i++) {\n arg = this.arguments[i];\n argValue = arg.value.eval(context);\n if (arg.expand && Array.isArray(argValue.value)) {\n argValue = argValue.value;\n for (m = 0; m < argValue.length; m++) {\n args.push({value: argValue[m]});\n }\n } else {\n args.push({name: arg.name, value: argValue});\n }\n }\n\n noArgumentsFilter = rule => rule.matchArgs(null, context);\n\n for (i = 0; i < context.frames.length; i++) {\n if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) {\n isOneFound = true;\n\n // To make `default()` function independent of definition order we have two \"subpasses\" here.\n // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`),\n // and build candidate list with corresponding flags. Then, when we know all possible matches,\n // we make a final decision.\n\n for (m = 0; m < mixins.length; m++) {\n mixin = mixins[m].rule;\n mixinPath = mixins[m].path;\n isRecursive = false;\n for (f = 0; f < context.frames.length; f++) {\n if ((!(mixin instanceof MixinDefinition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) {\n isRecursive = true;\n break;\n }\n }\n if (isRecursive) {\n continue;\n }\n\n if (mixin.matchArgs(args, context)) {\n candidate = {mixin, group: calcDefGroup(mixin, mixinPath)};\n\n if (candidate.group !== defFalseEitherCase) {\n candidates.push(candidate);\n }\n\n match = true;\n }\n }\n\n defaultFunc.reset();\n\n count = [0, 0, 0];\n for (m = 0; m < candidates.length; m++) {\n count[candidates[m].group]++;\n }\n\n if (count[defNone] > 0) {\n defaultResult = defFalse;\n } else {\n defaultResult = defTrue;\n if ((count[defTrue] + count[defFalse]) > 1) {\n throw { type: 'Runtime',\n message: `Ambiguous use of \\`default()\\` found when matching for \\`${this.format(args)}\\``,\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n }\n\n for (m = 0; m < candidates.length; m++) {\n candidate = candidates[m].group;\n if ((candidate === defNone) || (candidate === defaultResult)) {\n try {\n mixin = candidates[m].mixin;\n if (!(mixin instanceof MixinDefinition)) {\n originalRuleset = mixin.originalRuleset || mixin;\n mixin = new MixinDefinition('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo());\n mixin.originalRuleset = originalRuleset;\n }\n const newRules = mixin.evalCall(context, args, this.important).rules;\n this._setVisibilityToReplacement(newRules);\n Array.prototype.push.apply(rules, newRules);\n } catch (e) {\n throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack };\n }\n }\n }\n\n if (match) {\n return rules;\n }\n }\n }\n if (isOneFound) {\n throw { type: 'Runtime',\n message: `No matching definition was found for \\`${this.format(args)}\\``,\n index: this.getIndex(), filename: this.fileInfo().filename };\n } else {\n throw { type: 'Name',\n message: `${this.selector.toCSS().trim()} is undefined`,\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n }\n\n _setVisibilityToReplacement(replacement) {\n let i;\n let rule;\n if (this.blocksVisibility()) {\n for (i = 0; i < replacement.length; i++) {\n rule = replacement[i];\n rule.addVisibilityBlock();\n }\n }\n }\n\n format(args) {\n return `${this.selector.toCSS().trim()}(${args ? args.map(a => {\n let argValue = '';\n if (a.name) {\n argValue += `${a.name}:`;\n }\n if (a.value.toCSS) {\n argValue += a.value.toCSS();\n } else {\n argValue += '???';\n }\n return argValue;\n }).join(', ') : ''})`;\n }\n}\n\nMixinCall.prototype.type = 'MixinCall';\nexport default MixinCall;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/mixin-definition.js b/packages/less/lib/less/tree/mixin-definition.js deleted file mode 100644 index ddbaf3cb0..000000000 --- a/packages/less/lib/less/tree/mixin-definition.js +++ /dev/null @@ -1,251 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var selector_1 = __importDefault(require("./selector")); -var element_1 = __importDefault(require("./element")); -var ruleset_1 = __importDefault(require("./ruleset")); -var declaration_1 = __importDefault(require("./declaration")); -var detached_ruleset_1 = __importDefault(require("./detached-ruleset")); -var expression_1 = __importDefault(require("./expression")); -var contexts_1 = __importDefault(require("../contexts")); -var utils = __importStar(require("../utils")); -var Definition = /** @class */ (function (_super) { - __extends(Definition, _super); - function Definition(name, params, rules, condition, variadic, frames, visibilityInfo) { - var _this = _super.call(this) || this; - _this.name = name || 'anonymous mixin'; - _this.selectors = [new selector_1.default([new element_1.default(null, name, false, _this._index, _this._fileInfo)])]; - _this.params = params; - _this.condition = condition; - _this.variadic = variadic; - _this.arity = params.length; - _this.rules = rules; - _this._lookups = {}; - var optionalParameters = []; - _this.required = params.reduce(function (count, p) { - if (!p.name || (p.name && !p.value)) { - return count + 1; - } - else { - optionalParameters.push(p.name); - return count; - } - }, 0); - _this.optionalParameters = optionalParameters; - _this.frames = frames; - _this.copyVisibilityInfo(visibilityInfo); - _this.allowRoot = true; - return _this; - } - Definition.prototype.accept = function (visitor) { - if (this.params && this.params.length) { - this.params = visitor.visitArray(this.params); - } - this.rules = visitor.visitArray(this.rules); - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }; - Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) { - /* jshint boss:true */ - var frame = new ruleset_1.default(null, null); - var varargs; - var arg; - var params = utils.copyArray(this.params); - var i; - var j; - var val; - var name; - var isNamedFound; - var argIndex; - var argsLength = 0; - if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) { - frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit(); - } - mixinEnv = new contexts_1.default.Eval(mixinEnv, [frame].concat(mixinEnv.frames)); - if (args) { - args = utils.copyArray(args); - argsLength = args.length; - for (i = 0; i < argsLength; i++) { - arg = args[i]; - if (name = (arg && arg.name)) { - isNamedFound = false; - for (j = 0; j < params.length; j++) { - if (!evaldArguments[j] && name === params[j].name) { - evaldArguments[j] = arg.value.eval(context); - frame.prependRule(new declaration_1.default(name, arg.value.eval(context))); - isNamedFound = true; - break; - } - } - if (isNamedFound) { - args.splice(i, 1); - i--; - continue; - } - else { - throw { type: 'Runtime', message: "Named argument for " + this.name + " " + args[i].name + " not found" }; - } - } - } - } - argIndex = 0; - for (i = 0; i < params.length; i++) { - if (evaldArguments[i]) { - continue; - } - arg = args && args[argIndex]; - if (name = params[i].name) { - if (params[i].variadic) { - varargs = []; - for (j = argIndex; j < argsLength; j++) { - varargs.push(args[j].value.eval(context)); - } - frame.prependRule(new declaration_1.default(name, new expression_1.default(varargs).eval(context))); - } - else { - val = arg && arg.value; - if (val) { - // This was a mixin call, pass in a detached ruleset of it's eval'd rules - if (Array.isArray(val)) { - val = new detached_ruleset_1.default(new ruleset_1.default('', val)); - } - else { - val = val.eval(context); - } - } - else if (params[i].value) { - val = params[i].value.eval(mixinEnv); - frame.resetCache(); - } - else { - throw { type: 'Runtime', message: "wrong number of arguments for " + this.name + " (" + argsLength + " for " + this.arity + ")" }; - } - frame.prependRule(new declaration_1.default(name, val)); - evaldArguments[i] = val; - } - } - if (params[i].variadic && args) { - for (j = argIndex; j < argsLength; j++) { - evaldArguments[j] = args[j].value.eval(context); - } - } - argIndex++; - } - return frame; - }; - Definition.prototype.makeImportant = function () { - var rules = !this.rules ? this.rules : this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(true); - } - else { - return r; - } - }); - var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames); - return result; - }; - Definition.prototype.eval = function (context) { - return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames)); - }; - Definition.prototype.evalCall = function (context, args, important) { - var _arguments = []; - var mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames; - var frame = this.evalParams(context, new contexts_1.default.Eval(context, mixinFrames), args, _arguments); - var rules; - var ruleset; - frame.prependRule(new declaration_1.default('@arguments', new expression_1.default(_arguments).eval(context))); - rules = utils.copyArray(this.rules); - ruleset = new ruleset_1.default(null, rules); - ruleset.originalRuleset = this; - ruleset = ruleset.eval(new contexts_1.default.Eval(context, [this, frame].concat(mixinFrames))); - if (important) { - ruleset = ruleset.makeImportant(); - } - return ruleset; - }; - Definition.prototype.matchCondition = function (args, context) { - if (this.condition && !this.condition.eval(new contexts_1.default.Eval(context, [this.evalParams(context, /* the parameter variables */ new contexts_1.default.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] - .concat(this.frames || []) // the parent namespace/mixin frames - .concat(context.frames)))) { // the current environment frames - return false; - } - return true; - }; - Definition.prototype.matchArgs = function (args, context) { - var allArgsCnt = (args && args.length) || 0; - var len; - var optionalParameters = this.optionalParameters; - var requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) { - if (optionalParameters.indexOf(p.name) < 0) { - return count + 1; - } - else { - return count; - } - }, 0); - if (!this.variadic) { - if (requiredArgsCnt < this.required) { - return false; - } - if (allArgsCnt > this.params.length) { - return false; - } - } - else { - if (requiredArgsCnt < (this.required - 1)) { - return false; - } - } - // check patterns - len = Math.min(requiredArgsCnt, this.arity); - for (var i = 0; i < len; i++) { - if (!this.params[i].name && !this.params[i].variadic) { - if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) { - return false; - } - } - } - return true; - }; - return Definition; -}(ruleset_1.default)); -Definition.prototype.type = 'MixinDefinition'; -Definition.prototype.evalFirst = true; -exports.default = Definition; -//# sourceMappingURL=mixin-definition.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/mixin-definition.js.map b/packages/less/lib/less/tree/mixin-definition.js.map deleted file mode 100644 index 56a1c11f2..000000000 --- a/packages/less/lib/less/tree/mixin-definition.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mixin-definition.js","sourceRoot":"","sources":["../../../src/less/tree/mixin-definition.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,sDAAgC;AAChC,sDAAgC;AAChC,8DAAwC;AACxC,wEAAiD;AACjD,4DAAsC;AACtC,yDAAmC;AACnC,8CAAkC;AAElC;IAAyB,8BAAO;IAC5B,oBAAY,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc;QAA5E,YACI,iBAAO,SAwBV;QAtBG,KAAI,CAAC,IAAI,GAAG,IAAI,IAAI,iBAAiB,CAAC;QACtC,KAAI,CAAC,SAAS,GAAG,CAAC,IAAI,kBAAQ,CAAC,CAAC,IAAI,iBAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAI,CAAC,MAAM,EAAE,KAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/F,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;QAC3B,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAM,kBAAkB,GAAG,EAAE,CAAC;QAC9B,KAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAC,KAAK,EAAE,CA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C,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBACnF,OAAO,KAAK,CAAC;iBAChB;aACJ;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,iBAAC;AAAD,CAAC,AAvND,CAAyB,iBAAO,GAuN/B;AAED,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,iBAAiB,CAAC;AAC9C,UAAU,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;AACtC,kBAAe,UAAU,CAAC","sourcesContent":["import Selector from './selector';\nimport Element from './element';\nimport Ruleset from './ruleset';\nimport Declaration from './declaration';\nimport DetachedRuleset from './detached-ruleset';\nimport Expression from './expression';\nimport contexts from '../contexts';\nimport * as utils from '../utils';\n\nclass Definition extends Ruleset {\n constructor(name, params, rules, condition, variadic, frames, visibilityInfo) {\n super();\n\n this.name = name || 'anonymous mixin';\n this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])];\n this.params = params;\n this.condition = condition;\n this.variadic = variadic;\n this.arity = params.length;\n this.rules = rules;\n this._lookups = {};\n const optionalParameters = [];\n this.required = params.reduce((count, p) => {\n if (!p.name || (p.name && !p.value)) {\n return count + 1;\n }\n else {\n optionalParameters.push(p.name);\n return count;\n }\n }, 0);\n this.optionalParameters = optionalParameters;\n this.frames = frames;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n }\n\n accept(visitor) {\n if (this.params && this.params.length) {\n this.params = visitor.visitArray(this.params);\n }\n this.rules = visitor.visitArray(this.rules);\n if (this.condition) {\n this.condition = visitor.visit(this.condition);\n }\n }\n\n evalParams(context, mixinEnv, args, evaldArguments) {\n /* jshint boss:true */\n const frame = new Ruleset(null, null);\n\n let varargs;\n let arg;\n const params = utils.copyArray(this.params);\n let i;\n let j;\n let val;\n let name;\n let isNamedFound;\n let argIndex;\n let argsLength = 0;\n\n if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) {\n frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit();\n }\n mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames));\n\n if (args) {\n args = utils.copyArray(args);\n argsLength = args.length;\n\n for (i = 0; i < argsLength; i++) {\n arg = args[i];\n if (name = (arg && arg.name)) {\n isNamedFound = false;\n for (j = 0; j < params.length; j++) {\n if (!evaldArguments[j] && name === params[j].name) {\n evaldArguments[j] = arg.value.eval(context);\n frame.prependRule(new Declaration(name, arg.value.eval(context)));\n isNamedFound = true;\n break;\n }\n }\n if (isNamedFound) {\n args.splice(i, 1);\n i--;\n continue;\n } else {\n throw { type: 'Runtime', message: `Named argument for ${this.name} ${args[i].name} not found` };\n }\n }\n }\n }\n argIndex = 0;\n for (i = 0; i < params.length; i++) {\n if (evaldArguments[i]) { continue; }\n\n arg = args && args[argIndex];\n\n if (name = params[i].name) {\n if (params[i].variadic) {\n varargs = [];\n for (j = argIndex; j < argsLength; j++) {\n varargs.push(args[j].value.eval(context));\n }\n frame.prependRule(new Declaration(name, new Expression(varargs).eval(context)));\n } else {\n val = arg && arg.value;\n if (val) {\n // This was a mixin call, pass in a detached ruleset of it's eval'd rules\n if (Array.isArray(val)) {\n val = new DetachedRuleset(new Ruleset('', val));\n }\n else {\n val = val.eval(context);\n }\n } else if (params[i].value) {\n val = params[i].value.eval(mixinEnv);\n frame.resetCache();\n } else {\n throw { type: 'Runtime', message: `wrong number of arguments for ${this.name} (${argsLength} for ${this.arity})` };\n }\n\n frame.prependRule(new Declaration(name, val));\n evaldArguments[i] = val;\n }\n }\n\n if (params[i].variadic && args) {\n for (j = argIndex; j < argsLength; j++) {\n evaldArguments[j] = args[j].value.eval(context);\n }\n }\n argIndex++;\n }\n\n return frame;\n }\n\n makeImportant() {\n const rules = !this.rules ? this.rules : this.rules.map(r => {\n if (r.makeImportant) {\n return r.makeImportant(true);\n } else {\n return r;\n }\n });\n const result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames);\n return result;\n }\n\n eval(context) {\n return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames));\n }\n\n evalCall(context, args, important) {\n const _arguments = [];\n const mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames;\n const frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments);\n let rules;\n let ruleset;\n\n frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context)));\n\n rules = utils.copyArray(this.rules);\n\n ruleset = new Ruleset(null, rules);\n ruleset.originalRuleset = this;\n ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames)));\n if (important) {\n ruleset = ruleset.makeImportant();\n }\n return ruleset;\n }\n\n matchCondition(args, context) {\n if (this.condition && !this.condition.eval(\n new contexts.Eval(context,\n [this.evalParams(context, /* the parameter variables */\n new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]\n .concat(this.frames || []) // the parent namespace/mixin frames\n .concat(context.frames)))) { // the current environment frames\n return false;\n }\n return true;\n }\n\n matchArgs(args, context) {\n const allArgsCnt = (args && args.length) || 0;\n let len;\n const optionalParameters = this.optionalParameters;\n const requiredArgsCnt = !args ? 0 : args.reduce((count, p) => {\n if (optionalParameters.indexOf(p.name) < 0) {\n return count + 1;\n } else {\n return count;\n }\n }, 0);\n\n if (!this.variadic) {\n if (requiredArgsCnt < this.required) {\n return false;\n }\n if (allArgsCnt > this.params.length) {\n return false;\n }\n } else {\n if (requiredArgsCnt < (this.required - 1)) {\n return false;\n }\n }\n\n // check patterns\n len = Math.min(requiredArgsCnt, this.arity);\n\n for (let i = 0; i < len; i++) {\n if (!this.params[i].name && !this.params[i].variadic) {\n if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) {\n return false;\n }\n }\n }\n return true;\n }\n}\n\nDefinition.prototype.type = 'MixinDefinition';\nDefinition.prototype.evalFirst = true;\nexport default Definition;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/namespace-value.js b/packages/less/lib/less/tree/namespace-value.js deleted file mode 100644 index b1d2f45f2..000000000 --- a/packages/less/lib/less/tree/namespace-value.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var variable_1 = __importDefault(require("./variable")); -var ruleset_1 = __importDefault(require("./ruleset")); -var selector_1 = __importDefault(require("./selector")); -var NamespaceValue = /** @class */ (function (_super) { - __extends(NamespaceValue, _super); - function NamespaceValue(ruleCall, lookups, index, fileInfo) { - var _this = _super.call(this) || this; - _this.value = ruleCall; - _this.lookups = lookups; - _this._index = index; - _this._fileInfo = fileInfo; - return _this; - } - NamespaceValue.prototype.eval = function (context) { - var i; - var j; - var name; - var rules = this.value.eval(context); - for (i = 0; i < this.lookups.length; i++) { - name = this.lookups[i]; - /** - * Eval'd DRs return rulesets. - * Eval'd mixins return rules, so let's make a ruleset if we need it. - * We need to do this because of late parsing of values - */ - if (Array.isArray(rules)) { - rules = new ruleset_1.default([new selector_1.default()], rules); - } - if (name === '') { - rules = rules.lastDeclaration(); - } - else if (name.charAt(0) === '@') { - if (name.charAt(1) === '@') { - name = "@" + new variable_1.default(name.substr(1)).eval(context).value; - } - if (rules.variables) { - rules = rules.variable(name); - } - if (!rules) { - throw { type: 'Name', message: "variable " + name + " not found", filename: this.fileInfo().filename, - index: this.getIndex() }; - } - } - else { - if (name.substring(0, 2) === '$@') { - name = "$" + new variable_1.default(name.substr(1)).eval(context).value; - } - else { - name = name.charAt(0) === '$' ? name : "$" + name; - } - if (rules.properties) { - rules = rules.property(name); - } - if (!rules) { - throw { type: 'Name', message: "property \"" + name.substr(1) + "\" not found", filename: this.fileInfo().filename, - index: this.getIndex() }; - } - // Properties are an array of values, since a ruleset can have multiple props. - // We pick the last one (the "cascaded" value) - rules = rules[rules.length - 1]; - } - if (rules.value) { - rules = rules.eval(context).value; - } - if (rules.ruleset) { - rules = rules.ruleset.eval(context); - } - } - return rules; - }; - return NamespaceValue; -}(node_1.default)); -NamespaceValue.prototype.type = 'NamespaceValue'; -exports.default = NamespaceValue; -//# sourceMappingURL=namespace-value.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/namespace-value.js.map b/packages/less/lib/less/tree/namespace-value.js.map deleted file mode 100644 index 2c1591ee9..000000000 --- a/packages/less/lib/less/tree/namespace-value.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"namespace-value.js","sourceRoot":"","sources":["../../../src/less/tree/namespace-value.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAClC,sDAAgC;AAChC,wDAAkC;AAElC;IAA6B,kCAAI;IAC7B,wBAAY,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ;QAA9C,YACI,iBAAO,SAMV;QAJG,KAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;QACtB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;;IAC9B,CAAC;IAED,6BAAI,GAAJ,UAAK,OAAO;QACR,IAAI,CAAC,CAAC;QACN,IAAI,CAAC,CAAC;QACN,IAAI,IAAI,CAAC;QACT,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAA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AC,OAAO,CAAC,CAAC,KAAO,CAAC;iBACjE;qBACI;oBACD,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAI,IAAM,CAAC;iBACrD;gBACD,IAAI,KAAK,CAAC,UAAU,EAAE;oBAClB,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;iBAChC;gBAED,IAAI,CAAC,KAAK,EAAE;oBACR,MAAM,EAAE,IAAI,EAAE,MAAM,EAChB,OAAO,EAAE,gBAAa,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAa,EACjD,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ;wBAClC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;iBAChC;gBACD,8EAA8E;gBAC9E,8CAA8C;gBAC9C,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;aACnC;YAED,IAAI,KAAK,CAAC,KAAK,EAAE;gBACb,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;aACrC;YACD,IAAI,KAAK,CAAC,OAAO,EAAE;gBACf,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACvC;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IACL,qBAAC;AAAD,CAAC,AA7ED,CAA6B,cAAI,GA6EhC;AAED,cAAc,CAAC,SAAS,CAAC,IAAI,GAAG,gBAAgB,CAAC;AACjD,kBAAe,cAAc,CAAC","sourcesContent":["import Node from './node';\nimport Variable from './variable';\nimport Ruleset from './ruleset';\nimport Selector from './selector';\n\nclass NamespaceValue extends Node {\n constructor(ruleCall, lookups, index, fileInfo) {\n super();\n\n this.value = ruleCall;\n this.lookups = lookups;\n this._index = index;\n this._fileInfo = fileInfo;\n }\n\n eval(context) {\n let i;\n let j;\n let name;\n let rules = this.value.eval(context);\n\n for (i = 0; i < this.lookups.length; i++) {\n name = this.lookups[i];\n\n /**\n * Eval'd DRs return rulesets.\n * Eval'd mixins return rules, so let's make a ruleset if we need it.\n * We need to do this because of late parsing of values\n */\n if (Array.isArray(rules)) {\n rules = new Ruleset([new Selector()], rules);\n }\n\n if (name === '') {\n rules = rules.lastDeclaration();\n }\n else if (name.charAt(0) === '@') {\n if (name.charAt(1) === '@') {\n name = `@${new Variable(name.substr(1)).eval(context).value}`;\n }\n if (rules.variables) {\n rules = rules.variable(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `variable ${name} not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n }\n else {\n if (name.substring(0, 2) === '$@') {\n name = `$${new Variable(name.substr(1)).eval(context).value}`;\n }\n else {\n name = name.charAt(0) === '$' ? name : `$${name}`;\n }\n if (rules.properties) {\n rules = rules.property(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `property \"${name.substr(1)}\" not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n // Properties are an array of values, since a ruleset can have multiple props.\n // We pick the last one (the \"cascaded\" value)\n rules = rules[rules.length - 1];\n }\n\n if (rules.value) {\n rules = rules.eval(context).value;\n }\n if (rules.ruleset) {\n rules = rules.ruleset.eval(context);\n }\n }\n return rules;\n }\n}\n\nNamespaceValue.prototype.type = 'NamespaceValue';\nexport default NamespaceValue;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/negative.js b/packages/less/lib/less/tree/negative.js deleted file mode 100644 index b6476cff0..000000000 --- a/packages/less/lib/less/tree/negative.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var operation_1 = __importDefault(require("./operation")); -var dimension_1 = __importDefault(require("./dimension")); -var Negative = /** @class */ (function (_super) { - __extends(Negative, _super); - function Negative(node) { - var _this = _super.call(this) || this; - _this.value = node; - return _this; - } - Negative.prototype.genCSS = function (context, output) { - output.add('-'); - this.value.genCSS(context, output); - }; - Negative.prototype.eval = function (context) { - if (context.isMathOn()) { - return (new operation_1.default('*', [new dimension_1.default(-1), this.value])).eval(context); - } - return new Negative(this.value.eval(context)); - }; - return Negative; -}(node_1.default)); -Negative.prototype.type = 'Negative'; -exports.default = Negative; -//# sourceMappingURL=negative.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/negative.js.map b/packages/less/lib/less/tree/negative.js.map deleted file mode 100644 index 24d86d1f5..000000000 --- a/packages/less/lib/less/tree/negative.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"negative.js","sourceRoot":"","sources":["../../../src/less/tree/negative.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0DAAoC;AACpC,0DAAoC;AAEpC;IAAuB,4BAAI;IACvB,kBAAY,IAAI;QAAhB,YACI,iBAAO,SAGV;QADG,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;;IACtB,CAAC;IAED,yBAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,uBAAI,GAAJ,UAAK,OAAO;QACR,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE;YACpB,OAAO,CAAC,IAAI,mBAAS,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAS,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC9E;QACD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC;IACL,eAAC;AAAD,CAAC,AAlBD,CAAuB,cAAI,GAkB1B;AAED,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC;AACrC,kBAAe,QAAQ,CAAC","sourcesContent":["import Node from './node';\nimport Operation from './operation';\nimport Dimension from './dimension';\n\nclass Negative extends Node {\n constructor(node) {\n super();\n\n this.value = node;\n }\n\n genCSS(context, output) {\n output.add('-');\n this.value.genCSS(context, output);\n }\n\n eval(context) {\n if (context.isMathOn()) {\n return (new Operation('*', [new Dimension(-1), this.value])).eval(context);\n }\n return new Negative(this.value.eval(context));\n }\n}\n\nNegative.prototype.type = 'Negative';\nexport default Negative;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/node.js b/packages/less/lib/less/tree/node.js deleted file mode 100644 index 2ba9847ce..000000000 --- a/packages/less/lib/less/tree/node.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Node = /** @class */ (function () { - function Node() { - this.parent = null; - this.visibilityBlocks = undefined; - this.nodeVisible = undefined; - this.rootNode = null; - this.parsed = null; - var self = this; - Object.defineProperty(this, 'currentFileInfo', { - get: function () { return self.fileInfo(); } - }); - Object.defineProperty(this, 'index', { - get: function () { return self.getIndex(); } - }); - } - Node.prototype.setParent = function (nodes, parent) { - function set(node) { - if (node && node instanceof Node) { - node.parent = parent; - } - } - if (Array.isArray(nodes)) { - nodes.forEach(set); - } - else { - set(nodes); - } - }; - Node.prototype.getIndex = function () { - return this._index || (this.parent && this.parent.getIndex()) || 0; - }; - Node.prototype.fileInfo = function () { - return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; - }; - Node.prototype.isRulesetLike = function () { - return false; - }; - Node.prototype.toCSS = function (context) { - var strs = []; - this.genCSS(context, { - add: function (chunk, fileInfo, index) { - strs.push(chunk); - }, - isEmpty: function () { - return strs.length === 0; - } - }); - return strs.join(''); - }; - Node.prototype.genCSS = function (context, output) { - output.add(this.value); - }; - Node.prototype.accept = function (visitor) { - this.value = visitor.visit(this.value); - }; - Node.prototype.eval = function () { return this; }; - Node.prototype._operate = function (context, op, a, b) { - switch (op) { - case '+': return a + b; - case '-': return a - b; - case '*': return a * b; - case '/': return a / b; - } - }; - Node.prototype.fround = function (context, value) { - var precision = context && context.numPrecision; - // add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded: - return (precision) ? Number((value + 2e-16).toFixed(precision)) : value; - }; - // Returns true if this node represents root of ast imported by reference - Node.prototype.blocksVisibility = function () { - if (this.visibilityBlocks == null) { - this.visibilityBlocks = 0; - } - return this.visibilityBlocks !== 0; - }; - Node.prototype.addVisibilityBlock = function () { - if (this.visibilityBlocks == null) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks + 1; - }; - Node.prototype.removeVisibilityBlock = function () { - if (this.visibilityBlocks == null) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks - 1; - }; - // Turns on node visibility - if called node will be shown in output regardless - // of whether it comes from import by reference or not - Node.prototype.ensureVisibility = function () { - this.nodeVisible = true; - }; - // Turns off node visibility - if called node will NOT be shown in output regardless - // of whether it comes from import by reference or not - Node.prototype.ensureInvisibility = function () { - this.nodeVisible = false; - }; - // return values: - // false - the node must not be visible - // true - the node must be visible - // undefined or null - the node has the same visibility as its parent - Node.prototype.isVisible = function () { - return this.nodeVisible; - }; - Node.prototype.visibilityInfo = function () { - return { - visibilityBlocks: this.visibilityBlocks, - nodeVisible: this.nodeVisible - }; - }; - Node.prototype.copyVisibilityInfo = function (info) { - if (!info) { - return; - } - this.visibilityBlocks = info.visibilityBlocks; - this.nodeVisible = info.nodeVisible; - }; - return Node; -}()); -Node.compare = function (a, b) { - /* returns: - -1: a < b - 0: a = b - 1: a > b - and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */ - if ((a.compare) && - // for "symmetric results" force toCSS-based comparison - // of Quoted or Anonymous if either value is one of those - !(b.type === 'Quoted' || b.type === 'Anonymous')) { - return a.compare(b); - } - else if (b.compare) { - return -b.compare(a); - } - else if (a.type !== b.type) { - return undefined; - } - a = a.value; - b = b.value; - if (!Array.isArray(a)) { - return a === b ? 0 : undefined; - } - if (a.length !== b.length) { - return undefined; - } - for (var i = 0; i < a.length; i++) { - if (Node.compare(a[i], b[i]) !== 0) { - return undefined; - } - } - return 0; -}; -Node.numericCompare = function (a, b) { return a < b ? -1 - : a === b ? 0 - : a > b ? 1 : undefined; }; -exports.default = Node; -//# sourceMappingURL=node.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/node.js.map b/packages/less/lib/less/tree/node.js.map deleted file mode 100644 index 5226688f5..000000000 --- a/packages/less/lib/less/tree/node.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/less/tree/node.js"],"names":[],"mappings":";;AAAA;IACI;QACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAClC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,IAAM,IAAI,GAAG,IAAI,CAAC;QAClB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,EAAE;YAC3C,GAAG,EAAE,cAAa,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,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AAC","sourcesContent":["class Node {\n constructor() {\n this.parent = null;\n this.visibilityBlocks = undefined;\n this.nodeVisible = undefined;\n this.rootNode = null;\n this.parsed = null;\n\n const self = this;\n Object.defineProperty(this, 'currentFileInfo', {\n get: function() { return self.fileInfo(); }\n });\n Object.defineProperty(this, 'index', {\n get: function() { return self.getIndex(); }\n });\n\n }\n\n setParent(nodes, parent) {\n function set(node) {\n if (node && node instanceof Node) {\n node.parent = parent;\n }\n }\n if (Array.isArray(nodes)) {\n nodes.forEach(set);\n }\n else {\n set(nodes);\n }\n }\n\n getIndex() {\n return this._index || (this.parent && this.parent.getIndex()) || 0;\n }\n\n fileInfo() {\n return this._fileInfo || (this.parent && this.parent.fileInfo()) || {};\n }\n\n isRulesetLike() {\n return false;\n }\n\n toCSS(context) {\n const strs = [];\n this.genCSS(context, {\n add: function(chunk, fileInfo, index) {\n strs.push(chunk);\n },\n isEmpty: function () {\n return strs.length === 0;\n }\n });\n return strs.join('');\n }\n\n genCSS(context, output) {\n output.add(this.value);\n }\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n }\n\n eval() { return this; }\n\n _operate(context, op, a, b) {\n switch (op) {\n case '+': return a + b;\n case '-': return a - b;\n case '*': return a * b;\n case '/': return a / b;\n }\n }\n\n fround(context, value) {\n const precision = context && context.numPrecision;\n // add \"epsilon\" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded:\n return (precision) ? Number((value + 2e-16).toFixed(precision)) : value;\n }\n\n // Returns true if this node represents root of ast imported by reference\n blocksVisibility() {\n if (this.visibilityBlocks == null) {\n this.visibilityBlocks = 0;\n }\n return this.visibilityBlocks !== 0;\n }\n\n addVisibilityBlock() {\n if (this.visibilityBlocks == null) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks + 1;\n }\n\n removeVisibilityBlock() {\n if (this.visibilityBlocks == null) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks - 1;\n }\n\n // Turns on node visibility - if called node will be shown in output regardless\n // of whether it comes from import by reference or not\n ensureVisibility() {\n this.nodeVisible = true;\n }\n\n // Turns off node visibility - if called node will NOT be shown in output regardless\n // of whether it comes from import by reference or not\n ensureInvisibility() {\n this.nodeVisible = false;\n }\n\n // return values:\n // false - the node must not be visible\n // true - the node must be visible\n // undefined or null - the node has the same visibility as its parent\n isVisible() {\n return this.nodeVisible;\n }\n\n visibilityInfo() {\n return {\n visibilityBlocks: this.visibilityBlocks,\n nodeVisible: this.nodeVisible\n };\n }\n\n copyVisibilityInfo(info) {\n if (!info) {\n return;\n }\n this.visibilityBlocks = info.visibilityBlocks;\n this.nodeVisible = info.nodeVisible;\n }\n}\n\nNode.compare = (a, b) => {\n /* returns:\n -1: a < b\n 0: a = b\n 1: a > b\n and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */\n\n if ((a.compare) &&\n // for \"symmetric results\" force toCSS-based comparison\n // of Quoted or Anonymous if either value is one of those\n !(b.type === 'Quoted' || b.type === 'Anonymous')) {\n return a.compare(b);\n } else if (b.compare) {\n return -b.compare(a);\n } else if (a.type !== b.type) {\n return undefined;\n }\n\n a = a.value;\n b = b.value;\n if (!Array.isArray(a)) {\n return a === b ? 0 : undefined;\n }\n if (a.length !== b.length) {\n return undefined;\n }\n for (let i = 0; i < a.length; i++) {\n if (Node.compare(a[i], b[i]) !== 0) {\n return undefined;\n }\n }\n return 0;\n};\n\nNode.numericCompare = (a, b) => a < b ? -1\n : a === b ? 0\n : a > b ? 1 : undefined;\nexport default Node;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/operation.js b/packages/less/lib/less/tree/operation.js deleted file mode 100644 index 6d3498b3c..000000000 --- a/packages/less/lib/less/tree/operation.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var color_1 = __importDefault(require("./color")); -var dimension_1 = __importDefault(require("./dimension")); -var Constants = __importStar(require("../constants")); -var MATH = Constants.Math; -var Operation = /** @class */ (function (_super) { - __extends(Operation, _super); - function Operation(op, operands, isSpaced) { - var _this = _super.call(this) || this; - _this.op = op.trim(); - _this.operands = operands; - _this.isSpaced = isSpaced; - return _this; - } - Operation.prototype.accept = function (visitor) { - this.operands = visitor.visitArray(this.operands); - }; - Operation.prototype.eval = function (context) { - var a = this.operands[0].eval(context); - var b = this.operands[1].eval(context); - var op; - if (context.isMathOn(this.op)) { - op = this.op === './' ? '/' : this.op; - if (a instanceof dimension_1.default && b instanceof color_1.default) { - a = a.toColor(); - } - if (b instanceof dimension_1.default && a instanceof color_1.default) { - b = b.toColor(); - } - if (!a.operate) { - if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) { - return new Operation(this.op, [a, b], this.isSpaced); - } - throw { type: 'Operation', - message: 'Operation on an invalid type' }; - } - return a.operate(context, op, b); - } - else { - return new Operation(this.op, [a, b], this.isSpaced); - } - }; - Operation.prototype.genCSS = function (context, output) { - this.operands[0].genCSS(context, output); - if (this.isSpaced) { - output.add(' '); - } - output.add(this.op); - if (this.isSpaced) { - output.add(' '); - } - this.operands[1].genCSS(context, output); - }; - return Operation; -}(node_1.default)); -Operation.prototype.type = 'Operation'; -exports.default = Operation; -//# sourceMappingURL=operation.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/operation.js.map b/packages/less/lib/less/tree/operation.js.map deleted file mode 100644 index f642c1473..000000000 --- a/packages/less/lib/less/tree/operation.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/less/tree/operation.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,kDAA4B;AAC5B,0DAAoC;AACpC,sDAA0C;AAC1C,IAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAG5B;IAAwB,6BAAI;IACxB,mBAAY,EAAE,EAAE,QAAQ,EAAE,QAAQ;QAAlC,YACI,iBAAO,SAKV;QAHG,KAAI,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;QACpB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;IAC7B,CAAC;IAED,0BAAM,GAAN,UAAO,OAAO;QACV,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,wBAAI,GAAJ,UAAK,OAAO;QACR,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,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AAE,MAAM,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACnB;QACD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACnB;QACD,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IACL,gBAAC;AAAD,CAAC,AAnDD,CAAwB,cAAI,GAmD3B;AAED,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,WAAW,CAAC;AACvC,kBAAe,SAAS,CAAC","sourcesContent":["import Node from './node';\nimport Color from './color';\nimport Dimension from './dimension';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\n\nclass Operation extends Node {\n constructor(op, operands, isSpaced) {\n super();\n\n this.op = op.trim();\n this.operands = operands;\n this.isSpaced = isSpaced;\n }\n\n accept(visitor) {\n this.operands = visitor.visitArray(this.operands);\n }\n\n eval(context) {\n let a = this.operands[0].eval(context);\n let b = this.operands[1].eval(context);\n let op;\n\n if (context.isMathOn(this.op)) {\n op = this.op === './' ? '/' : this.op;\n if (a instanceof Dimension && b instanceof Color) {\n a = a.toColor();\n }\n if (b instanceof Dimension && a instanceof Color) {\n b = b.toColor();\n }\n if (!a.operate) {\n if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n throw { type: 'Operation',\n message: 'Operation on an invalid type' };\n }\n\n return a.operate(context, op, b);\n } else {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n }\n\n genCSS(context, output) {\n this.operands[0].genCSS(context, output);\n if (this.isSpaced) {\n output.add(' ');\n }\n output.add(this.op);\n if (this.isSpaced) {\n output.add(' ');\n }\n this.operands[1].genCSS(context, output);\n }\n}\n\nOperation.prototype.type = 'Operation';\nexport default Operation;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/paren.js b/packages/less/lib/less/tree/paren.js deleted file mode 100644 index 4e2b3ce4e..000000000 --- a/packages/less/lib/less/tree/paren.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var Paren = /** @class */ (function (_super) { - __extends(Paren, _super); - function Paren(node) { - var _this = _super.call(this) || this; - _this.value = node; - return _this; - } - Paren.prototype.genCSS = function (context, output) { - output.add('('); - this.value.genCSS(context, output); - output.add(')'); - }; - Paren.prototype.eval = function (context) { - return new Paren(this.value.eval(context)); - }; - return Paren; -}(node_1.default)); -Paren.prototype.type = 'Paren'; -exports.default = Paren; -//# sourceMappingURL=paren.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/paren.js.map b/packages/less/lib/less/tree/paren.js.map deleted file mode 100644 index 6e46bc62c..000000000 --- a/packages/less/lib/less/tree/paren.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"paren.js","sourceRoot":"","sources":["../../../src/less/tree/paren.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAoB,yBAAI;IACpB,eAAY,IAAI;QAAhB,YACI,iBAAO,SAGV;QADG,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;;IACtB,CAAC;IAED,sBAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,oBAAI,GAAJ,UAAK,OAAO;QACR,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;IACL,YAAC;AAAD,CAAC,AAhBD,CAAoB,cAAI,GAgBvB;AAED,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,OAAO,CAAC;AAC/B,kBAAe,KAAK,CAAC","sourcesContent":["import Node from './node';\n\nclass Paren extends Node {\n constructor(node) {\n super();\n\n this.value = node;\n }\n\n genCSS(context, output) {\n output.add('(');\n this.value.genCSS(context, output);\n output.add(')');\n }\n\n eval(context) {\n return new Paren(this.value.eval(context));\n }\n}\n\nParen.prototype.type = 'Paren';\nexport default Paren;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/property.js b/packages/less/lib/less/tree/property.js deleted file mode 100644 index 11314d7a0..000000000 --- a/packages/less/lib/less/tree/property.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var declaration_1 = __importDefault(require("./declaration")); -var Property = /** @class */ (function (_super) { - __extends(Property, _super); - function Property(name, index, currentFileInfo) { - var _this = _super.call(this) || this; - _this.name = name; - _this._index = index; - _this._fileInfo = currentFileInfo; - return _this; - } - Property.prototype.eval = function (context) { - var property; - var name = this.name; - // TODO: shorten this reference - var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; - if (this.evaluating) { - throw { type: 'Name', message: "Recursive property reference for " + name, filename: this.fileInfo().filename, - index: this.getIndex() }; - } - this.evaluating = true; - property = this.find(context.frames, function (frame) { - var v; - var vArr = frame.property(name); - if (vArr) { - for (var i = 0; i < vArr.length; i++) { - v = vArr[i]; - vArr[i] = new declaration_1.default(v.name, v.value, v.important, v.merge, v.index, v.currentFileInfo, v.inline, v.variable); - } - mergeRules(vArr); - v = vArr[vArr.length - 1]; - if (v.important) { - var importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - v = v.value.eval(context); - return v; - } - }); - if (property) { - this.evaluating = false; - return property; - } - else { - throw { type: 'Name', message: "Property '" + name + "' is undefined", filename: this.currentFileInfo.filename, - index: this.index }; - } - }; - Property.prototype.find = function (obj, fun) { - for (var i = 0, r = void 0; i < obj.length; i++) { - r = fun.call(obj, obj[i]); - if (r) { - return r; - } - } - return null; - }; - return Property; -}(node_1.default)); -Property.prototype.type = 'Property'; -exports.default = Property; -//# sourceMappingURL=property.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/property.js.map b/packages/less/lib/less/tree/property.js.map deleted file mode 100644 index 888893944..000000000 --- a/packages/less/lib/less/tree/property.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"property.js","sourceRoot":"","sources":["../../../src/less/tree/property.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,8DAAwC;AAExC;IAAuB,4BAAI;IACvB,kBAAY,IAAI,EAAE,KAAK,EAAE,eAAe;QAAxC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sourcesContent":["import Node from './node';\nimport Declaration from './declaration';\n\nclass Property extends Node {\n constructor(name, index, currentFileInfo) {\n super();\n\n this.name = name;\n this._index = index;\n this._fileInfo = currentFileInfo;\n }\n\n eval(context) {\n let property;\n const name = this.name;\n // TODO: shorten this reference\n const mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;\n\n if (this.evaluating) {\n throw { type: 'Name',\n message: `Recursive property reference for ${name}`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n this.evaluating = true;\n\n property = this.find(context.frames, frame => {\n let v;\n const vArr = frame.property(name);\n if (vArr) {\n for (let i = 0; i < vArr.length; i++) {\n v = vArr[i];\n\n vArr[i] = new Declaration(v.name,\n v.value,\n v.important,\n v.merge,\n v.index,\n v.currentFileInfo,\n v.inline,\n v.variable\n );\n }\n mergeRules(vArr);\n\n v = vArr[vArr.length - 1];\n if (v.important) {\n const importantScope = context.importantScope[context.importantScope.length - 1];\n importantScope.important = v.important;\n }\n v = v.value.eval(context);\n return v;\n }\n });\n if (property) {\n this.evaluating = false;\n return property;\n } else {\n throw { type: 'Name',\n message: `Property '${name}' is undefined`,\n filename: this.currentFileInfo.filename,\n index: this.index };\n }\n }\n\n find(obj, fun) {\n for (let i = 0, r; i < obj.length; i++) {\n r = fun.call(obj, obj[i]);\n if (r) { return r; }\n }\n return null;\n }\n}\n\nProperty.prototype.type = 'Property';\nexport default Property;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/quoted.js b/packages/less/lib/less/tree/quoted.js deleted file mode 100644 index 4e83a7c79..000000000 --- a/packages/less/lib/less/tree/quoted.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var variable_1 = __importDefault(require("./variable")); -var property_1 = __importDefault(require("./property")); -var Quoted = /** @class */ (function (_super) { - __extends(Quoted, _super); - function Quoted(str, content, escaped, index, currentFileInfo) { - var _this = _super.call(this) || this; - _this.escaped = (escaped == null) ? true : escaped; - _this.value = content || ''; - _this.quote = str.charAt(0); - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.variableRegex = /@\{([\w-]+)\}/g; - _this.propRegex = /\$\{([\w-]+)\}/g; - _this.allowRoot = escaped; - return _this; - } - Quoted.prototype.genCSS = function (context, output) { - if (!this.escaped) { - output.add(this.quote, this.fileInfo(), this.getIndex()); - } - output.add(this.value); - if (!this.escaped) { - output.add(this.quote); - } - }; - Quoted.prototype.containsVariables = function () { - return this.value.match(this.variableRegex); - }; - Quoted.prototype.eval = function (context) { - var that = this; - var value = this.value; - var variableReplacement = function (_, name) { - var v = new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - var propertyReplacement = function (_, name) { - var v = new property_1.default("$" + name, that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - function iterativeReplace(value, regexp, replacementFnc) { - var evaluatedValue = value; - do { - value = evaluatedValue.toString(); - evaluatedValue = value.replace(regexp, replacementFnc); - } while (value !== evaluatedValue); - return evaluatedValue; - } - value = iterativeReplace(value, this.variableRegex, variableReplacement); - value = iterativeReplace(value, this.propRegex, propertyReplacement); - return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); - }; - Quoted.prototype.compare = function (other) { - // when comparing quoted strings allow the quote to differ - if (other.type === 'Quoted' && !this.escaped && !other.escaped) { - return node_1.default.numericCompare(this.value, other.value); - } - else { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - } - }; - return Quoted; -}(node_1.default)); -Quoted.prototype.type = 'Quoted'; -exports.default = Quoted; -//# sourceMappingURL=quoted.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/quoted.js.map b/packages/less/lib/less/tree/quoted.js.map deleted file mode 100644 index 837ad7525..000000000 --- a/packages/less/lib/less/tree/quoted.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"quoted.js","sourceRoot":"","sources":["../../../src/less/tree/quoted.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAClC,wDAAkC;AAGlC;IAAqB,0BAAI;IACrB,gBAAY,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe;QAAzD,YACI,iBAAO,SAUV;QARG,KAAI,CAAC,OAAO,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;QAClD,KAAI,CAAC,KAAK,GAAG,OAAO,IAAI,EAAE,CAAC;QAC3B,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3B,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,KAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC;QACtC,KAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;QACnC,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC;;IAC7B,CAAC;IAED,uBAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE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';\n\n\nclass Quoted extends Node {\n constructor(str, content, escaped, index, currentFileInfo) {\n super();\n\n this.escaped = (escaped == null) ? true : escaped;\n this.value = content || '';\n this.quote = str.charAt(0);\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.variableRegex = /@\\{([\\w-]+)\\}/g;\n this.propRegex = /\\$\\{([\\w-]+)\\}/g;\n this.allowRoot = escaped;\n }\n\n genCSS(context, output) {\n if (!this.escaped) {\n output.add(this.quote, this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n if (!this.escaped) {\n output.add(this.quote);\n }\n }\n\n containsVariables() {\n return this.value.match(this.variableRegex);\n }\n\n eval(context) {\n const that = this;\n let value = this.value;\n const variableReplacement = (_, name) => {\n const v = new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n const propertyReplacement = (_, name) => {\n const v = new Property(`$${name}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n function iterativeReplace(value, regexp, replacementFnc) {\n let evaluatedValue = value;\n do {\n value = evaluatedValue.toString();\n evaluatedValue = value.replace(regexp, replacementFnc);\n } while (value !== evaluatedValue);\n return evaluatedValue;\n }\n value = iterativeReplace(value, this.variableRegex, variableReplacement);\n value = iterativeReplace(value, this.propRegex, propertyReplacement);\n\n return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());\n }\n\n compare(other) {\n // when comparing quoted strings allow the quote to differ\n if (other.type === 'Quoted' && !this.escaped && !other.escaped) {\n return Node.numericCompare(this.value, other.value);\n } else {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n }\n }\n}\n\nQuoted.prototype.type = 'Quoted';\nexport default Quoted;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/ruleset.js b/packages/less/lib/less/tree/ruleset.js deleted file mode 100644 index e1139a6ff..000000000 --- a/packages/less/lib/less/tree/ruleset.js +++ /dev/null @@ -1,804 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var declaration_1 = __importDefault(require("./declaration")); -var keyword_1 = __importDefault(require("./keyword")); -var comment_1 = __importDefault(require("./comment")); -var paren_1 = __importDefault(require("./paren")); -var selector_1 = __importDefault(require("./selector")); -var element_1 = __importDefault(require("./element")); -var anonymous_1 = __importDefault(require("./anonymous")); -var contexts_1 = __importDefault(require("../contexts")); -var function_registry_1 = __importDefault(require("../functions/function-registry")); -var default_1 = __importDefault(require("../functions/default")); -var debug_info_1 = __importDefault(require("./debug-info")); -var utils = __importStar(require("../utils")); -var Ruleset = /** @class */ (function (_super) { - __extends(Ruleset, _super); - function Ruleset(selectors, rules, strictImports, visibilityInfo) { - var _this = _super.call(this) || this; - _this.selectors = selectors; - _this.rules = rules; - _this._lookups = {}; - _this._variables = null; - _this._properties = null; - _this.strictImports = strictImports; - _this.copyVisibilityInfo(visibilityInfo); - _this.allowRoot = true; - _this.setParent(_this.selectors, _this); - _this.setParent(_this.rules, _this); - return _this; - } - Ruleset.prototype.isRulesetLike = function () { - return true; - }; - Ruleset.prototype.accept = function (visitor) { - if (this.paths) { - this.paths = visitor.visitArray(this.paths, true); - } - else if (this.selectors) { - this.selectors = visitor.visitArray(this.selectors); - } - if (this.rules && this.rules.length) { - this.rules = visitor.visitArray(this.rules); - } - }; - Ruleset.prototype.eval = function (context) { - var that = this; - var selectors; - var selCnt; - var selector; - var i; - var hasVariable; - var hasOnePassingSelector = false; - if (this.selectors && (selCnt = this.selectors.length)) { - selectors = new Array(selCnt); - default_1.default.error({ - type: 'Syntax', - message: 'it is currently only allowed in parametric mixin guards,' - }); - for (i = 0; i < selCnt; i++) { - selector = this.selectors[i].eval(context); - for (var j = 0; j < selector.elements.length; j++) { - if (selector.elements[j].isVariable) { - hasVariable = true; - break; - } - } - selectors[i] = selector; - if (selector.evaldCondition) { - hasOnePassingSelector = true; - } - } - if (hasVariable) { - var toParseSelectors = new Array(selCnt); - for (i = 0; i < selCnt; i++) { - selector = selectors[i]; - toParseSelectors[i] = selector.toCSS(context); - } - this.parse.parseNode(toParseSelectors.join(','), ["selectors"], selectors[0].getIndex(), selectors[0].fileInfo(), function (err, result) { - if (result) { - selectors = utils.flattenArray(result); - } - }); - } - default_1.default.reset(); - } - else { - hasOnePassingSelector = true; - } - var rules = this.rules ? utils.copyArray(this.rules) : null; - var ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()); - var rule; - var subRule; - ruleset.originalRuleset = this; - ruleset.root = this.root; - ruleset.firstRoot = this.firstRoot; - ruleset.allowImports = this.allowImports; - if (this.debugInfo) { - ruleset.debugInfo = this.debugInfo; - } - if (!hasOnePassingSelector) { - rules.length = 0; - } - // inherit a function registry from the frames stack when possible; - // otherwise from the global registry - ruleset.functionRegistry = (function (frames) { - var i = 0; - var n = frames.length; - var found; - for (; i !== n; ++i) { - found = frames[i].functionRegistry; - if (found) { - return found; - } - } - return function_registry_1.default; - })(context.frames).inherit(); - // push the current ruleset to the frames stack - var ctxFrames = context.frames; - ctxFrames.unshift(ruleset); - // currrent selectors - var ctxSelectors = context.selectors; - if (!ctxSelectors) { - context.selectors = ctxSelectors = []; - } - ctxSelectors.unshift(this.selectors); - // Evaluate imports - if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) { - ruleset.evalImports(context); - } - // Store the frames around mixin definitions, - // so they can be evaluated like closures when the time comes. - var rsRules = ruleset.rules; - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.evalFirst) { - rsRules[i] = rule.eval(context); - } - } - var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0; - // Evaluate mixin calls. - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.type === 'MixinCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).filter(function (r) { - if ((r instanceof declaration_1.default) && r.variable) { - // do not pollute the scope if the variable is - // already there. consider returning false here - // but we need a way to "return" variable from mixins - return !(ruleset.variable(r.name)); - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } - else if (rule.type === 'VariableCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).rules.filter(function (r) { - if ((r instanceof declaration_1.default) && r.variable) { - // do not pollute the scope at all - return false; - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } - } - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - if (!rule.evalFirst) { - rsRules[i] = rule = rule.eval ? rule.eval(context) : rule; - } - } - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - // for rulesets, check if it is a css guard and can be removed - if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) { - // check if it can be folded in (e.g. & where) - if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) { - rsRules.splice(i--, 1); - for (var j = 0; (subRule = rule.rules[j]); j++) { - if (subRule instanceof node_1.default) { - subRule.copyVisibilityInfo(rule.visibilityInfo()); - if (!(subRule instanceof declaration_1.default) || !subRule.variable) { - rsRules.splice(++i, 0, subRule); - } - } - } - } - } - } - // Pop the stack - ctxFrames.shift(); - ctxSelectors.shift(); - if (context.mediaBlocks) { - for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) { - context.mediaBlocks[i].bubbleSelectors(selectors); - } - } - return ruleset; - }; - Ruleset.prototype.evalImports = function (context) { - var rules = this.rules; - var i; - var importRules; - if (!rules) { - return; - } - for (i = 0; i < rules.length; i++) { - if (rules[i].type === 'Import') { - importRules = rules[i].eval(context); - if (importRules && (importRules.length || importRules.length === 0)) { - rules.splice.apply(rules, [i, 1].concat(importRules)); - i += importRules.length - 1; - } - else { - rules.splice(i, 1, importRules); - } - this.resetCache(); - } - } - }; - Ruleset.prototype.makeImportant = function () { - var result = new Ruleset(this.selectors, this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(); - } - else { - return r; - } - }), this.strictImports, this.visibilityInfo()); - return result; - }; - Ruleset.prototype.matchArgs = function (args) { - return !args || args.length === 0; - }; - // lets you call a css selector with a guard - Ruleset.prototype.matchCondition = function (args, context) { - var lastSelector = this.selectors[this.selectors.length - 1]; - if (!lastSelector.evaldCondition) { - return false; - } - if (lastSelector.condition && - !lastSelector.condition.eval(new contexts_1.default.Eval(context, context.frames))) { - return false; - } - return true; - }; - Ruleset.prototype.resetCache = function () { - this._rulesets = null; - this._variables = null; - this._properties = null; - this._lookups = {}; - }; - Ruleset.prototype.variables = function () { - if (!this._variables) { - this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof declaration_1.default && r.variable === true) { - hash[r.name] = r; - } - // when evaluating variables in an import statement, imports have not been eval'd - // so we need to go inside import statements. - // guard against root being a string (in the case of inlined less) - if (r.type === 'Import' && r.root && r.root.variables) { - var vars = r.root.variables(); - for (var name_1 in vars) { - if (vars.hasOwnProperty(name_1)) { - hash[name_1] = r.root.variable(name_1); - } - } - } - return hash; - }, {}); - } - return this._variables; - }; - Ruleset.prototype.properties = function () { - if (!this._properties) { - this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof declaration_1.default && r.variable !== true) { - var name_2 = (r.name.length === 1) && (r.name[0] instanceof keyword_1.default) ? - r.name[0].value : r.name; - // Properties don't overwrite as they can merge - if (!hash["$" + name_2]) { - hash["$" + name_2] = [r]; - } - else { - hash["$" + name_2].push(r); - } - } - return hash; - }, {}); - } - return this._properties; - }; - Ruleset.prototype.variable = function (name) { - var decl = this.variables()[name]; - if (decl) { - return this.parseValue(decl); - } - }; - Ruleset.prototype.property = function (name) { - var decl = this.properties()[name]; - if (decl) { - return this.parseValue(decl); - } - }; - Ruleset.prototype.lastDeclaration = function () { - for (var i = this.rules.length; i > 0; i--) { - var decl = this.rules[i - 1]; - if (decl instanceof declaration_1.default) { - return this.parseValue(decl); - } - } - }; - Ruleset.prototype.parseValue = function (toParse) { - var self = this; - function transformDeclaration(decl) { - if (decl.value instanceof anonymous_1.default && !decl.parsed) { - if (typeof decl.value.value === 'string') { - this.parse.parseNode(decl.value.value, ['value', 'important'], decl.value.getIndex(), decl.fileInfo(), function (err, result) { - if (err) { - decl.parsed = true; - } - if (result) { - decl.value = result[0]; - decl.important = result[1] || ''; - decl.parsed = true; - } - }); - } - else { - decl.parsed = true; - } - return decl; - } - else { - return decl; - } - } - if (!Array.isArray(toParse)) { - return transformDeclaration.call(self, toParse); - } - else { - var nodes_1 = []; - toParse.forEach(function (n) { - nodes_1.push(transformDeclaration.call(self, n)); - }); - return nodes_1; - } - }; - Ruleset.prototype.rulesets = function () { - if (!this.rules) { - return []; - } - var filtRules = []; - var rules = this.rules; - var i; - var rule; - for (i = 0; (rule = rules[i]); i++) { - if (rule.isRuleset) { - filtRules.push(rule); - } - } - return filtRules; - }; - Ruleset.prototype.prependRule = function (rule) { - var rules = this.rules; - if (rules) { - rules.unshift(rule); - } - else { - this.rules = [rule]; - } - this.setParent(rule, this); - }; - Ruleset.prototype.find = function (selector, self, filter) { - if (self === void 0) { self = this; } - var rules = []; - var match; - var foundMixins; - var key = selector.toCSS(); - if (key in this._lookups) { - return this._lookups[key]; - } - this.rulesets().forEach(function (rule) { - if (rule !== self) { - for (var j = 0; j < rule.selectors.length; j++) { - match = selector.match(rule.selectors[j]); - if (match) { - if (selector.elements.length > match) { - if (!filter || filter(rule)) { - foundMixins = rule.find(new selector_1.default(selector.elements.slice(match)), self, filter); - for (var i = 0; i < foundMixins.length; ++i) { - foundMixins[i].path.push(rule); - } - Array.prototype.push.apply(rules, foundMixins); - } - } - else { - rules.push({ rule: rule, path: [] }); - } - break; - } - } - } - }); - this._lookups[key] = rules; - return rules; - }; - Ruleset.prototype.genCSS = function (context, output) { - var i; - var j; - var charsetRuleNodes = []; - var ruleNodes = []; - var // Line number debugging - debugInfo; - var rule; - var path; - context.tabLevel = (context.tabLevel || 0); - if (!this.root) { - context.tabLevel++; - } - var tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' '); - var tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' '); - var sep; - var charsetNodeIndex = 0; - var importNodeIndex = 0; - for (i = 0; (rule = this.rules[i]); i++) { - if (rule instanceof comment_1.default) { - if (importNodeIndex === i) { - importNodeIndex++; - } - ruleNodes.push(rule); - } - else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; - importNodeIndex++; - } - else if (rule.type === 'Import') { - ruleNodes.splice(importNodeIndex, 0, rule); - importNodeIndex++; - } - else { - ruleNodes.push(rule); - } - } - ruleNodes = charsetRuleNodes.concat(ruleNodes); - // If this is the root node, we don't render - // a selector, or {}. - if (!this.root) { - debugInfo = debug_info_1.default(context, this, tabSetStr); - if (debugInfo) { - output.add(debugInfo); - output.add(tabSetStr); - } - var paths = this.paths; - var pathCnt = paths.length; - var pathSubCnt = void 0; - sep = context.compress ? ',' : (",\n" + tabSetStr); - for (i = 0; i < pathCnt; i++) { - path = paths[i]; - if (!(pathSubCnt = path.length)) { - continue; - } - if (i > 0) { - output.add(sep); - } - context.firstSelector = true; - path[0].genCSS(context, output); - context.firstSelector = false; - for (j = 1; j < pathSubCnt; j++) { - path[j].genCSS(context, output); - } - } - output.add((context.compress ? '{' : ' {\n') + tabRuleStr); - } - // Compile rules and rulesets - for (i = 0; (rule = ruleNodes[i]); i++) { - if (i + 1 === ruleNodes.length) { - context.lastRule = true; - } - var currentLastRule = context.lastRule; - if (rule.isRulesetLike(rule)) { - context.lastRule = false; - } - if (rule.genCSS) { - rule.genCSS(context, output); - } - else if (rule.value) { - output.add(rule.value.toString()); - } - context.lastRule = currentLastRule; - if (!context.lastRule && rule.isVisible()) { - output.add(context.compress ? '' : ("\n" + tabRuleStr)); - } - else { - context.lastRule = false; - } - } - if (!this.root) { - output.add((context.compress ? '}' : "\n" + tabSetStr + "}")); - context.tabLevel--; - } - if (!output.isEmpty() && !context.compress && this.firstRoot) { - output.add('\n'); - } - }; - Ruleset.prototype.joinSelectors = function (paths, context, selectors) { - for (var s = 0; s < selectors.length; s++) { - this.joinSelector(paths, context, selectors[s]); - } - }; - Ruleset.prototype.joinSelector = function (paths, context, selector) { - function createParenthesis(elementsToPak, originalElement) { - var replacementParen; - var j; - if (elementsToPak.length === 0) { - replacementParen = new paren_1.default(elementsToPak[0]); - } - else { - var insideParent = new Array(elementsToPak.length); - for (j = 0; j < elementsToPak.length; j++) { - insideParent[j] = new element_1.default(null, elementsToPak[j], originalElement.isVariable, originalElement._index, originalElement._fileInfo); - } - replacementParen = new paren_1.default(new selector_1.default(insideParent)); - } - return replacementParen; - } - function createSelector(containedElement, originalElement) { - var element; - var selector; - element = new element_1.default(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo); - selector = new selector_1.default([element]); - return selector; - } - // joins selector path from `beginningPath` with selector path in `addPath` - // `replacedElement` contains element that is being replaced by `addPath` - // returns concatenated path - function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) { - var newSelectorPath; - var lastSelector; - var newJoinedSelector; - // our new selector path - newSelectorPath = []; - // construct the joined selector - if & is the first thing this will be empty, - // if not newJoinedSelector will be the last set of elements in the selector - if (beginningPath.length > 0) { - newSelectorPath = utils.copyArray(beginningPath); - lastSelector = newSelectorPath.pop(); - newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements)); - } - else { - newJoinedSelector = originalSelector.createDerived([]); - } - if (addPath.length > 0) { - // /deep/ is a CSS4 selector - (removed, so should deprecate) - // that is valid without anything in front of it - // so if the & does not have a combinator that is "" or " " then - // and there is a combinator on the parent, then grab that. - // this also allows + a { & .b { .a & { ... though not sure why you would want to do that - var combinator = replacedElement.combinator; - var parentEl = addPath[0].elements[0]; - if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) { - combinator = parentEl.combinator; - } - // join the elements so far with the first part of the parent - newJoinedSelector.elements.push(new element_1.default(combinator, parentEl.value, replacedElement.isVariable, replacedElement._index, replacedElement._fileInfo)); - newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1)); - } - // now add the joined selector - but only if it is not empty - if (newJoinedSelector.elements.length !== 0) { - newSelectorPath.push(newJoinedSelector); - } - // put together the parent selectors after the join (e.g. the rest of the parent) - if (addPath.length > 1) { - var restOfPath = addPath.slice(1); - restOfPath = restOfPath.map(function (selector) { return selector.createDerived(selector.elements, []); }); - newSelectorPath = newSelectorPath.concat(restOfPath); - } - return newSelectorPath; - } - // joins selector path from `beginningPath` with every selector path in `addPaths` array - // `replacedElement` contains element that is being replaced by `addPath` - // returns array with all concatenated paths - function addAllReplacementsIntoPath(beginningPath, addPaths, replacedElement, originalSelector, result) { - var j; - for (j = 0; j < beginningPath.length; j++) { - var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector); - result.push(newSelectorPath); - } - return result; - } - function mergeElementsOnToSelectors(elements, selectors) { - var i; - var sel; - if (elements.length === 0) { - return; - } - if (selectors.length === 0) { - selectors.push([new selector_1.default(elements)]); - return; - } - for (i = 0; (sel = selectors[i]); i++) { - // if the previous thing in sel is a parent this needs to join on to it - if (sel.length > 0) { - sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements)); - } - else { - sel.push(new selector_1.default(elements)); - } - } - } - // replace all parent selectors inside `inSelector` by content of `context` array - // resulting selectors are returned inside `paths` array - // returns true if `inSelector` contained at least one parent selector - function replaceParentSelector(paths, context, inSelector) { - // The paths are [[Selector]] - // The first list is a list of comma separated selectors - // The inner list is a list of inheritance separated selectors - // e.g. - // .a, .b { - // .c { - // } - // } - // == [[.a] [.c]] [[.b] [.c]] - // - var i; - var j; - var k; - var currentElements; - var newSelectors; - var selectorsMultiplied; - var sel; - var el; - var hadParentSelector = false; - var length; - var lastSelector; - function findNestedSelector(element) { - var maybeSelector; - if (!(element.value instanceof paren_1.default)) { - return null; - } - maybeSelector = element.value.value; - if (!(maybeSelector instanceof selector_1.default)) { - return null; - } - return maybeSelector; - } - // the elements from the current selector so far - currentElements = []; - // the current list of new selectors to add to the path. - // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors - // by the parents - newSelectors = [ - [] - ]; - for (i = 0; (el = inSelector.elements[i]); i++) { - // non parent reference elements just get added - if (el.value !== '&') { - var nestedSelector = findNestedSelector(el); - if (nestedSelector != null) { - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - var nestedPaths = []; - var replaced = void 0; - var replacedNewSelectors = []; - replaced = replaceParentSelector(nestedPaths, context, nestedSelector); - hadParentSelector = hadParentSelector || replaced; - // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors - for (k = 0; k < nestedPaths.length; k++) { - var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el); - addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors); - } - newSelectors = replacedNewSelectors; - currentElements = []; - } - else { - currentElements.push(el); - } - } - else { - hadParentSelector = true; - // the new list of selectors to add - selectorsMultiplied = []; - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - // loop through our current selectors - for (j = 0; j < newSelectors.length; j++) { - sel = newSelectors[j]; - // if we don't have any parent paths, the & might be in a mixin so that it can be used - // whether there are parents or not - if (context.length === 0) { - // the combinator used on el should now be applied to the next element instead so that - // it is not lost - if (sel.length > 0) { - sel[0].elements.push(new element_1.default(el.combinator, '', el.isVariable, el._index, el._fileInfo)); - } - selectorsMultiplied.push(sel); - } - else { - // and the parent selectors - for (k = 0; k < context.length; k++) { - // We need to put the current selectors - // then join the last selector's elements on to the parents selectors - var newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector); - // add that to our new set of selectors - selectorsMultiplied.push(newSelectorPath); - } - } - } - // our new selectors has been multiplied, so reset the state - newSelectors = selectorsMultiplied; - currentElements = []; - } - } - // if we have any elements left over (e.g. .a& .b == .b) - // add them on to all the current selectors - mergeElementsOnToSelectors(currentElements, newSelectors); - for (i = 0; i < newSelectors.length; i++) { - length = newSelectors[i].length; - if (length > 0) { - paths.push(newSelectors[i]); - lastSelector = newSelectors[i][length - 1]; - newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList); - } - } - return hadParentSelector; - } - function deriveSelector(visibilityInfo, deriveFrom) { - var newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition); - newSelector.copyVisibilityInfo(visibilityInfo); - return newSelector; - } - // joinSelector code follows - var i; - var newPaths; - var hadParentSelector; - newPaths = []; - hadParentSelector = replaceParentSelector(newPaths, context, selector); - if (!hadParentSelector) { - if (context.length > 0) { - newPaths = []; - for (i = 0; i < context.length; i++) { - var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo())); - concatenated.push(selector); - newPaths.push(concatenated); - } - } - else { - newPaths = [[selector]]; - } - } - for (i = 0; i < newPaths.length; i++) { - paths.push(newPaths[i]); - } - }; - return Ruleset; -}(node_1.default)); -Ruleset.prototype.type = 'Ruleset'; -Ruleset.prototype.isRuleset = true; -exports.default = Ruleset; -//# sourceMappingURL=ruleset.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/ruleset.js.map b/packages/less/lib/less/tree/ruleset.js.map deleted file mode 100644 index d617d3690..000000000 --- a/packages/less/lib/less/tree/ruleset.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ruleset.js","sourceRoot":"","sources":["../../../src/less/tree/ruleset.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,8DAAwC;AACxC,sDAAgC;AAChC,sDAAgC;AAChC,kDAA4B;AAC5B,wDAAkC;AAClC,sDAAgC;AAChC,0DAAoC;AACpC,yDAAmC;AACnC,qFAAoE;AACpE,iEAA+C;AAC/C,4DAAwC;AACxC,8CAAkC;AAElC;IAAsB,2BAAI;IACtB,iBAAY,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,cAAc;QAA3D,YACI,iBAAO,SAcV;QAZG,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,KAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,KAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,KAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,KAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QACxC,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,SAAS,EAAE,KAAI,CAAC,C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ACb,IAAI,iBAAiB,CAAC;QAEtB,QAAQ,GAAG,EAAE,CAAC;QACd,iBAAiB,GAAG,qBAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEvE,IAAI,CAAC,iBAAiB,EAAE;YACpB,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpB,QAAQ,GAAG,EAAE,CAAC;gBACd,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAEjC,IAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;oBAE1F,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC5B,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;iBAC/B;aACJ;iBACI;gBACD,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC3B;SACJ;QAED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3B;IACL,CAAC;IACL,cAAC;AAAD,CAAC,AAh1BD,CAAsB,cAAI,GAg1BzB;AAED,OAAO,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC;AACnC,OAAO,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;AACnC,kBAAe,OAAO,CAAC","sourcesContent":["import Node from './node';\nimport Declaration from './declaration';\nimport Keyword from './keyword';\nimport Comment from './comment';\nimport Paren from './paren';\nimport Selector from './selector';\nimport Element from './element';\nimport Anonymous from './anonymous';\nimport contexts from '../contexts';\nimport globalFunctionRegistry from '../functions/function-registry';\nimport defaultFunc from '../functions/default';\nimport getDebugInfo from './debug-info';\nimport * as utils from '../utils';\n\nclass Ruleset extends Node {\n constructor(selectors, rules, strictImports, visibilityInfo) {\n super();\n\n this.selectors = selectors;\n this.rules = rules;\n this._lookups = {};\n this._variables = null;\n this._properties = null;\n this.strictImports = strictImports;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n this.setParent(this.selectors, this);\n this.setParent(this.rules, this);\n\n }\n\n isRulesetLike() {\n return true;\n }\n\n accept(visitor) {\n if (this.paths) {\n this.paths = visitor.visitArray(this.paths, true);\n } else if (this.selectors) {\n this.selectors = visitor.visitArray(this.selectors);\n }\n if (this.rules && this.rules.length) {\n this.rules = visitor.visitArray(this.rules);\n }\n }\n\n eval(context) {\n const that = this;\n let selectors;\n let selCnt;\n let selector;\n let i;\n let hasVariable;\n let hasOnePassingSelector = false;\n\n if (this.selectors && (selCnt = this.selectors.length)) {\n selectors = new Array(selCnt);\n defaultFunc.error({\n type: 'Syntax',\n message: 'it is currently only allowed in parametric mixin guards,'\n });\n\n for (i = 0; i < selCnt; i++) {\n selector = this.selectors[i].eval(context);\n for (var j = 0; j < selector.elements.length; j++) {\n if (selector.elements[j].isVariable) {\n hasVariable = true;\n break;\n }\n }\n selectors[i] = selector;\n if (selector.evaldCondition) {\n hasOnePassingSelector = true;\n }\n }\n\n if (hasVariable) {\n const toParseSelectors = new Array(selCnt);\n for (i = 0; i < selCnt; i++) {\n selector = selectors[i];\n toParseSelectors[i] = selector.toCSS(context);\n }\n this.parse.parseNode(\n toParseSelectors.join(','),\n [\"selectors\"], \n selectors[0].getIndex(), \n selectors[0].fileInfo(), \n (err, result) => {\n if (result) {\n selectors = utils.flattenArray(result);\n }\n });\n }\n\n defaultFunc.reset();\n } else {\n hasOnePassingSelector = true;\n }\n\n let rules = this.rules ? utils.copyArray(this.rules) : null;\n const ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo());\n let rule;\n let subRule;\n\n ruleset.originalRuleset = this;\n ruleset.root = this.root;\n ruleset.firstRoot = this.firstRoot;\n ruleset.allowImports = this.allowImports;\n\n if (this.debugInfo) {\n ruleset.debugInfo = this.debugInfo;\n }\n\n if (!hasOnePassingSelector) {\n rules.length = 0;\n }\n\n // inherit a function registry from the frames stack when possible;\n // otherwise from the global registry\n ruleset.functionRegistry = (frames => {\n let i = 0;\n const n = frames.length;\n let found;\n for ( ; i !== n ; ++i ) {\n found = frames[ i ].functionRegistry;\n if ( found ) { return found; }\n }\n return globalFunctionRegistry;\n })(context.frames).inherit();\n\n // push the current ruleset to the frames stack\n const ctxFrames = context.frames;\n ctxFrames.unshift(ruleset);\n\n // currrent selectors\n let ctxSelectors = context.selectors;\n if (!ctxSelectors) {\n context.selectors = ctxSelectors = [];\n }\n ctxSelectors.unshift(this.selectors);\n\n // Evaluate imports\n if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) {\n ruleset.evalImports(context);\n }\n\n // Store the frames around mixin definitions,\n // so they can be evaluated like closures when the time comes.\n const rsRules = ruleset.rules;\n for (i = 0; (rule = rsRules[i]); i++) {\n if (rule.evalFirst) {\n rsRules[i] = rule.eval(context);\n }\n }\n\n const mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0;\n\n // Evaluate mixin calls.\n for (i = 0; (rule = rsRules[i]); i++) {\n if (rule.type === 'MixinCall') {\n /* jshint loopfunc:true */\n rules = rule.eval(context).filter(r => {\n if ((r instanceof Declaration) && r.variable) {\n // do not pollute the scope if the variable is\n // already there. consider returning false here\n // but we need a way to \"return\" variable from mixins\n return !(ruleset.variable(r.name));\n }\n return true;\n });\n rsRules.splice(...[i, 1].concat(rules));\n i += rules.length - 1;\n ruleset.resetCache();\n } else if (rule.type === 'VariableCall') {\n /* jshint loopfunc:true */\n rules = rule.eval(context).rules.filter(r => {\n if ((r instanceof Declaration) && r.variable) {\n // do not pollute the scope at all\n return false;\n }\n return true;\n });\n rsRules.splice(...[i, 1].concat(rules));\n i += rules.length - 1;\n ruleset.resetCache();\n }\n }\n\n // Evaluate everything else\n for (i = 0; (rule = rsRules[i]); i++) {\n if (!rule.evalFirst) {\n rsRules[i] = rule = rule.eval ? rule.eval(context) : rule;\n }\n }\n\n // Evaluate everything else\n for (i = 0; (rule = rsRules[i]); i++) {\n // for rulesets, check if it is a css guard and can be removed\n if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) {\n // check if it can be folded in (e.g. & where)\n if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) {\n rsRules.splice(i--, 1);\n\n for (var j = 0; (subRule = rule.rules[j]); j++) {\n if (subRule instanceof Node) {\n subRule.copyVisibilityInfo(rule.visibilityInfo());\n if (!(subRule instanceof Declaration) || !subRule.variable) {\n rsRules.splice(++i, 0, subRule);\n }\n }\n }\n }\n }\n }\n\n // Pop the stack\n ctxFrames.shift();\n ctxSelectors.shift();\n\n if (context.mediaBlocks) {\n for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) {\n context.mediaBlocks[i].bubbleSelectors(selectors);\n }\n }\n\n return ruleset;\n }\n\n evalImports(context) {\n const rules = this.rules;\n let i;\n let importRules;\n if (!rules) { return; }\n\n for (i = 0; i < rules.length; i++) {\n if (rules[i].type === 'Import') {\n importRules = rules[i].eval(context);\n if (importRules && (importRules.length || importRules.length === 0)) {\n rules.splice(...[i, 1].concat(importRules));\n i += importRules.length - 1;\n } else {\n rules.splice(i, 1, importRules);\n }\n this.resetCache();\n }\n }\n }\n\n makeImportant() {\n const result = new Ruleset(this.selectors, this.rules.map(r => {\n if (r.makeImportant) {\n return r.makeImportant();\n } else {\n return r;\n }\n }), this.strictImports, this.visibilityInfo());\n\n return result;\n }\n\n matchArgs(args) {\n return !args || args.length === 0;\n }\n\n // lets you call a css selector with a guard\n matchCondition(args, context) {\n const lastSelector = this.selectors[this.selectors.length - 1];\n if (!lastSelector.evaldCondition) {\n return false;\n }\n if (lastSelector.condition &&\n !lastSelector.condition.eval(\n new contexts.Eval(context,\n context.frames))) {\n return false;\n }\n return true;\n }\n\n resetCache() {\n this._rulesets = null;\n this._variables = null;\n this._properties = null;\n this._lookups = {};\n }\n\n variables() {\n if (!this._variables) {\n this._variables = !this.rules ? {} : this.rules.reduce((hash, r) => {\n if (r instanceof Declaration && r.variable === true) {\n hash[r.name] = r;\n }\n // when evaluating variables in an import statement, imports have not been eval'd\n // so we need to go inside import statements.\n // guard against root being a string (in the case of inlined less)\n if (r.type === 'Import' && r.root && r.root.variables) {\n const vars = r.root.variables();\n for (const name in vars) {\n if (vars.hasOwnProperty(name)) {\n hash[name] = r.root.variable(name);\n }\n }\n }\n return hash;\n }, {});\n }\n return this._variables;\n }\n\n properties() {\n if (!this._properties) {\n this._properties = !this.rules ? {} : this.rules.reduce((hash, r) => {\n if (r instanceof Declaration && r.variable !== true) {\n const name = (r.name.length === 1) && (r.name[0] instanceof Keyword) ?\n r.name[0].value : r.name;\n // Properties don't overwrite as they can merge\n if (!hash[`$${name}`]) {\n hash[`$${name}`] = [ r ];\n }\n else {\n hash[`$${name}`].push(r);\n }\n }\n return hash;\n }, {});\n }\n return this._properties;\n }\n\n variable(name) {\n const decl = this.variables()[name];\n if (decl) {\n return this.parseValue(decl);\n }\n }\n\n property(name) {\n const decl = this.properties()[name];\n if (decl) {\n return this.parseValue(decl);\n }\n }\n\n lastDeclaration() {\n for (let i = this.rules.length; i > 0; i--) {\n const decl = this.rules[i - 1];\n if (decl instanceof Declaration) {\n return this.parseValue(decl);\n }\n }\n }\n\n parseValue(toParse) {\n const self = this;\n function transformDeclaration(decl) {\n if (decl.value instanceof Anonymous && !decl.parsed) {\n if (typeof decl.value.value === 'string') {\n this.parse.parseNode(\n decl.value.value,\n ['value', 'important'], \n decl.value.getIndex(), \n decl.fileInfo(), \n (err, result) => {\n if (err) {\n decl.parsed = true;\n }\n if (result) {\n decl.value = result[0];\n decl.important = result[1] || '';\n decl.parsed = true;\n }\n });\n } else {\n decl.parsed = true;\n }\n\n return decl;\n }\n else {\n return decl;\n }\n }\n if (!Array.isArray(toParse)) {\n return transformDeclaration.call(self, toParse);\n }\n else {\n const nodes = [];\n toParse.forEach(n => {\n nodes.push(transformDeclaration.call(self, n));\n });\n return nodes;\n }\n }\n\n rulesets() {\n if (!this.rules) { return []; }\n\n const filtRules = [];\n const rules = this.rules;\n let i;\n let rule;\n\n for (i = 0; (rule = rules[i]); i++) {\n if (rule.isRuleset) {\n filtRules.push(rule);\n }\n }\n\n return filtRules;\n }\n\n prependRule(rule) {\n const rules = this.rules;\n if (rules) {\n rules.unshift(rule);\n } else {\n this.rules = [ rule ];\n }\n this.setParent(rule, this);\n }\n\n find(selector, self = this, filter) {\n const rules = [];\n let match;\n let foundMixins;\n const key = selector.toCSS();\n\n if (key in this._lookups) { return this._lookups[key]; }\n\n this.rulesets().forEach(rule => {\n if (rule !== self) {\n for (let j = 0; j < rule.selectors.length; j++) {\n match = selector.match(rule.selectors[j]);\n if (match) {\n if (selector.elements.length > match) {\n if (!filter || filter(rule)) {\n foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter);\n for (let i = 0; i < foundMixins.length; ++i) {\n foundMixins[i].path.push(rule);\n }\n Array.prototype.push.apply(rules, foundMixins);\n }\n } else {\n rules.push({ rule, path: []});\n }\n break;\n }\n }\n }\n });\n this._lookups[key] = rules;\n return rules;\n }\n\n genCSS(context, output) {\n let i;\n let j;\n const charsetRuleNodes = [];\n let ruleNodes = [];\n\n let // Line number debugging\n debugInfo;\n\n let rule;\n let path;\n\n context.tabLevel = (context.tabLevel || 0);\n\n if (!this.root) {\n context.tabLevel++;\n }\n\n const tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' ');\n const tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' ');\n let sep;\n\n let charsetNodeIndex = 0;\n let importNodeIndex = 0;\n for (i = 0; (rule = this.rules[i]); i++) {\n if (rule instanceof Comment) {\n if (importNodeIndex === i) {\n importNodeIndex++;\n }\n ruleNodes.push(rule);\n } else if (rule.isCharset && rule.isCharset()) {\n ruleNodes.splice(charsetNodeIndex, 0, rule);\n charsetNodeIndex++;\n importNodeIndex++;\n } else if (rule.type === 'Import') {\n ruleNodes.splice(importNodeIndex, 0, rule);\n importNodeIndex++;\n } else {\n ruleNodes.push(rule);\n }\n }\n ruleNodes = charsetRuleNodes.concat(ruleNodes);\n\n // If this is the root node, we don't render\n // a selector, or {}.\n if (!this.root) {\n debugInfo = getDebugInfo(context, this, tabSetStr);\n\n if (debugInfo) {\n output.add(debugInfo);\n output.add(tabSetStr);\n }\n\n const paths = this.paths;\n const pathCnt = paths.length;\n let pathSubCnt;\n\n sep = context.compress ? ',' : (`,\\n${tabSetStr}`);\n\n for (i = 0; i < pathCnt; i++) {\n path = paths[i];\n if (!(pathSubCnt = path.length)) { continue; }\n if (i > 0) { output.add(sep); }\n\n context.firstSelector = true;\n path[0].genCSS(context, output);\n\n context.firstSelector = false;\n for (j = 1; j < pathSubCnt; j++) {\n path[j].genCSS(context, output);\n }\n }\n\n output.add((context.compress ? '{' : ' {\\n') + tabRuleStr);\n }\n\n // Compile rules and rulesets\n for (i = 0; (rule = ruleNodes[i]); i++) {\n\n if (i + 1 === ruleNodes.length) {\n context.lastRule = true;\n }\n\n const currentLastRule = context.lastRule;\n if (rule.isRulesetLike(rule)) {\n context.lastRule = false;\n }\n\n if (rule.genCSS) {\n rule.genCSS(context, output);\n } else if (rule.value) {\n output.add(rule.value.toString());\n }\n\n context.lastRule = currentLastRule;\n\n if (!context.lastRule && rule.isVisible()) {\n output.add(context.compress ? '' : (`\\n${tabRuleStr}`));\n } else {\n context.lastRule = false;\n }\n }\n\n if (!this.root) {\n output.add((context.compress ? '}' : `\\n${tabSetStr}}`));\n context.tabLevel--;\n }\n\n if (!output.isEmpty() && !context.compress && this.firstRoot) {\n output.add('\\n');\n }\n }\n\n joinSelectors(paths, context, selectors) {\n for (let s = 0; s < selectors.length; s++) {\n this.joinSelector(paths, context, selectors[s]);\n }\n }\n\n joinSelector(paths, context, selector) {\n function createParenthesis(elementsToPak, originalElement) {\n let replacementParen;\n let j;\n if (elementsToPak.length === 0) {\n replacementParen = new Paren(elementsToPak[0]);\n } else {\n const insideParent = new Array(elementsToPak.length);\n for (j = 0; j < elementsToPak.length; j++) {\n insideParent[j] = new Element(\n null,\n elementsToPak[j],\n originalElement.isVariable,\n originalElement._index,\n originalElement._fileInfo\n );\n }\n replacementParen = new Paren(new Selector(insideParent));\n }\n return replacementParen;\n }\n\n function createSelector(containedElement, originalElement) {\n let element;\n let selector;\n element = new Element(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo);\n selector = new Selector([element]);\n return selector;\n }\n\n // joins selector path from `beginningPath` with selector path in `addPath`\n // `replacedElement` contains element that is being replaced by `addPath`\n // returns concatenated path\n function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {\n let newSelectorPath;\n let lastSelector;\n let newJoinedSelector;\n // our new selector path\n newSelectorPath = [];\n\n // construct the joined selector - if & is the first thing this will be empty,\n // if not newJoinedSelector will be the last set of elements in the selector\n if (beginningPath.length > 0) {\n newSelectorPath = utils.copyArray(beginningPath);\n lastSelector = newSelectorPath.pop();\n newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements));\n }\n else {\n newJoinedSelector = originalSelector.createDerived([]);\n }\n\n if (addPath.length > 0) {\n // /deep/ is a CSS4 selector - (removed, so should deprecate)\n // that is valid without anything in front of it\n // so if the & does not have a combinator that is \"\" or \" \" then\n // and there is a combinator on the parent, then grab that.\n // this also allows + a { & .b { .a & { ... though not sure why you would want to do that\n let combinator = replacedElement.combinator;\n\n const parentEl = addPath[0].elements[0];\n if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {\n combinator = parentEl.combinator;\n }\n // join the elements so far with the first part of the parent\n newJoinedSelector.elements.push(new Element(\n combinator,\n parentEl.value,\n replacedElement.isVariable,\n replacedElement._index,\n replacedElement._fileInfo\n ));\n newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));\n }\n\n // now add the joined selector - but only if it is not empty\n if (newJoinedSelector.elements.length !== 0) {\n newSelectorPath.push(newJoinedSelector);\n }\n\n // put together the parent selectors after the join (e.g. the rest of the parent)\n if (addPath.length > 1) {\n let restOfPath = addPath.slice(1);\n restOfPath = restOfPath.map(selector => selector.createDerived(selector.elements, []));\n newSelectorPath = newSelectorPath.concat(restOfPath);\n }\n return newSelectorPath;\n }\n\n // joins selector path from `beginningPath` with every selector path in `addPaths` array\n // `replacedElement` contains element that is being replaced by `addPath`\n // returns array with all concatenated paths\n function addAllReplacementsIntoPath( beginningPath, addPaths, replacedElement, originalSelector, result) {\n let j;\n for (j = 0; j < beginningPath.length; j++) {\n const newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);\n result.push(newSelectorPath);\n }\n return result;\n }\n\n function mergeElementsOnToSelectors(elements, selectors) {\n let i;\n let sel;\n\n if (elements.length === 0) {\n return ;\n }\n if (selectors.length === 0) {\n selectors.push([ new Selector(elements) ]);\n return;\n }\n\n for (i = 0; (sel = selectors[i]); i++) {\n // if the previous thing in sel is a parent this needs to join on to it\n if (sel.length > 0) {\n sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));\n }\n else {\n sel.push(new Selector(elements));\n }\n }\n }\n\n // replace all parent selectors inside `inSelector` by content of `context` array\n // resulting selectors are returned inside `paths` array\n // returns true if `inSelector` contained at least one parent selector\n function replaceParentSelector(paths, context, inSelector) {\n // The paths are [[Selector]]\n // The first list is a list of comma separated selectors\n // The inner list is a list of inheritance separated selectors\n // e.g.\n // .a, .b {\n // .c {\n // }\n // }\n // == [[.a] [.c]] [[.b] [.c]]\n //\n let i;\n\n let j;\n let k;\n let currentElements;\n let newSelectors;\n let selectorsMultiplied;\n let sel;\n let el;\n let hadParentSelector = false;\n let length;\n let lastSelector;\n function findNestedSelector(element) {\n let maybeSelector;\n if (!(element.value instanceof Paren)) {\n return null;\n }\n\n maybeSelector = element.value.value;\n if (!(maybeSelector instanceof Selector)) {\n return null;\n }\n\n return maybeSelector;\n }\n\n // the elements from the current selector so far\n currentElements = [];\n // the current list of new selectors to add to the path.\n // We will build it up. We initiate it with one empty selector as we \"multiply\" the new selectors\n // by the parents\n newSelectors = [\n []\n ];\n\n for (i = 0; (el = inSelector.elements[i]); i++) {\n // non parent reference elements just get added\n if (el.value !== '&') {\n const nestedSelector = findNestedSelector(el);\n if (nestedSelector != null) {\n // merge the current list of non parent selector elements\n // on to the current list of selectors to add\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n const nestedPaths = [];\n let replaced;\n const replacedNewSelectors = [];\n replaced = replaceParentSelector(nestedPaths, context, nestedSelector);\n hadParentSelector = hadParentSelector || replaced;\n // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors\n for (k = 0; k < nestedPaths.length; k++) {\n const replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el);\n addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors);\n }\n newSelectors = replacedNewSelectors;\n currentElements = [];\n } else {\n currentElements.push(el);\n }\n\n } else {\n hadParentSelector = true;\n // the new list of selectors to add\n selectorsMultiplied = [];\n\n // merge the current list of non parent selector elements\n // on to the current list of selectors to add\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n // loop through our current selectors\n for (j = 0; j < newSelectors.length; j++) {\n sel = newSelectors[j];\n // if we don't have any parent paths, the & might be in a mixin so that it can be used\n // whether there are parents or not\n if (context.length === 0) {\n // the combinator used on el should now be applied to the next element instead so that\n // it is not lost\n if (sel.length > 0) {\n sel[0].elements.push(new Element(el.combinator, '', el.isVariable, el._index, el._fileInfo));\n }\n selectorsMultiplied.push(sel);\n }\n else {\n // and the parent selectors\n for (k = 0; k < context.length; k++) {\n // We need to put the current selectors\n // then join the last selector's elements on to the parents selectors\n const newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector);\n // add that to our new set of selectors\n selectorsMultiplied.push(newSelectorPath);\n }\n }\n }\n\n // our new selectors has been multiplied, so reset the state\n newSelectors = selectorsMultiplied;\n currentElements = [];\n }\n }\n\n // if we have any elements left over (e.g. .a& .b == .b)\n // add them on to all the current selectors\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n for (i = 0; i < newSelectors.length; i++) {\n length = newSelectors[i].length;\n if (length > 0) {\n paths.push(newSelectors[i]);\n lastSelector = newSelectors[i][length - 1];\n newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList);\n }\n }\n\n return hadParentSelector;\n }\n\n function deriveSelector(visibilityInfo, deriveFrom) {\n const newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition);\n newSelector.copyVisibilityInfo(visibilityInfo);\n return newSelector;\n }\n\n // joinSelector code follows\n let i;\n\n let newPaths;\n let hadParentSelector;\n\n newPaths = [];\n hadParentSelector = replaceParentSelector(newPaths, context, selector);\n\n if (!hadParentSelector) {\n if (context.length > 0) {\n newPaths = [];\n for (i = 0; i < context.length; i++) {\n\n const concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo()));\n\n concatenated.push(selector);\n newPaths.push(concatenated);\n }\n }\n else {\n newPaths = [[selector]];\n }\n }\n\n for (i = 0; i < newPaths.length; i++) {\n paths.push(newPaths[i]);\n }\n }\n}\n\nRuleset.prototype.type = 'Ruleset';\nRuleset.prototype.isRuleset = true;\nexport default Ruleset;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/selector.js b/packages/less/lib/less/tree/selector.js deleted file mode 100644 index 0d0d13ae3..000000000 --- a/packages/less/lib/less/tree/selector.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var element_1 = __importDefault(require("./element")); -var less_error_1 = __importDefault(require("../less-error")); -var Selector = /** @class */ (function (_super) { - __extends(Selector, _super); - function Selector(elements, extendList, condition, index, currentFileInfo, visibilityInfo) { - var _this = _super.call(this) || this; - _this.extendList = extendList; - _this.condition = condition; - _this.evaldCondition = !condition; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.elements = _this.getElements(elements); - _this.mixinElements_ = undefined; - _this.copyVisibilityInfo(visibilityInfo); - _this.setParent(_this.elements, _this); - return _this; - } - Selector.prototype.accept = function (visitor) { - if (this.elements) { - this.elements = visitor.visitArray(this.elements); - } - if (this.extendList) { - this.extendList = visitor.visitArray(this.extendList); - } - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }; - Selector.prototype.createDerived = function (elements, extendList, evaldCondition) { - elements = this.getElements(elements); - var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; - newSelector.mediaEmpty = this.mediaEmpty; - return newSelector; - }; - Selector.prototype.getElements = function (els) { - if (!els) { - return [new element_1.default('', '&', false, this._index, this._fileInfo)]; - } - if (typeof els === 'string') { - this.parse.parseNode(els, ['selector'], this._index, this._fileInfo, function (err, result) { - if (err) { - throw new less_error_1.default({ - index: err.index, - message: err.message - }, this.parse.imports, this._fileInfo.filename); - } - els = result[0].elements; - }); - } - return els; - }; - Selector.prototype.createEmptySelectors = function () { - var el = new element_1.default('', '&', false, this._index, this._fileInfo); - var sels = [new Selector([el], null, null, this._index, this._fileInfo)]; - sels[0].mediaEmpty = true; - return sels; - }; - Selector.prototype.match = function (other) { - var elements = this.elements; - var len = elements.length; - var olen; - var i; - other = other.mixinElements(); - olen = other.length; - if (olen === 0 || len < olen) { - return 0; - } - else { - for (i = 0; i < olen; i++) { - if (elements[i].value !== other[i]) { - return 0; - } - } - } - return olen; // return number of matched elements - }; - Selector.prototype.mixinElements = function () { - if (this.mixinElements_) { - return this.mixinElements_; - } - var elements = this.elements.map(function (v) { return v.combinator.value + (v.value.value || v.value); }).join('').match(/[,&#\*\.\w-]([\w-]|(\\.))*/g); - if (elements) { - if (elements[0] === '&') { - elements.shift(); - } - } - else { - elements = []; - } - return (this.mixinElements_ = elements); - }; - Selector.prototype.isJustParentSelector = function () { - return !this.mediaEmpty && - this.elements.length === 1 && - this.elements[0].value === '&' && - (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === ''); - }; - Selector.prototype.eval = function (context) { - var evaldCondition = this.condition && this.condition.eval(context); - var elements = this.elements; - var extendList = this.extendList; - elements = elements && elements.map(function (e) { return e.eval(context); }); - extendList = extendList && extendList.map(function (extend) { return extend.eval(context); }); - return this.createDerived(elements, extendList, evaldCondition); - }; - Selector.prototype.genCSS = function (context, output) { - var i; - var element; - if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') { - output.add(' ', this.fileInfo(), this.getIndex()); - } - for (i = 0; i < this.elements.length; i++) { - element = this.elements[i]; - element.genCSS(context, output); - } - }; - Selector.prototype.getIsOutput = function () { - return this.evaldCondition; - }; - return Selector; -}(node_1.default)); -Selector.prototype.type = 'Selector'; -exports.default = Selector; -//# sourceMappingURL=selector.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/selector.js.map b/packages/less/lib/less/tree/selector.js.map deleted file mode 100644 index 15a036262..000000000 --- a/packages/less/lib/less/tree/selector.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"selector.js","sourceRoot":"","sources":["../../../src/less/tree/selector.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,sDAAgC;AAChC,6DAAsC;AAEtC;IAAuB,4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AAO,OAAO,EAAE,MAAM;QAClB,IAAI,CAAC,CAAC;QACN,IAAI,OAAO,CAAC;QACZ,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,EAAE;YAClF,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrD;QACD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC3B,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SACnC;IACL,CAAC;IAED,8BAAW,GAAX;QACI,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IACL,eAAC;AAAD,CAAC,AA1ID,CAAuB,cAAI,GA0I1B;AAED,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC;AACrC,kBAAe,QAAQ,CAAC","sourcesContent":["import Node from './node';\nimport Element from './element';\nimport LessError from '../less-error';\n\nclass Selector extends Node {\n constructor(elements, extendList, condition, index, currentFileInfo, visibilityInfo) {\n super();\n\n this.extendList = extendList;\n this.condition = condition;\n this.evaldCondition = !condition;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.elements = this.getElements(elements);\n this.mixinElements_ = undefined;\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.elements, this);\n }\n\n accept(visitor) {\n if (this.elements) {\n this.elements = visitor.visitArray(this.elements);\n }\n if (this.extendList) {\n this.extendList = visitor.visitArray(this.extendList);\n }\n if (this.condition) {\n this.condition = visitor.visit(this.condition);\n }\n }\n\n createDerived(elements, extendList, evaldCondition) {\n elements = this.getElements(elements);\n const newSelector = new Selector(elements, extendList || this.extendList,\n null, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;\n newSelector.mediaEmpty = this.mediaEmpty;\n return newSelector;\n }\n\n getElements(els) {\n if (!els) {\n return [new Element('', '&', false, this._index, this._fileInfo)];\n }\n if (typeof els === 'string') {\n this.parse.parseNode(\n els, \n ['selector'],\n this._index, \n this._fileInfo, \n function(err, result) {\n if (err) {\n throw new LessError({\n index: err.index,\n message: err.message\n }, this.parse.imports, this._fileInfo.filename);\n }\n els = result[0].elements;\n });\n }\n return els;\n }\n\n createEmptySelectors() {\n const el = new Element('', '&', false, this._index, this._fileInfo);\n const sels = [new Selector([el], null, null, this._index, this._fileInfo)];\n sels[0].mediaEmpty = true;\n return sels;\n }\n\n match(other) {\n const elements = this.elements;\n const len = elements.length;\n let olen;\n let i;\n\n other = other.mixinElements();\n olen = other.length;\n if (olen === 0 || len < olen) {\n return 0;\n } else {\n for (i = 0; i < olen; i++) {\n if (elements[i].value !== other[i]) {\n return 0;\n }\n }\n }\n\n return olen; // return number of matched elements\n }\n\n mixinElements() {\n if (this.mixinElements_) {\n return this.mixinElements_;\n }\n\n let elements = this.elements.map( v => v.combinator.value + (v.value.value || v.value)).join('').match(/[,&#\\*\\.\\w-]([\\w-]|(\\\\.))*/g);\n\n if (elements) {\n if (elements[0] === '&') {\n elements.shift();\n }\n } else {\n elements = [];\n }\n\n return (this.mixinElements_ = elements);\n }\n\n isJustParentSelector() {\n return !this.mediaEmpty &&\n this.elements.length === 1 &&\n this.elements[0].value === '&' &&\n (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === '');\n }\n\n eval(context) {\n const evaldCondition = this.condition && this.condition.eval(context);\n let elements = this.elements;\n let extendList = this.extendList;\n\n elements = elements && elements.map(e => e.eval(context));\n extendList = extendList && extendList.map(extend => extend.eval(context));\n\n return this.createDerived(elements, extendList, evaldCondition);\n }\n\n genCSS(context, output) {\n let i;\n let element;\n if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') {\n output.add(' ', this.fileInfo(), this.getIndex());\n }\n for (i = 0; i < this.elements.length; i++) {\n element = this.elements[i];\n element.genCSS(context, output);\n }\n }\n\n getIsOutput() {\n return this.evaldCondition;\n }\n}\n\nSelector.prototype.type = 'Selector';\nexport default Selector;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/unicode-descriptor.js b/packages/less/lib/less/tree/unicode-descriptor.js deleted file mode 100644 index 7d1130616..000000000 --- a/packages/less/lib/less/tree/unicode-descriptor.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var UnicodeDescriptor = /** @class */ (function (_super) { - __extends(UnicodeDescriptor, _super); - function UnicodeDescriptor(value) { - var _this = _super.call(this) || this; - _this.value = value; - return _this; - } - return UnicodeDescriptor; -}(node_1.default)); -UnicodeDescriptor.prototype.type = 'UnicodeDescriptor'; -exports.default = UnicodeDescriptor; -//# sourceMappingURL=unicode-descriptor.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/unicode-descriptor.js.map b/packages/less/lib/less/tree/unicode-descriptor.js.map deleted file mode 100644 index 6610eca61..000000000 --- a/packages/less/lib/less/tree/unicode-descriptor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unicode-descriptor.js","sourceRoot":"","sources":["../../../src/less/tree/unicode-descriptor.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAgC,qCAAI;IAChC,2BAAY,KAAK;QAAjB,YACI,iBAAO,SAGV;QADG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACvB,CAAC;IACL,wBAAC;AAAD,CAAC,AAND,CAAgC,cAAI,GAMnC;AAED,iBAAiB,CAAC,SAAS,CAAC,IAAI,GAAG,mBAAmB,CAAC;AAEvD,kBAAe,iBAAiB,CAAC","sourcesContent":["import Node from './node';\n\nclass UnicodeDescriptor extends Node {\n constructor(value) {\n super();\n\n this.value = value;\n }\n}\n\nUnicodeDescriptor.prototype.type = 'UnicodeDescriptor';\n\nexport default UnicodeDescriptor;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/unit.js b/packages/less/lib/less/tree/unit.js deleted file mode 100644 index 4bac42389..000000000 --- a/packages/less/lib/less/tree/unit.js +++ /dev/null @@ -1,159 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var unit_conversions_1 = __importDefault(require("../data/unit-conversions")); -var utils = __importStar(require("../utils")); -var Unit = /** @class */ (function (_super) { - __extends(Unit, _super); - function Unit(numerator, denominator, backupUnit) { - var _this = _super.call(this) || this; - _this.numerator = numerator ? utils.copyArray(numerator).sort() : []; - _this.denominator = denominator ? utils.copyArray(denominator).sort() : []; - if (backupUnit) { - _this.backupUnit = backupUnit; - } - else if (numerator && numerator.length) { - _this.backupUnit = numerator[0]; - } - return _this; - } - Unit.prototype.clone = function () { - return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit); - }; - Unit.prototype.genCSS = function (context, output) { - // Dimension checks the unit is singular and throws an error if in strict math mode. - var strictUnits = context && context.strictUnits; - if (this.numerator.length === 1) { - output.add(this.numerator[0]); // the ideal situation - } - else if (!strictUnits && this.backupUnit) { - output.add(this.backupUnit); - } - else if (!strictUnits && this.denominator.length) { - output.add(this.denominator[0]); - } - }; - Unit.prototype.toString = function () { - var i; - var returnStr = this.numerator.join('*'); - for (i = 0; i < this.denominator.length; i++) { - returnStr += "/" + this.denominator[i]; - } - return returnStr; - }; - Unit.prototype.compare = function (other) { - return this.is(other.toString()) ? 0 : undefined; - }; - Unit.prototype.is = function (unitString) { - return this.toString().toUpperCase() === unitString.toUpperCase(); - }; - Unit.prototype.isLength = function () { - return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS()); - }; - Unit.prototype.isEmpty = function () { - return this.numerator.length === 0 && this.denominator.length === 0; - }; - Unit.prototype.isSingular = function () { - return this.numerator.length <= 1 && this.denominator.length === 0; - }; - Unit.prototype.map = function (callback) { - var i; - for (i = 0; i < this.numerator.length; i++) { - this.numerator[i] = callback(this.numerator[i], false); - } - for (i = 0; i < this.denominator.length; i++) { - this.denominator[i] = callback(this.denominator[i], true); - } - }; - Unit.prototype.usedUnits = function () { - var group; - var result = {}; - var mapUnit; - var groupName; - mapUnit = function (atomicUnit) { - /* jshint loopfunc:true */ - if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { - result[groupName] = atomicUnit; - } - return atomicUnit; - }; - for (groupName in unit_conversions_1.default) { - if (unit_conversions_1.default.hasOwnProperty(groupName)) { - group = unit_conversions_1.default[groupName]; - this.map(mapUnit); - } - } - return result; - }; - Unit.prototype.cancel = function () { - var counter = {}; - var atomicUnit; - var i; - for (i = 0; i < this.numerator.length; i++) { - atomicUnit = this.numerator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) + 1; - } - for (i = 0; i < this.denominator.length; i++) { - atomicUnit = this.denominator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) - 1; - } - this.numerator = []; - this.denominator = []; - for (atomicUnit in counter) { - if (counter.hasOwnProperty(atomicUnit)) { - var count = counter[atomicUnit]; - if (count > 0) { - for (i = 0; i < count; i++) { - this.numerator.push(atomicUnit); - } - } - else if (count < 0) { - for (i = 0; i < -count; i++) { - this.denominator.push(atomicUnit); - } - } - } - } - this.numerator.sort(); - this.denominator.sort(); - }; - return Unit; -}(node_1.default)); -Unit.prototype.type = 'Unit'; -exports.default = Unit; -//# sourceMappingURL=unit.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/unit.js.map b/packages/less/lib/less/tree/unit.js.map deleted file mode 100644 index b87a58a33..000000000 --- a/packages/less/lib/less/tree/unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unit.js","sourceRoot":"","sources":["../../../src/less/tree/unit.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA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AmB,cAAI,GAqItB;AAED,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC;AAC7B,kBAAe,IAAI,CAAC","sourcesContent":["import Node from './node';\nimport unitConversions from '../data/unit-conversions';\nimport * as utils from '../utils';\n\nclass Unit extends Node {\n constructor(numerator, denominator, backupUnit) {\n super();\n\n this.numerator = numerator ? utils.copyArray(numerator).sort() : [];\n this.denominator = denominator ? utils.copyArray(denominator).sort() : [];\n if (backupUnit) {\n this.backupUnit = backupUnit;\n } else if (numerator && numerator.length) {\n this.backupUnit = numerator[0];\n }\n }\n\n clone() {\n return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit);\n }\n\n genCSS(context, output) {\n // Dimension checks the unit is singular and throws an error if in strict math mode.\n const strictUnits = context && context.strictUnits;\n if (this.numerator.length === 1) {\n output.add(this.numerator[0]); // the ideal situation\n } else if (!strictUnits && this.backupUnit) {\n output.add(this.backupUnit);\n } else if (!strictUnits && this.denominator.length) {\n output.add(this.denominator[0]);\n }\n }\n\n toString() {\n let i;\n let returnStr = this.numerator.join('*');\n for (i = 0; i < this.denominator.length; i++) {\n returnStr += `/${this.denominator[i]}`;\n }\n return returnStr;\n }\n\n compare(other) {\n return this.is(other.toString()) ? 0 : undefined;\n }\n\n is(unitString) {\n return this.toString().toUpperCase() === unitString.toUpperCase();\n }\n\n isLength() {\n return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS());\n }\n\n isEmpty() {\n return this.numerator.length === 0 && this.denominator.length === 0;\n }\n\n isSingular() {\n return this.numerator.length <= 1 && this.denominator.length === 0;\n }\n\n map(callback) {\n let i;\n\n for (i = 0; i < this.numerator.length; i++) {\n this.numerator[i] = callback(this.numerator[i], false);\n }\n\n for (i = 0; i < this.denominator.length; i++) {\n this.denominator[i] = callback(this.denominator[i], true);\n }\n }\n\n usedUnits() {\n let group;\n const result = {};\n let mapUnit;\n let groupName;\n\n mapUnit = atomicUnit => {\n /* jshint loopfunc:true */\n if (group.hasOwnProperty(atomicUnit) && !result[groupName]) {\n result[groupName] = atomicUnit;\n }\n\n return atomicUnit;\n };\n\n for (groupName in unitConversions) {\n if (unitConversions.hasOwnProperty(groupName)) {\n group = unitConversions[groupName];\n\n this.map(mapUnit);\n }\n }\n\n return result;\n }\n\n cancel() {\n const counter = {};\n let atomicUnit;\n let i;\n\n for (i = 0; i < this.numerator.length; i++) {\n atomicUnit = this.numerator[i];\n counter[atomicUnit] = (counter[atomicUnit] || 0) + 1;\n }\n\n for (i = 0; i < this.denominator.length; i++) {\n atomicUnit = this.denominator[i];\n counter[atomicUnit] = (counter[atomicUnit] || 0) - 1;\n }\n\n this.numerator = [];\n this.denominator = [];\n\n for (atomicUnit in counter) {\n if (counter.hasOwnProperty(atomicUnit)) {\n const count = counter[atomicUnit];\n\n if (count > 0) {\n for (i = 0; i < count; i++) {\n this.numerator.push(atomicUnit);\n }\n } else if (count < 0) {\n for (i = 0; i < -count; i++) {\n this.denominator.push(atomicUnit);\n }\n }\n }\n }\n\n this.numerator.sort();\n this.denominator.sort();\n }\n}\n\nUnit.prototype.type = 'Unit';\nexport default Unit;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/url.js b/packages/less/lib/less/tree/url.js deleted file mode 100644 index 1986efdb9..000000000 --- a/packages/less/lib/less/tree/url.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var URL = /** @class */ (function (_super) { - __extends(URL, _super); - function URL(val, index, currentFileInfo, isEvald) { - var _this = _super.call(this) || this; - _this.value = val; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.isEvald = isEvald; - return _this; - } - URL.prototype.accept = function (visitor) { - this.value = visitor.visit(this.value); - }; - URL.prototype.genCSS = function (context, output) { - output.add('url('); - this.value.genCSS(context, output); - output.add(')'); - }; - URL.prototype.eval = function (context) { - var val = this.value.eval(context); - var rootpath; - if (!this.isEvald) { - // Add the rootpath if the URL requires a rewrite - rootpath = this.fileInfo() && this.fileInfo().rootpath; - if (typeof rootpath === 'string' && - typeof val.value === 'string' && - context.pathRequiresRewrite(val.value)) { - if (!val.quote) { - rootpath = escapePath(rootpath); - } - val.value = context.rewritePath(val.value, rootpath); - } - else { - val.value = context.normalizePath(val.value); - } - // Add url args if enabled - if (context.urlArgs) { - if (!val.value.match(/^\s*data:/)) { - var delimiter = val.value.indexOf('?') === -1 ? '?' : '&'; - var urlArgs = delimiter + context.urlArgs; - if (val.value.indexOf('#') !== -1) { - val.value = val.value.replace('#', urlArgs + "#"); - } - else { - val.value += urlArgs; - } - } - } - } - return new URL(val, this.getIndex(), this.fileInfo(), true); - }; - return URL; -}(node_1.default)); -URL.prototype.type = 'Url'; -function escapePath(path) { - return path.replace(/[\(\)'"\s]/g, function (match) { return "\\" + match; }); -} -exports.default = URL; -//# sourceMappingURL=url.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/url.js.map b/packages/less/lib/less/tree/url.js.map deleted file mode 100644 index 9254aff87..000000000 --- a/packages/less/lib/less/tree/url.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/less/tree/url.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAkB,uBAAI;IAClB,aAAY,GAAG,EAAE,KAAK,E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GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aAChD;YAED,0BAA0B;YAC1B,IAAI,OAAO,CAAC,OAAO,EAAE;gBACjB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;oBAC/B,IAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;oBAC5D,IAAM,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;oBAC5C,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;wBAC/B,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAK,OAAO,MAAG,CAAC,CAAC;qBACrD;yBAAM;wBACH,GAAG,CAAC,KAAK,IAAI,OAAO,CAAC;qBACxB;iBACJ;aACJ;SACJ;QAED,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IACL,UAAC;AAAD,CAAC,AAtDD,CAAkB,cAAI,GAsDrB;AAED,GAAG,CAAC,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC;AAE3B,SAAS,UAAU,CAAC,IAAI;IACpB,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,UAAA,KAAK,IAAI,OAAA,OAAK,KAAO,EAAZ,CAAY,CAAC,CAAC;AAC9D,CAAC;AAED,kBAAe,GAAG,CAAC","sourcesContent":["import Node from './node';\n\nclass URL extends Node {\n constructor(val, index, currentFileInfo, isEvald) {\n super();\n\n this.value = val;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.isEvald = isEvald;\n }\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n }\n\n genCSS(context, output) {\n output.add('url(');\n this.value.genCSS(context, output);\n output.add(')');\n }\n\n eval(context) {\n const val = this.value.eval(context);\n let rootpath;\n\n if (!this.isEvald) {\n // Add the rootpath if the URL requires a rewrite\n rootpath = this.fileInfo() && this.fileInfo().rootpath;\n if (typeof rootpath === 'string' &&\n typeof val.value === 'string' &&\n context.pathRequiresRewrite(val.value)) {\n if (!val.quote) {\n rootpath = escapePath(rootpath);\n }\n val.value = context.rewritePath(val.value, rootpath);\n } else {\n val.value = context.normalizePath(val.value);\n }\n\n // Add url args if enabled\n if (context.urlArgs) {\n if (!val.value.match(/^\\s*data:/)) {\n const delimiter = val.value.indexOf('?') === -1 ? '?' : '&';\n const urlArgs = delimiter + context.urlArgs;\n if (val.value.indexOf('#') !== -1) {\n val.value = val.value.replace('#', `${urlArgs}#`);\n } else {\n val.value += urlArgs;\n }\n }\n }\n }\n\n return new URL(val, this.getIndex(), this.fileInfo(), true);\n }\n}\n\nURL.prototype.type = 'Url';\n\nfunction escapePath(path) {\n return path.replace(/[\\(\\)'\"\\s]/g, match => `\\\\${match}`);\n}\n\nexport default URL;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/value.js b/packages/less/lib/less/tree/value.js deleted file mode 100644 index eedd111d1..000000000 --- a/packages/less/lib/less/tree/value.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var Value = /** @class */ (function (_super) { - __extends(Value, _super); - function Value(value) { - var _this = _super.call(this) || this; - if (!value) { - throw new Error('Value requires an array argument'); - } - if (!Array.isArray(value)) { - _this.value = [value]; - } - else { - _this.value = value; - } - return _this; - } - Value.prototype.accept = function (visitor) { - if (this.value) { - this.value = visitor.visitArray(this.value); - } - }; - Value.prototype.eval = function (context) { - if (this.value.length === 1) { - return this.value[0].eval(context); - } - else { - return new Value(this.value.map(function (v) { return v.eval(context); })); - } - }; - Value.prototype.genCSS = function (context, output) { - var i; - for (i = 0; i < this.value.length; i++) { - this.value[i].genCSS(context, output); - if (i + 1 < this.value.length) { - output.add((context && context.compress) ? ',' : ', '); - } - } - }; - return Value; -}(node_1.default)); -Value.prototype.type = 'Value'; -exports.default = Value; -//# sourceMappingURL=value.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/value.js.map b/packages/less/lib/less/tree/value.js.map deleted file mode 100644 index 4ef2c429b..000000000 --- a/packages/less/lib/less/tree/value.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"value.js","sourceRoot":"","sources":["../../../src/less/tree/value.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B;IAAoB,yBAAI;IACpB,eAAY,KAAK;QAAjB,YACI,iBAAO,SAWV;QATG,IAAI,CAAC,KAAK,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACvD;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACvB,KAAI,CAAC,KAAK,GAAG,CAAE,KAAK,CAAE,CAAC;SAC1B;aACI;YACD,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;;IACL,CAAC;IAED,sBAAM,GAAN,UAAO,OAAO;QACV,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC/C;IACL,CAAC;IAED,oBAAI,GAAJ,UAAK,OAAO;QACR,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACtC;aAAM;YACH,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAf,CAAe,CAAC,CAAC,CAAC;SAC1D;IACL,CAAC;IAED,sBAAM,GAAN,UAAO,OAAO,EAAE,MAAM;QAClB,IAAI,CAAC,CAAC;QACN,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC1D;SACJ;IACL,CAAC;IACL,YAAC;AAAD,CAAC,AAtCD,CAAoB,cAAI,GAsCvB;AAED,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,OAAO,CAAC;AAC/B,kBAAe,KAAK,CAAC","sourcesContent":["import Node from './node';\n\nclass Value extends Node {\n constructor(value) {\n super();\n\n if (!value) {\n throw new Error('Value requires an array argument');\n }\n if (!Array.isArray(value)) {\n this.value = [ value ];\n }\n else {\n this.value = value;\n }\n }\n\n accept(visitor) {\n if (this.value) {\n this.value = visitor.visitArray(this.value);\n }\n }\n\n eval(context) {\n if (this.value.length === 1) {\n return this.value[0].eval(context);\n } else {\n return new Value(this.value.map(v => v.eval(context)));\n }\n }\n\n genCSS(context, output) {\n let i;\n for (i = 0; i < this.value.length; i++) {\n this.value[i].genCSS(context, output);\n if (i + 1 < this.value.length) {\n output.add((context && context.compress) ? ',' : ', ');\n }\n }\n }\n}\n\nValue.prototype.type = 'Value';\nexport default Value;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/variable-call.js b/packages/less/lib/less/tree/variable-call.js deleted file mode 100644 index a8c72b3d8..000000000 --- a/packages/less/lib/less/tree/variable-call.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var variable_1 = __importDefault(require("./variable")); -var ruleset_1 = __importDefault(require("./ruleset")); -var detached_ruleset_1 = __importDefault(require("./detached-ruleset")); -var less_error_1 = __importDefault(require("../less-error")); -var VariableCall = /** @class */ (function (_super) { - __extends(VariableCall, _super); - function VariableCall(variable, index, currentFileInfo) { - var _this = _super.call(this) || this; - _this.variable = variable; - _this._index = index; - _this._fileInfo = currentFileInfo; - _this.allowRoot = true; - return _this; - } - VariableCall.prototype.eval = function (context) { - var rules; - var detachedRuleset = new variable_1.default(this.variable, this.getIndex(), this.fileInfo()).eval(context); - var error = new less_error_1.default({ message: "Could not evaluate variable call " + this.variable }); - if (!detachedRuleset.ruleset) { - if (detachedRuleset.rules) { - rules = detachedRuleset; - } - else if (Array.isArray(detachedRuleset)) { - rules = new ruleset_1.default('', detachedRuleset); - } - else if (Array.isArray(detachedRuleset.value)) { - rules = new ruleset_1.default('', detachedRuleset.value); - } - else { - throw error; - } - detachedRuleset = new detached_ruleset_1.default(rules); - } - if (detachedRuleset.ruleset) { - return detachedRuleset.callEval(context); - } - throw error; - }; - return VariableCall; -}(node_1.default)); -VariableCall.prototype.type = 'VariableCall'; -exports.default = VariableCall; -//# sourceMappingURL=variable-call.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/variable-call.js.map b/packages/less/lib/less/tree/variable-call.js.map deleted file mode 100644 index 60de7cce6..000000000 --- a/packages/less/lib/less/tree/variable-call.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"variable-call.js","sourceRoot":"","sources":["../../../src/less/tree/variable-call.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,wDAAkC;AAClC,sDAAgC;AAChC,wEAAiD;AACjD,6DAAsC;AAEtC;IAA2B,gCAAI;IAC3B,sBAAY,QAAQ,EAAE,KAAK,EAAE,eAAe;QAA5C,YACI,iBAAO,SAMV;QAJG,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACjC,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;;IAC1B,CAAC;IAED,2BAAI,GAAJ,UAAK,OAAO;QACR,IAAI,KAAK,CAAC;QACV,IAAI,eAAe,GAAG,IAAI,kBAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClG,IAAM,KAAK,GAAG,IAAI,oBAAS,CAAC,EAAC,OAAO,EAAE,sCAAoC,IAAI,CAAC,QAAU,EAAC,CAAC,CAAC;QAE5F,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;YAC1B,IAAI,eAAe,CAAC,KAAK,EAAE;gBACvB,KAAK,GAAG,eAAe,CAAC;aAC3B;iBACI,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;gBACrC,KAAK,GAAG,IAAI,iBAAO,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;aAC5C;iBACI,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;gBAC3C,KAAK,GAAG,IAAI,iBAAO,CAAC,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;aAClD;iBACI;gBACD,MAAM,KAAK,CAAC;aACf;YACD,eAAe,GAAG,IAAI,0BAAe,CAAC,KAAK,CAAC,CAAC;SAChD;QAED,IAAI,eAAe,CAAC,OAAO,EAAE;YACzB,OAAO,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC5C;QACD,MAAM,KAAK,CAAC;IAChB,CAAC;IACL,mBAAC;AAAD,CAAC,AApCD,CAA2B,cAAI,GAoC9B;AAED,YAAY,CAAC,SAAS,CAAC,IAAI,GAAG,cAAc,CAAC;AAC7C,kBAAe,YAAY,CAAC","sourcesContent":["import Node from './node';\nimport Variable from './variable';\nimport Ruleset from './ruleset';\nimport DetachedRuleset from './detached-ruleset';\nimport LessError from '../less-error';\n\nclass VariableCall extends Node {\n constructor(variable, index, currentFileInfo) {\n super();\n\n this.variable = variable;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.allowRoot = true;\n }\n\n eval(context) {\n let rules;\n let detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context);\n const error = new LessError({message: `Could not evaluate variable call ${this.variable}`});\n\n if (!detachedRuleset.ruleset) {\n if (detachedRuleset.rules) {\n rules = detachedRuleset;\n }\n else if (Array.isArray(detachedRuleset)) {\n rules = new Ruleset('', detachedRuleset);\n }\n else if (Array.isArray(detachedRuleset.value)) {\n rules = new Ruleset('', detachedRuleset.value);\n }\n else {\n throw error;\n }\n detachedRuleset = new DetachedRuleset(rules);\n }\n\n if (detachedRuleset.ruleset) {\n return detachedRuleset.callEval(context);\n }\n throw error;\n }\n}\n\nVariableCall.prototype.type = 'VariableCall';\nexport default VariableCall;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/tree/variable.js b/packages/less/lib/less/tree/variable.js deleted file mode 100644 index 9583a87e1..000000000 --- a/packages/less/lib/less/tree/variable.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var node_1 = __importDefault(require("./node")); -var call_1 = __importDefault(require("./call")); -var Variable = /** @class */ (function (_super) { - __extends(Variable, _super); - function Variable(name, index, currentFileInfo) { - var _this = _super.call(this) || this; - _this.name = name; - _this._index = index; - _this._fileInfo = currentFileInfo; - return _this; - } - Variable.prototype.eval = function (context) { - var variable; - var name = this.name; - if (name.indexOf('@@') === 0) { - name = "@" + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value; - } - if (this.evaluating) { - throw { type: 'Name', message: "Recursive variable definition for " + name, filename: this.fileInfo().filename, - index: this.getIndex() }; - } - this.evaluating = true; - variable = this.find(context.frames, function (frame) { - var v = frame.variable(name); - if (v) { - if (v.important) { - var importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - // If in calc, wrap vars in a function call to cascade evaluate args first - if (context.inCalc) { - return (new call_1.default('_SELF', [v.value])).eval(context); - } - else { - return v.value.eval(context); - } - } - }); - if (variable) { - this.evaluating = false; - return variable; - } - else { - throw { type: 'Name', message: "variable " + name + " is undefined", filename: this.fileInfo().filename, - index: this.getIndex() }; - } - }; - Variable.prototype.find = function (obj, fun) { - for (var i = 0, r = void 0; i < obj.length; i++) { - r = fun.call(obj, obj[i]); - if (r) { - return r; - } - } - return null; - }; - return Variable; -}(node_1.default)); -Variable.prototype.type = 'Variable'; -exports.default = Variable; -//# sourceMappingURL=variable.js.map \ No newline at end of file diff --git a/packages/less/lib/less/tree/variable.js.map b/packages/less/lib/less/tree/variable.js.map deleted file mode 100644 index 0f78c64d0..000000000 --- a/packages/less/lib/less/tree/variable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"variable.js","sourceRoot":"","sources":["../../../src/less/tree/variable.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAE1B;IAAuB,4BAAI;IACvB,kBAAY,IAAI,EAAE,KAAK,EAAE,eAAe;QAAxC,YACI,iBAAO,SAKV;QAHG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAI,CAAC,SAAS,GAAG,eAAe,CAAC;;IACrC,CAAC;IAED,uBAAI,GAAJ,UAAK,OAAO;QACR,IAAI,QAAQ,CAAC;QACb,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAErB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC1B,IAAI,GAAG,MAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,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AAE,CAAC;SAChC;IACL,CAAC;IAED,uBAAI,GAAJ,UAAK,GAAG,EAAE,GAAG;QACT,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,SAAA,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,EAAE;gBAAE,OAAO,CAAC,CAAC;aAAE;SACvB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,eAAC;AAAD,CAAC,AA5DD,CAAuB,cAAI,GA4D1B;AAED,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC;AACrC,kBAAe,QAAQ,CAAC","sourcesContent":["import Node from './node';\nimport Call from './call';\n\nclass Variable extends Node {\n constructor(name, index, currentFileInfo) {\n super();\n\n this.name = name;\n this._index = index;\n this._fileInfo = currentFileInfo;\n }\n\n eval(context) {\n let variable;\n let name = this.name;\n\n if (name.indexOf('@@') === 0) {\n name = `@${new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value}`;\n }\n\n if (this.evaluating) {\n throw { type: 'Name',\n message: `Recursive variable definition for ${name}`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n this.evaluating = true;\n\n variable = this.find(context.frames, frame => {\n const v = frame.variable(name);\n if (v) {\n if (v.important) {\n const importantScope = context.importantScope[context.importantScope.length - 1];\n importantScope.important = v.important;\n }\n // If in calc, wrap vars in a function call to cascade evaluate args first\n if (context.inCalc) {\n return (new Call('_SELF', [v.value])).eval(context);\n }\n else {\n return v.value.eval(context);\n }\n }\n });\n if (variable) {\n this.evaluating = false;\n return variable;\n } else {\n throw { type: 'Name',\n message: `variable ${name} is undefined`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n }\n\n find(obj, fun) {\n for (let i = 0, r; i < obj.length; i++) {\n r = fun.call(obj, obj[i]);\n if (r) { return r; }\n }\n return null;\n }\n}\n\nVariable.prototype.type = 'Variable';\nexport default Variable;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/utils.js b/packages/less/lib/less/utils.js deleted file mode 100644 index 53a86630b..000000000 --- a/packages/less/lib/less/utils.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.flattenArray = exports.merge = exports.copyOptions = exports.defaults = exports.clone = exports.copyArray = exports.getLocation = void 0; -/* jshint proto: true */ -var Constants = __importStar(require("./constants")); -function getLocation(index, inputStream) { - var n = index + 1; - var line = null; - var column = -1; - while (--n >= 0 && inputStream.charAt(n) !== '\n') { - column++; - } - if (typeof index === 'number') { - line = (inputStream.slice(0, index).match(/\n/g) || '').length; - } - return { - line: line, - column: column - }; -} -exports.getLocation = getLocation; -function copyArray(arr) { - var i; - var length = arr.length; - var copy = new Array(length); - for (i = 0; i < length; i++) { - copy[i] = arr[i]; - } - return copy; -} -exports.copyArray = copyArray; -function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; -} -exports.clone = clone; -function defaults(obj1, obj2) { - var newObj = obj2 || {}; - if (!obj2._defaults) { - newObj = {}; - var defaults_1 = __assign({}, obj1); - newObj._defaults = defaults_1; - var cloned = obj2 ? __assign({}, obj2) : {}; - Object.assign(newObj, defaults_1, cloned); - } - return newObj; -} -exports.defaults = defaults; -function copyOptions(obj1, obj2) { - if (obj2 && obj2._defaults) { - return obj2; - } - var opts = defaults(obj1, obj2); - if (opts.strictMath) { - opts.math = Constants.Math.STRICT_LEGACY; - } - // Back compat with changed relativeUrls option - if (opts.relativeUrls) { - opts.rewriteUrls = Constants.RewriteUrls.ALL; - } - if (typeof opts.math === 'string') { - switch (opts.math.toLowerCase()) { - case 'always': - opts.math = Constants.Math.ALWAYS; - break; - case 'parens-division': - opts.math = Constants.Math.PARENS_DIVISION; - break; - case 'strict': - case 'parens': - opts.math = Constants.Math.PARENS; - break; - case 'strict-legacy': - opts.math = Constants.Math.STRICT_LEGACY; - } - } - if (typeof opts.rewriteUrls === 'string') { - switch (opts.rewriteUrls.toLowerCase()) { - case 'off': - opts.rewriteUrls = Constants.RewriteUrls.OFF; - break; - case 'local': - opts.rewriteUrls = Constants.RewriteUrls.LOCAL; - break; - case 'all': - opts.rewriteUrls = Constants.RewriteUrls.ALL; - break; - } - } - return opts; -} -exports.copyOptions = copyOptions; -function merge(obj1, obj2) { - for (var prop in obj2) { - if (obj2.hasOwnProperty(prop)) { - obj1[prop] = obj2[prop]; - } - } - return obj1; -} -exports.merge = merge; -function flattenArray(arr, result) { - if (result === void 0) { result = []; } - for (var i = 0, length_1 = arr.length; i < length_1; i++) { - var value = arr[i]; - if (Array.isArray(value)) { - flattenArray(value, result); - } - else { - if (value !== undefined) { - result.push(value); - } - } - } - return result; -} -exports.flattenArray = flattenArray; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/packages/less/lib/less/utils.js.map b/packages/less/lib/less/utils.js.map deleted file mode 100644 index f2076dd32..000000000 --- a/packages/less/lib/less/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/less/utils.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAAwB;AACxB,qDAAyC;AAEzC,SAAgB,WAAW,CAAC,KAAK,EAAE,WAAW;IAC1C,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IAClB,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAEhB,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC/C,MAAM,EAAE,CAAC;KACZ;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,IAAI,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;KAClE;IAED,OAAO;QACH,IAAI,MAAA;QACJ,MAAM,QAAA;KACT,CAAC;AACN,CAAC;AAjBD,kCAiBC;AAED,SAAgB,SAAS,CAAC,GAAG;IACzB,IAAI,CAAC,CAAC;IACN,IAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAC1B,IAAM,IAAI,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAE/B,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QACzB,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;KACpB;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AATD,8BASC;AAED,SAAgB,KAAK,CAAC,GAAG;IACrB,IAAM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IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,QAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,QAAM,EAAE,CAAC,EAAE,EAAE;QAClD,IAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACtB,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SAC/B;aAAM;YACH,IAAI,KAAK,KAAK,SAAS,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACtB;SACJ;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAZD,oCAYC","sourcesContent":["/* jshint proto: true */\nimport * as Constants from './constants';\n\nexport function getLocation(index, inputStream) {\n let n = index + 1;\n let line = null;\n let column = -1;\n\n while (--n >= 0 && inputStream.charAt(n) !== '\\n') {\n column++;\n }\n\n if (typeof index === 'number') {\n line = (inputStream.slice(0, index).match(/\\n/g) || '').length;\n }\n\n return {\n line,\n column\n };\n}\n\nexport function copyArray(arr) {\n let i;\n const length = arr.length;\n const copy = new Array(length);\n\n for (i = 0; i < length; i++) {\n copy[i] = arr[i];\n }\n return copy;\n}\n\nexport function clone(obj) {\n const cloned = {};\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n cloned[prop] = obj[prop];\n }\n }\n return cloned;\n}\n\nexport function defaults(obj1, obj2) {\n let newObj = obj2 || {};\n if (!obj2._defaults) {\n newObj = {};\n const defaults = {...obj1};\n newObj._defaults = defaults;\n const cloned = obj2 ? {...obj2} : {};\n Object.assign(newObj, defaults, cloned);\n }\n return newObj;\n}\n\nexport function copyOptions(obj1, obj2) {\n if (obj2 && obj2._defaults) {\n return obj2;\n }\n const opts = defaults(obj1, obj2);\n if (opts.strictMath) {\n opts.math = Constants.Math.STRICT_LEGACY;\n }\n // Back compat with changed relativeUrls option\n if (opts.relativeUrls) {\n opts.rewriteUrls = Constants.RewriteUrls.ALL;\n }\n if (typeof opts.math === 'string') {\n switch (opts.math.toLowerCase()) {\n case 'always':\n opts.math = Constants.Math.ALWAYS;\n break;\n case 'parens-division':\n opts.math = Constants.Math.PARENS_DIVISION;\n break;\n case 'strict':\n case 'parens':\n opts.math = Constants.Math.PARENS;\n break;\n case 'strict-legacy':\n opts.math = Constants.Math.STRICT_LEGACY;\n }\n }\n if (typeof opts.rewriteUrls === 'string') {\n switch (opts.rewriteUrls.toLowerCase()) {\n case 'off':\n opts.rewriteUrls = Constants.RewriteUrls.OFF;\n break;\n case 'local':\n opts.rewriteUrls = Constants.RewriteUrls.LOCAL;\n break;\n case 'all':\n opts.rewriteUrls = Constants.RewriteUrls.ALL;\n break;\n }\n }\n return opts;\n}\n\nexport function merge(obj1, obj2) {\n for (const prop in obj2) {\n if (obj2.hasOwnProperty(prop)) {\n obj1[prop] = obj2[prop];\n }\n }\n return obj1;\n}\n\nexport function flattenArray(arr, result = []) {\n for (let i = 0, length = arr.length; i < length; i++) {\n const value = arr[i];\n if (Array.isArray(value)) {\n flattenArray(value, result);\n } else {\n if (value !== undefined) {\n result.push(value);\n }\n }\n }\n return result;\n}"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/extend-visitor.js b/packages/less/lib/less/visitors/extend-visitor.js deleted file mode 100644 index 77b6e364b..000000000 --- a/packages/less/lib/less/visitors/extend-visitor.js +++ /dev/null @@ -1,462 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var tree_1 = __importDefault(require("../tree")); -var visitor_1 = __importDefault(require("./visitor")); -var logger_1 = __importDefault(require("../logger")); -var utils = __importStar(require("../utils")); -/* jshint loopfunc:true */ -var ExtendFinderVisitor = /** @class */ (function () { - function ExtendFinderVisitor() { - this._visitor = new visitor_1.default(this); - this.contexts = []; - this.allExtendsStack = [[]]; - } - ExtendFinderVisitor.prototype.run = function (root) { - root = this._visitor.visit(root); - root.allExtends = this.allExtendsStack[0]; - return root; - }; - ExtendFinderVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ExtendFinderVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ExtendFinderVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - var i; - var j; - var extend; - var allSelectorsExtendList = []; - var extendList; - // get &:extend(.a); rules which apply to all selectors in this ruleset - var rules = rulesetNode.rules; - var ruleCnt = rules ? rules.length : 0; - for (i = 0; i < ruleCnt; i++) { - if (rulesetNode.rules[i] instanceof tree_1.default.Extend) { - allSelectorsExtendList.push(rules[i]); - rulesetNode.extendOnEveryPath = true; - } - } - // now find every selector and apply the extends that apply to all extends - // and the ones which apply to an individual extend - var paths = rulesetNode.paths; - for (i = 0; i < paths.length; i++) { - var selectorPath = paths[i]; - var selector = selectorPath[selectorPath.length - 1]; - var selExtendList = selector.extendList; - extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList) - : allSelectorsExtendList; - if (extendList) { - extendList = extendList.map(function (allSelectorsExtend) { return allSelectorsExtend.clone(); }); - } - for (j = 0; j < extendList.length; j++) { - this.foundExtends = true; - extend = extendList[j]; - extend.findSelfSelectors(selectorPath); - extend.ruleset = rulesetNode; - if (j === 0) { - extend.firstExtendOnThisSelectorPath = true; - } - this.allExtendsStack[this.allExtendsStack.length - 1].push(extend); - } - } - this.contexts.push(rulesetNode.selectors); - }; - ExtendFinderVisitor.prototype.visitRulesetOut = function (rulesetNode) { - if (!rulesetNode.root) { - this.contexts.length = this.contexts.length - 1; - } - }; - ExtendFinderVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - mediaNode.allExtends = []; - this.allExtendsStack.push(mediaNode.allExtends); - }; - ExtendFinderVisitor.prototype.visitMediaOut = function (mediaNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - }; - ExtendFinderVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - atRuleNode.allExtends = []; - this.allExtendsStack.push(atRuleNode.allExtends); - }; - ExtendFinderVisitor.prototype.visitAtRuleOut = function (atRuleNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - }; - return ExtendFinderVisitor; -}()); -var ProcessExtendsVisitor = /** @class */ (function () { - function ProcessExtendsVisitor() { - this._visitor = new visitor_1.default(this); - } - ProcessExtendsVisitor.prototype.run = function (root) { - var extendFinder = new ExtendFinderVisitor(); - this.extendIndices = {}; - extendFinder.run(root); - if (!extendFinder.foundExtends) { - return root; - } - root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends)); - this.allExtendsStack = [root.allExtends]; - var newRoot = this._visitor.visit(root); - this.checkExtendsForNonMatched(root.allExtends); - return newRoot; - }; - ProcessExtendsVisitor.prototype.checkExtendsForNonMatched = function (extendList) { - var indices = this.extendIndices; - extendList.filter(function (extend) { return !extend.hasFoundMatches && extend.parent_ids.length == 1; }).forEach(function (extend) { - var selector = '_unknown_'; - try { - selector = extend.selector.toCSS({}); - } - catch (_) { } - if (!indices[extend.index + " " + selector]) { - indices[extend.index + " " + selector] = true; - logger_1.default.warn("extend '" + selector + "' has no matches"); - } - }); - }; - ProcessExtendsVisitor.prototype.doExtendChaining = function (extendsList, extendsListTarget, iterationCount) { - // - // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering - // and pasting the selector we would do normally, but we are also adding an extend with the same target selector - // this means this new extend can then go and alter other extends - // - // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors - // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already - // processed if we look at each selector at a time, as is done in visitRuleset - var extendIndex; - var targetExtendIndex; - var matches; - var extendsToAdd = []; - var newSelector; - var extendVisitor = this; - var selectorPath; - var extend; - var targetExtend; - var newExtend; - iterationCount = iterationCount || 0; - // loop through comparing every extend with every target extend. - // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place - // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one - // and the second is the target. - // the separation into two lists allows us to process a subset of chains with a bigger set, as is the - // case when processing media queries - for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) { - for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) { - extend = extendsList[extendIndex]; - targetExtend = extendsListTarget[targetExtendIndex]; - // look for circular references - if (extend.parent_ids.indexOf(targetExtend.object_id) >= 0) { - continue; - } - // find a match in the target extends self selector (the bit before :extend) - selectorPath = [targetExtend.selfSelectors[0]]; - matches = extendVisitor.findMatch(extend, selectorPath); - if (matches.length) { - extend.hasFoundMatches = true; - // we found a match, so for each self selector.. - extend.selfSelectors.forEach(function (selfSelector) { - var info = targetExtend.visibilityInfo(); - // process the extend as usual - newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible()); - // but now we create a new extend from it - newExtend = new (tree_1.default.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info); - newExtend.selfSelectors = newSelector; - // add the extend onto the list of extends for that selector - newSelector[newSelector.length - 1].extendList = [newExtend]; - // record that we need to add it. - extendsToAdd.push(newExtend); - newExtend.ruleset = targetExtend.ruleset; - // remember its parents for circular references - newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids); - // only process the selector once.. if we have :extend(.a,.b) then multiple - // extends will look at the same selector path, so when extending - // we know that any others will be duplicates in terms of what is added to the css - if (targetExtend.firstExtendOnThisSelectorPath) { - newExtend.firstExtendOnThisSelectorPath = true; - targetExtend.ruleset.paths.push(newSelector); - } - }); - } - } - } - if (extendsToAdd.length) { - // try to detect circular references to stop a stack overflow. - // may no longer be needed. - this.extendChainCount++; - if (iterationCount > 100) { - var selectorOne = '{unable to calculate}'; - var selectorTwo = '{unable to calculate}'; - try { - selectorOne = extendsToAdd[0].selfSelectors[0].toCSS(); - selectorTwo = extendsToAdd[0].selector.toCSS(); - } - catch (e) { } - throw { message: "extend circular reference detected. One of the circular extends is currently:" + selectorOne + ":extend(" + selectorTwo + ")" }; - } - // now process the new extends on the existing rules so that we can handle a extending b extending c extending - // d extending e... - return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1)); - } - else { - return extendsToAdd; - } - }; - ProcessExtendsVisitor.prototype.visitDeclaration = function (ruleNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitSelector = function (selectorNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - var matches; - var pathIndex; - var extendIndex; - var allExtends = this.allExtendsStack[this.allExtendsStack.length - 1]; - var selectorsToAdd = []; - var extendVisitor = this; - var selectorPath; - // look at each selector path in the ruleset, find any extend matches and then copy, find and replace - for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) { - for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) { - selectorPath = rulesetNode.paths[pathIndex]; - // extending extends happens initially, before the main pass - if (rulesetNode.extendOnEveryPath) { - continue; - } - var extendList = selectorPath[selectorPath.length - 1].extendList; - if (extendList && extendList.length) { - continue; - } - matches = this.findMatch(allExtends[extendIndex], selectorPath); - if (matches.length) { - allExtends[extendIndex].hasFoundMatches = true; - allExtends[extendIndex].selfSelectors.forEach(function (selfSelector) { - var extendedSelectors; - extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible()); - selectorsToAdd.push(extendedSelectors); - }); - } - } - } - rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd); - }; - ProcessExtendsVisitor.prototype.findMatch = function (extend, haystackSelectorPath) { - // - // look through the haystack selector path to try and find the needle - extend.selector - // returns an array of selector matches that can then be replaced - // - var haystackSelectorIndex; - var hackstackSelector; - var hackstackElementIndex; - var haystackElement; - var targetCombinator; - var i; - var extendVisitor = this; - var needleElements = extend.selector.elements; - var potentialMatches = []; - var potentialMatch; - var matches = []; - // loop through the haystack elements - for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) { - hackstackSelector = haystackSelectorPath[haystackSelectorIndex]; - for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) { - haystackElement = hackstackSelector.elements[hackstackElementIndex]; - // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. - if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) { - potentialMatches.push({ pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0, - initialCombinator: haystackElement.combinator }); - } - for (i = 0; i < potentialMatches.length; i++) { - potentialMatch = potentialMatches[i]; - // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't - // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to - // work out what the resulting combinator will be - targetCombinator = haystackElement.combinator.value; - if (targetCombinator === '' && hackstackElementIndex === 0) { - targetCombinator = ' '; - } - // if we don't match, null our match to indicate failure - if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) || - (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) { - potentialMatch = null; - } - else { - potentialMatch.matched++; - } - // if we are still valid and have finished, test whether we have elements after and whether these are allowed - if (potentialMatch) { - potentialMatch.finished = potentialMatch.matched === needleElements.length; - if (potentialMatch.finished && - (!extend.allowAfter && - (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) { - potentialMatch = null; - } - } - // if null we remove, if not, we are still valid, so either push as a valid match or continue - if (potentialMatch) { - if (potentialMatch.finished) { - potentialMatch.length = needleElements.length; - potentialMatch.endPathIndex = haystackSelectorIndex; - potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match - potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again - matches.push(potentialMatch); - } - } - else { - potentialMatches.splice(i, 1); - i--; - } - } - } - } - return matches; - }; - ProcessExtendsVisitor.prototype.isElementValuesEqual = function (elementValue1, elementValue2) { - if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') { - return elementValue1 === elementValue2; - } - if (elementValue1 instanceof tree_1.default.Attribute) { - if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) { - return false; - } - if (!elementValue1.value || !elementValue2.value) { - if (elementValue1.value || elementValue2.value) { - return false; - } - return true; - } - elementValue1 = elementValue1.value.value || elementValue1.value; - elementValue2 = elementValue2.value.value || elementValue2.value; - return elementValue1 === elementValue2; - } - elementValue1 = elementValue1.value; - elementValue2 = elementValue2.value; - if (elementValue1 instanceof tree_1.default.Selector) { - if (!(elementValue2 instanceof tree_1.default.Selector) || elementValue1.elements.length !== elementValue2.elements.length) { - return false; - } - for (var i = 0; i < elementValue1.elements.length; i++) { - if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) { - if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) { - return false; - } - } - if (!this.isElementValuesEqual(elementValue1.elements[i].value, elementValue2.elements[i].value)) { - return false; - } - } - return true; - } - return false; - }; - ProcessExtendsVisitor.prototype.extendSelector = function (matches, selectorPath, replacementSelector, isVisible) { - // for a set of matches, replace each match with the replacement selector - var currentSelectorPathIndex = 0; - var currentSelectorPathElementIndex = 0; - var path = []; - var matchIndex; - var selector; - var firstElement; - var match; - var newElements; - for (matchIndex = 0; matchIndex < matches.length; matchIndex++) { - match = matches[matchIndex]; - selector = selectorPath[match.pathIndex]; - firstElement = new tree_1.default.Element(match.initialCombinator, replacementSelector.elements[0].value, replacementSelector.elements[0].isVariable, replacementSelector.elements[0].getIndex(), replacementSelector.elements[0].fileInfo()); - if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - newElements = selector.elements - .slice(currentSelectorPathElementIndex, match.index) - .concat([firstElement]) - .concat(replacementSelector.elements.slice(1)); - if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) { - path[path.length - 1].elements = - path[path.length - 1].elements.concat(newElements); - } - else { - path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex)); - path.push(new tree_1.default.Selector(newElements)); - } - currentSelectorPathIndex = match.endPathIndex; - currentSelectorPathElementIndex = match.endPathElementIndex; - if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) { - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - } - if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathIndex++; - } - path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length)); - path = path.map(function (currentValue) { - // we can re-use elements here, because the visibility property matters only for selectors - var derived = currentValue.createDerived(currentValue.elements); - if (isVisible) { - derived.ensureVisibility(); - } - else { - derived.ensureInvisibility(); - } - return derived; - }); - return path; - }; - ProcessExtendsVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - }; - ProcessExtendsVisitor.prototype.visitMediaOut = function (mediaNode) { - var lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - }; - ProcessExtendsVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - var newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - }; - ProcessExtendsVisitor.prototype.visitAtRuleOut = function (atRuleNode) { - var lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - }; - return ProcessExtendsVisitor; -}()); -exports.default = ProcessExtendsVisitor; -//# sourceMappingURL=extend-visitor.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/extend-visitor.js.map b/packages/less/lib/less/visitors/extend-visitor.js.map deleted file mode 100644 index 33ad53192..000000000 --- a/packages/less/lib/less/visitors/extend-visitor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"extend-visitor.js","sourceRoot":"","sources":["../../../src/less/visitors/extend-visitor.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA2B;AAC3B,sDAAgC;AAChC,qDAA+B;AAC/B,8CAAkC;AAElC,0BAA0B;AAE1B;IACI;QACI,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,eAAe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,GAAG,CAAC,CAAC,CAAC,CAAC;QACvG,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACjG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED,6CAAa,GAAb,UAAc,SAAS;QACnB,IAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC;IAC5C,CAAC;IAED,2CAAW,GAAX,UAAY,UAAU,EAAE,SAAS;QAC7B,IAAI,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACxG,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QAClG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED,8CAAc,GAAd,UAAe,UAAU;QACrB,IAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC;IAC5C,CAAC;IACL,4BAAC;AAAD,CAAC,AA/YD,IA+YC;AAED,kBAAe,qBAAqB,CAAC","sourcesContent":["import tree from '../tree';\nimport Visitor from './visitor';\nimport logger from '../logger';\nimport * as utils from '../utils';\n\n/* jshint loopfunc:true */\n\nclass ExtendFinderVisitor {\n constructor() {\n this._visitor = new Visitor(this);\n this.contexts = [];\n this.allExtendsStack = [[]];\n }\n\n run(root) {\n root = this._visitor.visit(root);\n root.allExtends = this.allExtendsStack[0];\n return root;\n }\n\n visitDeclaration(declNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n if (rulesetNode.root) {\n return;\n }\n\n let i;\n let j;\n let extend;\n const allSelectorsExtendList = [];\n let extendList;\n\n // get &:extend(.a); rules which apply to all selectors in this ruleset\n const rules = rulesetNode.rules;\n\n const ruleCnt = rules ? rules.length : 0;\n for (i = 0; i < ruleCnt; i++) {\n if (rulesetNode.rules[i] instanceof tree.Extend) {\n allSelectorsExtendList.push(rules[i]);\n rulesetNode.extendOnEveryPath = true;\n }\n }\n\n // now find every selector and apply the extends that apply to all extends\n // and the ones which apply to an individual extend\n const paths = rulesetNode.paths;\n for (i = 0; i < paths.length; i++) {\n const selectorPath = paths[i];\n const selector = selectorPath[selectorPath.length - 1];\n const selExtendList = selector.extendList;\n\n extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList)\n : allSelectorsExtendList;\n\n if (extendList) {\n extendList = extendList.map(allSelectorsExtend => allSelectorsExtend.clone());\n }\n\n for (j = 0; j < extendList.length; j++) {\n this.foundExtends = true;\n extend = extendList[j];\n extend.findSelfSelectors(selectorPath);\n extend.ruleset = rulesetNode;\n if (j === 0) { extend.firstExtendOnThisSelectorPath = true; }\n this.allExtendsStack[this.allExtendsStack.length - 1].push(extend);\n }\n }\n\n this.contexts.push(rulesetNode.selectors);\n }\n\n visitRulesetOut(rulesetNode) {\n if (!rulesetNode.root) {\n this.contexts.length = this.contexts.length - 1;\n }\n }\n\n visitMedia(mediaNode, visitArgs) {\n mediaNode.allExtends = [];\n this.allExtendsStack.push(mediaNode.allExtends);\n }\n\n visitMediaOut(mediaNode) {\n this.allExtendsStack.length = this.allExtendsStack.length - 1;\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n atRuleNode.allExtends = [];\n this.allExtendsStack.push(atRuleNode.allExtends);\n }\n\n visitAtRuleOut(atRuleNode) {\n this.allExtendsStack.length = this.allExtendsStack.length - 1;\n }\n}\n\nclass ProcessExtendsVisitor {\n constructor() {\n this._visitor = new Visitor(this);\n }\n\n run(root) {\n const extendFinder = new ExtendFinderVisitor();\n this.extendIndices = {};\n extendFinder.run(root);\n if (!extendFinder.foundExtends) { return root; }\n root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends));\n this.allExtendsStack = [root.allExtends];\n const newRoot = this._visitor.visit(root);\n this.checkExtendsForNonMatched(root.allExtends);\n return newRoot;\n }\n\n checkExtendsForNonMatched(extendList) {\n const indices = this.extendIndices;\n extendList.filter(extend => !extend.hasFoundMatches && extend.parent_ids.length == 1).forEach(extend => {\n let selector = '_unknown_';\n try {\n selector = extend.selector.toCSS({});\n }\n catch (_) {}\n\n if (!indices[`${extend.index} ${selector}`]) {\n indices[`${extend.index} ${selector}`] = true;\n logger.warn(`extend '${selector}' has no matches`);\n }\n });\n }\n\n doExtendChaining(extendsList, extendsListTarget, iterationCount) {\n //\n // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering\n // and pasting the selector we would do normally, but we are also adding an extend with the same target selector\n // this means this new extend can then go and alter other extends\n //\n // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors\n // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already\n // processed if we look at each selector at a time, as is done in visitRuleset\n\n let extendIndex;\n\n let targetExtendIndex;\n let matches;\n const extendsToAdd = [];\n let newSelector;\n const extendVisitor = this;\n let selectorPath;\n let extend;\n let targetExtend;\n let newExtend;\n\n iterationCount = iterationCount || 0;\n\n // loop through comparing every extend with every target extend.\n // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place\n // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one\n // and the second is the target.\n // the separation into two lists allows us to process a subset of chains with a bigger set, as is the\n // case when processing media queries\n for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) {\n for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) {\n\n extend = extendsList[extendIndex];\n targetExtend = extendsListTarget[targetExtendIndex];\n\n // look for circular references\n if ( extend.parent_ids.indexOf( targetExtend.object_id ) >= 0 ) { continue; }\n\n // find a match in the target extends self selector (the bit before :extend)\n selectorPath = [targetExtend.selfSelectors[0]];\n matches = extendVisitor.findMatch(extend, selectorPath);\n\n if (matches.length) {\n extend.hasFoundMatches = true;\n\n // we found a match, so for each self selector..\n extend.selfSelectors.forEach(selfSelector => {\n const info = targetExtend.visibilityInfo();\n\n // process the extend as usual\n newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible());\n\n // but now we create a new extend from it\n newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info);\n newExtend.selfSelectors = newSelector;\n\n // add the extend onto the list of extends for that selector\n newSelector[newSelector.length - 1].extendList = [newExtend];\n\n // record that we need to add it.\n extendsToAdd.push(newExtend);\n newExtend.ruleset = targetExtend.ruleset;\n\n // remember its parents for circular references\n newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids);\n\n // only process the selector once.. if we have :extend(.a,.b) then multiple\n // extends will look at the same selector path, so when extending\n // we know that any others will be duplicates in terms of what is added to the css\n if (targetExtend.firstExtendOnThisSelectorPath) {\n newExtend.firstExtendOnThisSelectorPath = true;\n targetExtend.ruleset.paths.push(newSelector);\n }\n });\n }\n }\n }\n\n if (extendsToAdd.length) {\n // try to detect circular references to stop a stack overflow.\n // may no longer be needed.\n this.extendChainCount++;\n if (iterationCount > 100) {\n let selectorOne = '{unable to calculate}';\n let selectorTwo = '{unable to calculate}';\n try {\n selectorOne = extendsToAdd[0].selfSelectors[0].toCSS();\n selectorTwo = extendsToAdd[0].selector.toCSS();\n }\n catch (e) {}\n throw { message: `extend circular reference detected. One of the circular extends is currently:${selectorOne}:extend(${selectorTwo})`};\n }\n\n // now process the new extends on the existing rules so that we can handle a extending b extending c extending\n // d extending e...\n return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1));\n } else {\n return extendsToAdd;\n }\n }\n\n visitDeclaration(ruleNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitSelector(selectorNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n if (rulesetNode.root) {\n return;\n }\n let matches;\n let pathIndex;\n let extendIndex;\n const allExtends = this.allExtendsStack[this.allExtendsStack.length - 1];\n const selectorsToAdd = [];\n const extendVisitor = this;\n let selectorPath;\n\n // look at each selector path in the ruleset, find any extend matches and then copy, find and replace\n\n for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) {\n for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) {\n selectorPath = rulesetNode.paths[pathIndex];\n\n // extending extends happens initially, before the main pass\n if (rulesetNode.extendOnEveryPath) { continue; }\n const extendList = selectorPath[selectorPath.length - 1].extendList;\n if (extendList && extendList.length) { continue; }\n\n matches = this.findMatch(allExtends[extendIndex], selectorPath);\n\n if (matches.length) {\n allExtends[extendIndex].hasFoundMatches = true;\n\n allExtends[extendIndex].selfSelectors.forEach(selfSelector => {\n let extendedSelectors;\n extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible());\n selectorsToAdd.push(extendedSelectors);\n });\n }\n }\n }\n rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd);\n }\n\n findMatch(extend, haystackSelectorPath) {\n //\n // look through the haystack selector path to try and find the needle - extend.selector\n // returns an array of selector matches that can then be replaced\n //\n let haystackSelectorIndex;\n\n let hackstackSelector;\n let hackstackElementIndex;\n let haystackElement;\n let targetCombinator;\n let i;\n const extendVisitor = this;\n const needleElements = extend.selector.elements;\n const potentialMatches = [];\n let potentialMatch;\n const matches = [];\n\n // loop through the haystack elements\n for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) {\n hackstackSelector = haystackSelectorPath[haystackSelectorIndex];\n\n for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) {\n\n haystackElement = hackstackSelector.elements[hackstackElementIndex];\n\n // if we allow elements before our match we can add a potential match every time. otherwise only at the first element.\n if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) {\n potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0,\n initialCombinator: haystackElement.combinator});\n }\n\n for (i = 0; i < potentialMatches.length; i++) {\n potentialMatch = potentialMatches[i];\n\n // selectors add \" \" onto the first element. When we use & it joins the selectors together, but if we don't\n // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to\n // work out what the resulting combinator will be\n targetCombinator = haystackElement.combinator.value;\n if (targetCombinator === '' && hackstackElementIndex === 0) {\n targetCombinator = ' ';\n }\n\n // if we don't match, null our match to indicate failure\n if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) ||\n (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) {\n potentialMatch = null;\n } else {\n potentialMatch.matched++;\n }\n\n // if we are still valid and have finished, test whether we have elements after and whether these are allowed\n if (potentialMatch) {\n potentialMatch.finished = potentialMatch.matched === needleElements.length;\n if (potentialMatch.finished &&\n (!extend.allowAfter &&\n (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) {\n potentialMatch = null;\n }\n }\n // if null we remove, if not, we are still valid, so either push as a valid match or continue\n if (potentialMatch) {\n if (potentialMatch.finished) {\n potentialMatch.length = needleElements.length;\n potentialMatch.endPathIndex = haystackSelectorIndex;\n potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match\n potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again\n matches.push(potentialMatch);\n }\n } else {\n potentialMatches.splice(i, 1);\n i--;\n }\n }\n }\n }\n return matches;\n }\n\n isElementValuesEqual(elementValue1, elementValue2) {\n if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') {\n return elementValue1 === elementValue2;\n }\n if (elementValue1 instanceof tree.Attribute) {\n if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) {\n return false;\n }\n if (!elementValue1.value || !elementValue2.value) {\n if (elementValue1.value || elementValue2.value) {\n return false;\n }\n return true;\n }\n elementValue1 = elementValue1.value.value || elementValue1.value;\n elementValue2 = elementValue2.value.value || elementValue2.value;\n return elementValue1 === elementValue2;\n }\n elementValue1 = elementValue1.value;\n elementValue2 = elementValue2.value;\n if (elementValue1 instanceof tree.Selector) {\n if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {\n return false;\n }\n for (let i = 0; i < elementValue1.elements.length; i++) {\n if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {\n if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {\n return false;\n }\n }\n if (!this.isElementValuesEqual(elementValue1.elements[i].value, elementValue2.elements[i].value)) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n extendSelector(matches, selectorPath, replacementSelector, isVisible) {\n // for a set of matches, replace each match with the replacement selector\n\n let currentSelectorPathIndex = 0;\n\n let currentSelectorPathElementIndex = 0;\n let path = [];\n let matchIndex;\n let selector;\n let firstElement;\n let match;\n let newElements;\n\n for (matchIndex = 0; matchIndex < matches.length; matchIndex++) {\n match = matches[matchIndex];\n selector = selectorPath[match.pathIndex];\n firstElement = new tree.Element(\n match.initialCombinator,\n replacementSelector.elements[0].value,\n replacementSelector.elements[0].isVariable,\n replacementSelector.elements[0].getIndex(),\n replacementSelector.elements[0].fileInfo()\n );\n\n if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) {\n path[path.length - 1].elements = path[path.length - 1]\n .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));\n currentSelectorPathElementIndex = 0;\n currentSelectorPathIndex++;\n }\n\n newElements = selector.elements\n .slice(currentSelectorPathElementIndex, match.index)\n .concat([firstElement])\n .concat(replacementSelector.elements.slice(1));\n\n if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) {\n path[path.length - 1].elements =\n path[path.length - 1].elements.concat(newElements);\n } else {\n path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex));\n\n path.push(new tree.Selector(\n newElements\n ));\n }\n currentSelectorPathIndex = match.endPathIndex;\n currentSelectorPathElementIndex = match.endPathElementIndex;\n if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) {\n currentSelectorPathElementIndex = 0;\n currentSelectorPathIndex++;\n }\n }\n\n if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) {\n path[path.length - 1].elements = path[path.length - 1]\n .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));\n currentSelectorPathIndex++;\n }\n\n path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length));\n path = path.map(currentValue => {\n // we can re-use elements here, because the visibility property matters only for selectors\n const derived = currentValue.createDerived(currentValue.elements);\n if (isVisible) {\n derived.ensureVisibility();\n } else {\n derived.ensureInvisibility();\n }\n return derived;\n });\n return path;\n }\n\n visitMedia(mediaNode, visitArgs) {\n let newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);\n newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));\n this.allExtendsStack.push(newAllExtends);\n }\n\n visitMediaOut(mediaNode) {\n const lastIndex = this.allExtendsStack.length - 1;\n this.allExtendsStack.length = lastIndex;\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n let newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);\n newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends));\n this.allExtendsStack.push(newAllExtends);\n }\n\n visitAtRuleOut(atRuleNode) {\n const lastIndex = this.allExtendsStack.length - 1;\n this.allExtendsStack.length = lastIndex;\n }\n}\n\nexport default ProcessExtendsVisitor;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/import-sequencer.js b/packages/less/lib/less/visitors/import-sequencer.js deleted file mode 100644 index 17c4ee0d6..000000000 --- a/packages/less/lib/less/visitors/import-sequencer.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var ImportSequencer = /** @class */ (function () { - function ImportSequencer(onSequencerEmpty) { - this.imports = []; - this.variableImports = []; - this._onSequencerEmpty = onSequencerEmpty; - this._currentDepth = 0; - } - ImportSequencer.prototype.addImport = function (callback) { - var importSequencer = this; - var importItem = { - callback: callback, - args: null, - isReady: false - }; - this.imports.push(importItem); - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - importItem.args = Array.prototype.slice.call(args, 0); - importItem.isReady = true; - importSequencer.tryRun(); - }; - }; - ImportSequencer.prototype.addVariableImport = function (callback) { - this.variableImports.push(callback); - }; - ImportSequencer.prototype.tryRun = function () { - this._currentDepth++; - try { - while (true) { - while (this.imports.length > 0) { - var importItem = this.imports[0]; - if (!importItem.isReady) { - return; - } - this.imports = this.imports.slice(1); - importItem.callback.apply(null, importItem.args); - } - if (this.variableImports.length === 0) { - break; - } - var variableImport = this.variableImports[0]; - this.variableImports = this.variableImports.slice(1); - variableImport(); - } - } - finally { - this._currentDepth--; - } - if (this._currentDepth === 0 && this._onSequencerEmpty) { - this._onSequencerEmpty(); - } - }; - return ImportSequencer; -}()); -exports.default = ImportSequencer; -//# sourceMappingURL=import-sequencer.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/import-sequencer.js.map b/packages/less/lib/less/visitors/import-sequencer.js.map deleted file mode 100644 index 823e7dbd9..000000000 --- a/packages/less/lib/less/visitors/import-sequencer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"import-sequencer.js","sourceRoot":"","sources":["../../../src/less/visitors/import-sequencer.js"],"names":[],"mappings":";;AAAA;IACI,yBAAY,gBAAgB;QACxB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,mCAAS,GAAT,UAAU,QAAQ;QACd,IAAM,eAAe,GAAG,IAAI,CAAC;QAE7B,IAAM,UAAU,GAAG;YACf,QAAQ,UAAA;YACR,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,KAAK;SACjB,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9B,OAAO;YAAS,cAAO;iBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;gBAAP,yBAAO;;YACnB,UAAU,CAAC,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YACtD,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC1B,eAAe,CAAC,MAAM,EAAE,CAAC;QAC7B,CAAC,CAAC;IACN,CAAC;IAED,2CAAiB,GAAjB,UAAkB,QAAQ;QACtB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,gCAAM,GAAN;QACI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI;YACA,OAAO,IAAI,EAAE;gBACT,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC5B,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBACnC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;wBACrB,OAAO;qBACV;oBACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBACrC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;iBACpD;gBACD,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;oBACnC,MAAM;iBACT;gBACD,IAAM,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;gBAC/C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACrD,cAAc,EAAE,CAAC;aACpB;SACJ;gBAAS;YACN,IAAI,CAAC,aAAa,EAAE,CAAC;SACxB;QACD,IAAI,IAAI,CAAC,aAAa,KAAK,CAAC,IAAI,IAAI,CAAC,iBAAiB,EAAE;YACpD,IAAI,CAAC,iBAAiB,EAAE,CAAC;SAC5B;IACL,CAAC;IACL,sBAAC;AAAD,CAAC,AAvDD,IAuDC;AAED,kBAAe,eAAe,CAAC","sourcesContent":["class ImportSequencer {\n constructor(onSequencerEmpty) {\n this.imports = [];\n this.variableImports = [];\n this._onSequencerEmpty = onSequencerEmpty;\n this._currentDepth = 0;\n }\n\n addImport(callback) {\n const importSequencer = this;\n\n const importItem = {\n callback,\n args: null,\n isReady: false\n };\n\n this.imports.push(importItem);\n return function(...args) {\n importItem.args = Array.prototype.slice.call(args, 0);\n importItem.isReady = true;\n importSequencer.tryRun();\n };\n }\n\n addVariableImport(callback) {\n this.variableImports.push(callback);\n }\n\n tryRun() {\n this._currentDepth++;\n try {\n while (true) {\n while (this.imports.length > 0) {\n const importItem = this.imports[0];\n if (!importItem.isReady) {\n return;\n }\n this.imports = this.imports.slice(1);\n importItem.callback.apply(null, importItem.args);\n }\n if (this.variableImports.length === 0) {\n break;\n }\n const variableImport = this.variableImports[0];\n this.variableImports = this.variableImports.slice(1);\n variableImport();\n }\n } finally {\n this._currentDepth--;\n }\n if (this._currentDepth === 0 && this._onSequencerEmpty) {\n this._onSequencerEmpty();\n }\n }\n}\n\nexport default ImportSequencer;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/import-visitor.js b/packages/less/lib/less/visitors/import-visitor.js deleted file mode 100644 index 577d496ff..000000000 --- a/packages/less/lib/less/visitors/import-visitor.js +++ /dev/null @@ -1,202 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var contexts_1 = __importDefault(require("../contexts")); -var visitor_1 = __importDefault(require("./visitor")); -var import_sequencer_1 = __importDefault(require("./import-sequencer")); -var utils = __importStar(require("../utils")); -var ImportVisitor = function (importer, finish) { - this._visitor = new visitor_1.default(this); - this._importer = importer; - this._finish = finish; - this.context = new contexts_1.default.Eval(); - this.importCount = 0; - this.onceFileDetectionMap = {}; - this.recursionDetector = {}; - this._sequencer = new import_sequencer_1.default(this._onSequencerEmpty.bind(this)); -}; -ImportVisitor.prototype = { - isReplacing: false, - run: function (root) { - try { - // process the contents - this._visitor.visit(root); - } - catch (e) { - this.error = e; - } - this.isFinished = true; - this._sequencer.tryRun(); - }, - _onSequencerEmpty: function () { - if (!this.isFinished) { - return; - } - this._finish(this.error); - }, - visitImport: function (importNode, visitArgs) { - var inlineCSS = importNode.options.inline; - if (!importNode.css || inlineCSS) { - var context = new contexts_1.default.Eval(this.context, utils.copyArray(this.context.frames)); - var importParent = context.frames[0]; - this.importCount++; - if (importNode.isVariableImport()) { - this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent)); - } - else { - this.processImportNode(importNode, context, importParent); - } - } - visitArgs.visitDeeper = false; - }, - processImportNode: function (importNode, context, importParent) { - var evaldImportNode; - var inlineCSS = importNode.options.inline; - try { - evaldImportNode = importNode.evalForImport(context); - } - catch (e) { - if (!e.filename) { - e.index = importNode.getIndex(); - e.filename = importNode.fileInfo().filename; - } - // attempt to eval properly and treat as css - importNode.css = true; - // if that fails, this error will be thrown - importNode.error = e; - } - if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) { - if (evaldImportNode.options.multiple) { - context.importMultiple = true; - } - // try appending if we haven't determined if it is css or not - var tryAppendLessExtension = evaldImportNode.css === undefined; - for (var i = 0; i < importParent.rules.length; i++) { - if (importParent.rules[i] === importNode) { - importParent.rules[i] = evaldImportNode; - break; - } - } - var onImported = this.onImported.bind(this, evaldImportNode, context); - var sequencedOnImported = this._sequencer.addImport(onImported); - this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported); - } - else { - this.importCount--; - if (this.isFinished) { - this._sequencer.tryRun(); - } - } - }, - onImported: function (importNode, context, e, root, importedAtRoot, fullPath) { - if (e) { - if (!e.filename) { - e.index = importNode.getIndex(); - e.filename = importNode.fileInfo().filename; - } - this.error = e; - } - var importVisitor = this; - var inlineCSS = importNode.options.inline; - var isPlugin = importNode.options.isPlugin; - var isOptional = importNode.options.optional; - var duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; - if (!context.importMultiple) { - if (duplicateImport) { - importNode.skip = true; - } - else { - importNode.skip = function () { - if (fullPath in importVisitor.onceFileDetectionMap) { - return true; - } - importVisitor.onceFileDetectionMap[fullPath] = true; - return false; - }; - } - } - if (!fullPath && isOptional) { - importNode.skip = true; - } - if (root) { - importNode.root = root; - importNode.importedFilename = fullPath; - if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) { - importVisitor.recursionDetector[fullPath] = true; - var oldContext = this.context; - this.context = context; - try { - this._visitor.visit(root); - } - catch (e) { - this.error = e; - } - this.context = oldContext; - } - } - importVisitor.importCount--; - if (importVisitor.isFinished) { - importVisitor._sequencer.tryRun(); - } - }, - visitDeclaration: function (declNode, visitArgs) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.unshift(declNode); - } - else { - visitArgs.visitDeeper = false; - } - }, - visitDeclarationOut: function (declNode) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.shift(); - } - }, - visitAtRule: function (atRuleNode, visitArgs) { - this.context.frames.unshift(atRuleNode); - }, - visitAtRuleOut: function (atRuleNode) { - this.context.frames.shift(); - }, - visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { - this.context.frames.unshift(mixinDefinitionNode); - }, - visitMixinDefinitionOut: function (mixinDefinitionNode) { - this.context.frames.shift(); - }, - visitRuleset: function (rulesetNode, visitArgs) { - this.context.frames.unshift(rulesetNode); - }, - visitRulesetOut: function (rulesetNode) { - this.context.frames.shift(); - }, - visitMedia: function (mediaNode, visitArgs) { - this.context.frames.unshift(mediaNode.rules[0]); - }, - visitMediaOut: function (mediaNode) { - this.context.frames.shift(); - } -}; -exports.default = ImportVisitor; -//# sourceMappingURL=import-visitor.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/import-visitor.js.map b/packages/less/lib/less/visitors/import-visitor.js.map deleted file mode 100644 index 936e4bc8e..000000000 --- a/packages/less/lib/less/visitors/import-visitor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"import-visitor.js","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CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,YAAY,EAAE,UAAU,WAAW,EAAE,SAAS;QAC1C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IACD,eAAe,EAAE,UAAU,WAAW;QAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,UAAU,EAAE,UAAU,SAAS,EAAE,SAAS;QACtC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,aAAa,EAAE,UAAU,SAAS;QAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACJ,CAAC;AACF,kBAAe,aAAa,CAAC","sourcesContent":["import contexts from '../contexts';\nimport Visitor from './visitor';\nimport ImportSequencer from './import-sequencer';\nimport * as utils from '../utils';\n\nconst ImportVisitor = function(importer, finish) {\n\n this._visitor = new Visitor(this);\n this._importer = importer;\n this._finish = finish;\n this.context = new contexts.Eval();\n this.importCount = 0;\n this.onceFileDetectionMap = {};\n this.recursionDetector = {};\n this._sequencer = new ImportSequencer(this._onSequencerEmpty.bind(this));\n};\n\nImportVisitor.prototype = {\n isReplacing: false,\n run: function (root) {\n try {\n // process the contents\n this._visitor.visit(root);\n }\n catch (e) {\n this.error = e;\n }\n\n this.isFinished = true;\n this._sequencer.tryRun();\n },\n _onSequencerEmpty: function() {\n if (!this.isFinished) {\n return;\n }\n this._finish(this.error);\n },\n visitImport: function (importNode, visitArgs) {\n const inlineCSS = importNode.options.inline;\n\n if (!importNode.css || inlineCSS) {\n\n const context = new contexts.Eval(this.context, utils.copyArray(this.context.frames));\n const importParent = context.frames[0];\n\n this.importCount++;\n if (importNode.isVariableImport()) {\n this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent));\n } else {\n this.processImportNode(importNode, context, importParent);\n }\n }\n visitArgs.visitDeeper = false;\n },\n processImportNode: function(importNode, context, importParent) {\n let evaldImportNode;\n const inlineCSS = importNode.options.inline;\n\n try {\n evaldImportNode = importNode.evalForImport(context);\n } catch (e) {\n if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; }\n // attempt to eval properly and treat as css\n importNode.css = true;\n // if that fails, this error will be thrown\n importNode.error = e;\n }\n\n if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {\n if (evaldImportNode.options.multiple) {\n context.importMultiple = true;\n }\n\n // try appending if we haven't determined if it is css or not\n const tryAppendLessExtension = evaldImportNode.css === undefined;\n\n for (let i = 0; i < importParent.rules.length; i++) {\n if (importParent.rules[i] === importNode) {\n importParent.rules[i] = evaldImportNode;\n break;\n }\n }\n\n const onImported = this.onImported.bind(this, evaldImportNode, context);\n const sequencedOnImported = this._sequencer.addImport(onImported);\n\n this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(),\n evaldImportNode.options, sequencedOnImported);\n } else {\n this.importCount--;\n if (this.isFinished) {\n this._sequencer.tryRun();\n }\n }\n },\n onImported: function (importNode, context, e, root, importedAtRoot, fullPath) {\n if (e) {\n if (!e.filename) {\n e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename;\n }\n this.error = e;\n }\n\n const importVisitor = this;\n const inlineCSS = importNode.options.inline;\n const isPlugin = importNode.options.isPlugin;\n const isOptional = importNode.options.optional;\n const duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;\n\n if (!context.importMultiple) {\n if (duplicateImport) {\n importNode.skip = true;\n } else {\n importNode.skip = () => {\n if (fullPath in importVisitor.onceFileDetectionMap) {\n return true;\n }\n importVisitor.onceFileDetectionMap[fullPath] = true;\n return false;\n };\n }\n }\n\n if (!fullPath && isOptional) {\n importNode.skip = true;\n }\n\n if (root) {\n importNode.root = root;\n importNode.importedFilename = fullPath;\n\n if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) {\n importVisitor.recursionDetector[fullPath] = true;\n\n const oldContext = this.context;\n this.context = context;\n try {\n this._visitor.visit(root);\n } catch (e) {\n this.error = e;\n }\n this.context = oldContext;\n }\n }\n\n importVisitor.importCount--;\n\n if (importVisitor.isFinished) {\n importVisitor._sequencer.tryRun();\n }\n },\n visitDeclaration: function (declNode, visitArgs) {\n if (declNode.value.type === 'DetachedRuleset') {\n this.context.frames.unshift(declNode);\n } else {\n visitArgs.visitDeeper = false;\n }\n },\n visitDeclarationOut: function(declNode) {\n if (declNode.value.type === 'DetachedRuleset') {\n this.context.frames.shift();\n }\n },\n visitAtRule: function (atRuleNode, visitArgs) {\n this.context.frames.unshift(atRuleNode);\n },\n visitAtRuleOut: function (atRuleNode) {\n this.context.frames.shift();\n },\n visitMixinDefinition: function (mixinDefinitionNode, visitArgs) {\n this.context.frames.unshift(mixinDefinitionNode);\n },\n visitMixinDefinitionOut: function (mixinDefinitionNode) {\n this.context.frames.shift();\n },\n visitRuleset: function (rulesetNode, visitArgs) {\n this.context.frames.unshift(rulesetNode);\n },\n visitRulesetOut: function (rulesetNode) {\n this.context.frames.shift();\n },\n visitMedia: function (mediaNode, visitArgs) {\n this.context.frames.unshift(mediaNode.rules[0]);\n },\n visitMediaOut: function (mediaNode) {\n this.context.frames.shift();\n }\n};\nexport default ImportVisitor;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/index.js b/packages/less/lib/less/visitors/index.js deleted file mode 100644 index 396769543..000000000 --- a/packages/less/lib/less/visitors/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var visitor_1 = __importDefault(require("./visitor")); -var import_visitor_1 = __importDefault(require("./import-visitor")); -var set_tree_visibility_visitor_1 = __importDefault(require("./set-tree-visibility-visitor")); -var extend_visitor_1 = __importDefault(require("./extend-visitor")); -var join_selector_visitor_1 = __importDefault(require("./join-selector-visitor")); -var to_css_visitor_1 = __importDefault(require("./to-css-visitor")); -exports.default = { - Visitor: visitor_1.default, - ImportVisitor: import_visitor_1.default, - MarkVisibleSelectorsVisitor: set_tree_visibility_visitor_1.default, - ExtendVisitor: extend_visitor_1.default, - JoinSelectorVisitor: join_selector_visitor_1.default, - ToCSSVisitor: to_css_visitor_1.default -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/index.js.map b/packages/less/lib/less/visitors/index.js.map deleted file mode 100644 index 659c82a32..000000000 --- a/packages/less/lib/less/visitors/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/less/visitors/index.js"],"names":[],"mappings":";;;;;AAAA,sDAAgC;AAChC,oEAA6C;AAC7C,8FAAwE;AACxE,oEAA6C;AAC7C,kFAA0D;AAC1D,oEAA4C;AAE5C,kBAAe;IACX,OAAO,mBAAA;IACP,aAAa,0BAAA;IACb,2BAA2B,uCAAA;IAC3B,aAAa,0BAAA;IACb,mBAAmB,iCAAA;IACnB,YAAY,0BAAA;CACf,CAAC","sourcesContent":["import Visitor from './visitor';\nimport ImportVisitor from './import-visitor';\nimport MarkVisibleSelectorsVisitor from './set-tree-visibility-visitor';\nimport ExtendVisitor from './extend-visitor';\nimport JoinSelectorVisitor from './join-selector-visitor';\nimport ToCSSVisitor from './to-css-visitor';\n\nexport default {\n Visitor,\n ImportVisitor,\n MarkVisibleSelectorsVisitor,\n ExtendVisitor,\n JoinSelectorVisitor,\n ToCSSVisitor\n};\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/join-selector-visitor.js b/packages/less/lib/less/visitors/join-selector-visitor.js deleted file mode 100644 index 839794fe6..000000000 --- a/packages/less/lib/less/visitors/join-selector-visitor.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var visitor_1 = __importDefault(require("./visitor")); -var JoinSelectorVisitor = /** @class */ (function () { - function JoinSelectorVisitor() { - this.contexts = [[]]; - this._visitor = new visitor_1.default(this); - } - JoinSelectorVisitor.prototype.run = function (root) { - return this._visitor.visit(root); - }; - JoinSelectorVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - JoinSelectorVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - JoinSelectorVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - var paths = []; - var selectors; - this.contexts.push(paths); - if (!rulesetNode.root) { - selectors = rulesetNode.selectors; - if (selectors) { - selectors = selectors.filter(function (selector) { return selector.getIsOutput(); }); - rulesetNode.selectors = selectors.length ? selectors : (selectors = null); - if (selectors) { - rulesetNode.joinSelectors(paths, context, selectors); - } - } - if (!selectors) { - rulesetNode.rules = null; - } - rulesetNode.paths = paths; - } - }; - JoinSelectorVisitor.prototype.visitRulesetOut = function (rulesetNode) { - this.contexts.length = this.contexts.length - 1; - }; - JoinSelectorVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia); - }; - JoinSelectorVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - if (atRuleNode.rules && atRuleNode.rules.length) { - atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null); - } - }; - return JoinSelectorVisitor; -}()); -exports.default = JoinSelectorVisitor; -//# sourceMappingURL=join-selector-visitor.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/join-selector-visitor.js.map b/packages/less/lib/less/visitors/join-selector-visitor.js.map deleted file mode 100644 index 26b66e1b9..000000000 --- a/packages/less/lib/less/visitors/join-selector-visitor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"join-selector-visitor.js","sourceRoot":"","sources":["../../../src/less/visitors/join-selector-visitor.js"],"names":[],"mappings":";;;;;AAAA,sDAAgC;AAEhC;IACI;QACI,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,iCAAG,GAAH,UAAI,IAAI;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,8CAAgB,GAAhB,UAAiB,QAAQ,EAAE,SAAS;QAChC,SAAS,CAAC,WAAW,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,kDAAoB,GAApB,UAAqB,mBAAmB,EAAE,SAAS;QAC/C,SAAS,CAAC,WAAW,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,0CAAY,GAAZ,UAAa,WAAW,EAAE,SAAS;QAC/B,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACxD,IAAM,KAAK,GAAG,EAAE,CAAC;QACjB,IAAI,SAAS,CAAC;QAEd,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE1B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;YACnB,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;YAClC,IAAI,SAAS,EAAE;gBACX,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,WAAW,EAAE,EAAtB,CAAsB,CAAC,CAAC;gBACjE,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,S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n this.contexts = [[]];\n this._visitor = new Visitor(this);\n }\n\n run(root) {\n return this._visitor.visit(root);\n }\n\n visitDeclaration(declNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n const paths = [];\n let selectors;\n\n this.contexts.push(paths);\n\n if (!rulesetNode.root) {\n selectors = rulesetNode.selectors;\n if (selectors) {\n selectors = selectors.filter(selector => selector.getIsOutput());\n rulesetNode.selectors = selectors.length ? selectors : (selectors = null);\n if (selectors) { rulesetNode.joinSelectors(paths, context, selectors); }\n }\n if (!selectors) { rulesetNode.rules = null; }\n rulesetNode.paths = paths;\n }\n }\n\n visitRulesetOut(rulesetNode) {\n this.contexts.length = this.contexts.length - 1;\n }\n\n visitMedia(mediaNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia);\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n if (atRuleNode.rules && atRuleNode.rules.length) {\n atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null);\n }\n }\n}\n\nexport default JoinSelectorVisitor;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/set-tree-visibility-visitor.js b/packages/less/lib/less/visitors/set-tree-visibility-visitor.js deleted file mode 100644 index f4cb800f1..000000000 --- a/packages/less/lib/less/visitors/set-tree-visibility-visitor.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var SetTreeVisibilityVisitor = /** @class */ (function () { - function SetTreeVisibilityVisitor(visible) { - this.visible = visible; - } - SetTreeVisibilityVisitor.prototype.run = function (root) { - this.visit(root); - }; - SetTreeVisibilityVisitor.prototype.visitArray = function (nodes) { - if (!nodes) { - return nodes; - } - var cnt = nodes.length; - var i; - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - }; - SetTreeVisibilityVisitor.prototype.visit = function (node) { - if (!node) { - return node; - } - if (node.constructor === Array) { - return this.visitArray(node); - } - if (!node.blocksVisibility || node.blocksVisibility()) { - return node; - } - if (this.visible) { - node.ensureVisibility(); - } - else { - node.ensureInvisibility(); - } - node.accept(this); - return node; - }; - return SetTreeVisibilityVisitor; -}()); -exports.default = SetTreeVisibilityVisitor; -//# sourceMappingURL=set-tree-visibility-visitor.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/set-tree-visibility-visitor.js.map b/packages/less/lib/less/visitors/set-tree-visibility-visitor.js.map deleted file mode 100644 index 47200327c..000000000 --- a/packages/less/lib/less/visitors/set-tree-visibility-visitor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set-tree-visibility-visitor.js","sourceRoot":"","sources":["../../../src/less/visitors/set-tree-visibility-visitor.js"],"names":[],"mappings":";;AAAA;IACI,kCAAY,OAAO;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,sCAAG,GAAH,UAAI,IAAI;QACJ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAED,6CAAU,GAAV,UAAW,KAAK;QACZ,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,KAAK,CAAC;SAChB;QAED,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,CAAC;QACN,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YACtB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,wCAAK,GAAL,UAAM,IAAI;QACN,IAAI,CAAC,IAAI,EAAE;YACP,OAAO,IAAI,CAAC;SACf;QACD,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE;YAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAChC;QAED,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE;YACnD,OAAO,IAAI,CAAC;SACf;QACD,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAC3B;aAAM;YACH,IAAI,CAAC,kBAAkB,EAAE,CAAC;SAC7B;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,+BAAC;AAAD,CAAC,AA1CD,IA0CC;AAED,kBAAe,wBAAwB,CAAC","sourcesContent":["class SetTreeVisibilityVisitor {\n constructor(visible) {\n this.visible = visible;\n }\n\n run(root) {\n this.visit(root);\n }\n\n visitArray(nodes) {\n if (!nodes) {\n return nodes;\n }\n\n const cnt = nodes.length;\n let i;\n for (i = 0; i < cnt; i++) {\n this.visit(nodes[i]);\n }\n return nodes;\n }\n\n visit(node) {\n if (!node) {\n return node;\n }\n if (node.constructor === Array) {\n return this.visitArray(node);\n }\n\n if (!node.blocksVisibility || node.blocksVisibility()) {\n return node;\n }\n if (this.visible) {\n node.ensureVisibility();\n } else {\n node.ensureInvisibility();\n }\n\n node.accept(this);\n return node;\n }\n}\n\nexport default SetTreeVisibilityVisitor;"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/to-css-visitor.js b/packages/less/lib/less/visitors/to-css-visitor.js deleted file mode 100644 index cb75b7f32..000000000 --- a/packages/less/lib/less/visitors/to-css-visitor.js +++ /dev/null @@ -1,321 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var tree_1 = __importDefault(require("../tree")); -var visitor_1 = __importDefault(require("./visitor")); -var CSSVisitorUtils = /** @class */ (function () { - function CSSVisitorUtils(context) { - this._visitor = new visitor_1.default(this); - this._context = context; - } - CSSVisitorUtils.prototype.containsSilentNonBlockedChild = function (bodyRules) { - var rule; - if (!bodyRules) { - return false; - } - for (var r = 0; r < bodyRules.length; r++) { - rule = bodyRules[r]; - if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - // the atrule contains something that was referenced (likely by extend) - // therefore it needs to be shown in output too - return true; - } - } - return false; - }; - CSSVisitorUtils.prototype.keepOnlyVisibleChilds = function (owner) { - if (owner && owner.rules) { - owner.rules = owner.rules.filter(function (thing) { return thing.isVisible(); }); - } - }; - CSSVisitorUtils.prototype.isEmpty = function (owner) { - return (owner && owner.rules) - ? (owner.rules.length === 0) : true; - }; - CSSVisitorUtils.prototype.hasVisibleSelector = function (rulesetNode) { - return (rulesetNode && rulesetNode.paths) - ? (rulesetNode.paths.length > 0) : false; - }; - CSSVisitorUtils.prototype.resolveVisibility = function (node, originalRules) { - if (!node.blocksVisibility()) { - if (this.isEmpty(node) && !this.containsSilentNonBlockedChild(originalRules)) { - return; - } - return node; - } - var compiledRulesBody = node.rules[0]; - this.keepOnlyVisibleChilds(compiledRulesBody); - if (this.isEmpty(compiledRulesBody)) { - return; - } - node.ensureVisibility(); - node.removeVisibilityBlock(); - return node; - }; - CSSVisitorUtils.prototype.isVisibleRuleset = function (rulesetNode) { - if (rulesetNode.firstRoot) { - return true; - } - if (this.isEmpty(rulesetNode)) { - return false; - } - if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) { - return false; - } - return true; - }; - return CSSVisitorUtils; -}()); -var ToCSSVisitor = function (context) { - this._visitor = new visitor_1.default(this); - this._context = context; - this.utils = new CSSVisitorUtils(context); -}; -ToCSSVisitor.prototype = { - isReplacing: true, - run: function (root) { - return this._visitor.visit(root); - }, - visitDeclaration: function (declNode, visitArgs) { - if (declNode.blocksVisibility() || declNode.variable) { - return; - } - return declNode; - }, - visitMixinDefinition: function (mixinNode, visitArgs) { - // mixin definitions do not get eval'd - this means they keep state - // so we have to clear that state here so it isn't used if toCSS is called twice - mixinNode.frames = []; - }, - visitExtend: function (extendNode, visitArgs) { - }, - visitComment: function (commentNode, visitArgs) { - if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) { - return; - } - return commentNode; - }, - visitMedia: function (mediaNode, visitArgs) { - var originalRules = mediaNode.rules[0].rules; - mediaNode.accept(this._visitor); - visitArgs.visitDeeper = false; - return this.utils.resolveVisibility(mediaNode, originalRules); - }, - visitImport: function (importNode, visitArgs) { - if (importNode.blocksVisibility()) { - return; - } - return importNode; - }, - visitAtRule: function (atRuleNode, visitArgs) { - if (atRuleNode.rules && atRuleNode.rules.length) { - return this.visitAtRuleWithBody(atRuleNode, visitArgs); - } - else { - return this.visitAtRuleWithoutBody(atRuleNode, visitArgs); - } - }, - visitAnonymous: function (anonymousNode, visitArgs) { - if (!anonymousNode.blocksVisibility()) { - anonymousNode.accept(this._visitor); - return anonymousNode; - } - }, - visitAtRuleWithBody: function (atRuleNode, visitArgs) { - // if there is only one nested ruleset and that one has no path, then it is - // just fake ruleset - function hasFakeRuleset(atRuleNode) { - var bodyRules = atRuleNode.rules; - return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); - } - function getBodyRules(atRuleNode) { - var nodeRules = atRuleNode.rules; - if (hasFakeRuleset(atRuleNode)) { - return nodeRules[0].rules; - } - return nodeRules; - } - // it is still true that it is only one ruleset in array - // this is last such moment - // process childs - var originalRules = getBodyRules(atRuleNode); - atRuleNode.accept(this._visitor); - visitArgs.visitDeeper = false; - if (!this.utils.isEmpty(atRuleNode)) { - this._mergeRules(atRuleNode.rules[0].rules); - } - return this.utils.resolveVisibility(atRuleNode, originalRules); - }, - visitAtRuleWithoutBody: function (atRuleNode, visitArgs) { - if (atRuleNode.blocksVisibility()) { - return; - } - if (atRuleNode.name === '@charset') { - // Only output the debug info together with subsequent @charset definitions - // a comment (or @media statement) before the actual @charset atrule would - // be considered illegal css as it has to be on the first line - if (this.charset) { - if (atRuleNode.debugInfo) { - var comment = new tree_1.default.Comment("/* " + atRuleNode.toCSS(this._context).replace(/\n/g, '') + " */\n"); - comment.debugInfo = atRuleNode.debugInfo; - return this._visitor.visit(comment); - } - return; - } - this.charset = true; - } - return atRuleNode; - }, - checkValidNodes: function (rules, isRoot) { - if (!rules) { - return; - } - for (var i = 0; i < rules.length; i++) { - var ruleNode = rules[i]; - if (isRoot && ruleNode instanceof tree_1.default.Declaration && !ruleNode.variable) { - throw { message: 'Properties must be inside selector blocks. They cannot be in the root', - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - if (ruleNode instanceof tree_1.default.Call) { - throw { message: "Function '" + ruleNode.name + "' is undefined", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - if (ruleNode.type && !ruleNode.allowRoot) { - throw { message: ruleNode.type + " node returned by a function is not valid here", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - } - }, - visitRuleset: function (rulesetNode, visitArgs) { - // at this point rulesets are nested into each other - var rule; - var rulesets = []; - this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); - if (!rulesetNode.root) { - // remove invisible paths - this._compileRulesetPaths(rulesetNode); - // remove rulesets from this ruleset body and compile them separately - var nodeRules = rulesetNode.rules; - var nodeRuleCnt = nodeRules ? nodeRules.length : 0; - for (var i = 0; i < nodeRuleCnt;) { - rule = nodeRules[i]; - if (rule && rule.rules) { - // visit because we are moving them out from being a child - rulesets.push(this._visitor.visit(rule)); - nodeRules.splice(i, 1); - nodeRuleCnt--; - continue; - } - i++; - } - // accept the visitor to remove rules and refactor itself - // then we can decide nogw whether we want it or not - // compile body - if (nodeRuleCnt > 0) { - rulesetNode.accept(this._visitor); - } - else { - rulesetNode.rules = null; - } - visitArgs.visitDeeper = false; - } - else { // if (! rulesetNode.root) { - rulesetNode.accept(this._visitor); - visitArgs.visitDeeper = false; - } - if (rulesetNode.rules) { - this._mergeRules(rulesetNode.rules); - this._removeDuplicateRules(rulesetNode.rules); - } - // now decide whether we keep the ruleset - if (this.utils.isVisibleRuleset(rulesetNode)) { - rulesetNode.ensureVisibility(); - rulesets.splice(0, 0, rulesetNode); - } - if (rulesets.length === 1) { - return rulesets[0]; - } - return rulesets; - }, - _compileRulesetPaths: function (rulesetNode) { - if (rulesetNode.paths) { - rulesetNode.paths = rulesetNode.paths - .filter(function (p) { - var i; - if (p[0].elements[0].combinator.value === ' ') { - p[0].elements[0].combinator = new (tree_1.default.Combinator)(''); - } - for (i = 0; i < p.length; i++) { - if (p[i].isVisible() && p[i].getIsOutput()) { - return true; - } - } - return false; - }); - } - }, - _removeDuplicateRules: function (rules) { - if (!rules) { - return; - } - // remove duplicates - var ruleCache = {}; - var ruleList; - var rule; - var i; - for (i = rules.length - 1; i >= 0; i--) { - rule = rules[i]; - if (rule instanceof tree_1.default.Declaration) { - if (!ruleCache[rule.name]) { - ruleCache[rule.name] = rule; - } - else { - ruleList = ruleCache[rule.name]; - if (ruleList instanceof tree_1.default.Declaration) { - ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)]; - } - var ruleCSS = rule.toCSS(this._context); - if (ruleList.indexOf(ruleCSS) !== -1) { - rules.splice(i, 1); - } - else { - ruleList.push(ruleCSS); - } - } - } - } - }, - _mergeRules: function (rules) { - if (!rules) { - return; - } - var groups = {}; - var groupsArr = []; - for (var i = 0; i < rules.length; i++) { - var rule = rules[i]; - if (rule.merge) { - var key = rule.name; - groups[key] ? rules.splice(i--, 1) : - groupsArr.push(groups[key] = []); - groups[key].push(rule); - } - } - groupsArr.forEach(function (group) { - if (group.length > 0) { - var result_1 = group[0]; - var space_1 = []; - var comma_1 = [new tree_1.default.Expression(space_1)]; - group.forEach(function (rule) { - if ((rule.merge === '+') && (space_1.length > 0)) { - comma_1.push(new tree_1.default.Expression(space_1 = [])); - } - space_1.push(rule.value); - result_1.important = result_1.important || rule.important; - }); - result_1.value = new tree_1.default.Value(comma_1); - } - }); - } -}; -exports.default = ToCSSVisitor; -//# sourceMappingURL=to-css-visitor.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/to-css-visitor.js.map b/packages/less/lib/less/visitors/to-css-visitor.js.map deleted file mode 100644 index f2e95c557..000000000 --- a/packages/less/lib/less/visitors/to-css-visitor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"to-css-visitor.js","sourceRoot":"","sources":["../../../src/less/visitors/to-css-visitor.js"],"names":[],"mappings":";;;;;AAAA,iDAA2B;AAC3B,sDAAgC;AAEhC;IACI,yBAAY,OAAO;QACf,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED,uDAA6B,GAA7B,UAA8B,SAAS;QACnC,IAAI,IAAI,CAAC;QACT,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO,KAAK,CAAC;SAChB;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE;gBAC3E,uEAAuE;gBACvE,+CAA+C;gBAC/C,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,+CAAqB,GAArB,UAAsB,KAAK;QACvB,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE;YACtB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,SAAS,EAAE,EAAjB,CAAiB,CAAC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C;aACxC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC;AAEF,kBAAe,YAAY,CAAC","sourcesContent":["import tree from '../tree';\nimport Visitor from './visitor';\n\nclass CSSVisitorUtils {\n constructor(context) {\n this._visitor = new Visitor(this);\n this._context = context;\n }\n\n containsSilentNonBlockedChild(bodyRules) {\n let rule;\n if (!bodyRules) {\n return false;\n }\n for (let r = 0; r < bodyRules.length; r++) {\n rule = bodyRules[r];\n if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) {\n // the atrule contains something that was referenced (likely by extend)\n // therefore it needs to be shown in output too\n return true;\n }\n }\n return false;\n }\n\n keepOnlyVisibleChilds(owner) {\n if (owner && owner.rules) {\n owner.rules = owner.rules.filter(thing => thing.isVisible());\n }\n }\n\n isEmpty(owner) {\n return (owner && owner.rules) \n ? (owner.rules.length === 0) : true;\n }\n\n hasVisibleSelector(rulesetNode) {\n return (rulesetNode && rulesetNode.paths)\n ? (rulesetNode.paths.length > 0) : false;\n }\n\n resolveVisibility(node, originalRules) {\n if (!node.blocksVisibility()) {\n if (this.isEmpty(node) && !this.containsSilentNonBlockedChild(originalRules)) {\n return ;\n }\n\n return node;\n }\n\n const compiledRulesBody = node.rules[0];\n this.keepOnlyVisibleChilds(compiledRulesBody);\n\n if (this.isEmpty(compiledRulesBody)) {\n return ;\n }\n\n node.ensureVisibility();\n node.removeVisibilityBlock();\n\n return node;\n }\n\n isVisibleRuleset(rulesetNode) {\n if (rulesetNode.firstRoot) {\n return true;\n }\n\n if (this.isEmpty(rulesetNode)) {\n return false;\n }\n\n if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) {\n return false;\n }\n\n return true;\n }\n}\n\nconst ToCSSVisitor = function(context) {\n this._visitor = new Visitor(this);\n this._context = context;\n this.utils = new CSSVisitorUtils(context);\n};\n\nToCSSVisitor.prototype = {\n isReplacing: true,\n run: function (root) {\n return this._visitor.visit(root);\n },\n\n visitDeclaration: function (declNode, visitArgs) {\n if (declNode.blocksVisibility() || declNode.variable) {\n return;\n }\n return declNode;\n },\n\n visitMixinDefinition: function (mixinNode, visitArgs) {\n // mixin definitions do not get eval'd - this means they keep state\n // so we have to clear that state here so it isn't used if toCSS is called twice\n mixinNode.frames = [];\n },\n\n visitExtend: function (extendNode, visitArgs) {\n },\n\n visitComment: function (commentNode, visitArgs) {\n if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) {\n return;\n }\n return commentNode;\n },\n\n visitMedia: function(mediaNode, visitArgs) {\n const originalRules = mediaNode.rules[0].rules;\n mediaNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n\n return this.utils.resolveVisibility(mediaNode, originalRules);\n },\n\n visitImport: function (importNode, visitArgs) {\n if (importNode.blocksVisibility()) {\n return ;\n }\n return importNode;\n },\n\n visitAtRule: function(atRuleNode, visitArgs) {\n if (atRuleNode.rules && atRuleNode.rules.length) {\n return this.visitAtRuleWithBody(atRuleNode, visitArgs);\n } else {\n return this.visitAtRuleWithoutBody(atRuleNode, visitArgs);\n }\n },\n\n visitAnonymous: function(anonymousNode, visitArgs) {\n if (!anonymousNode.blocksVisibility()) {\n anonymousNode.accept(this._visitor);\n return anonymousNode;\n }\n },\n\n visitAtRuleWithBody: function(atRuleNode, visitArgs) {\n // if there is only one nested ruleset and that one has no path, then it is\n // just fake ruleset\n function hasFakeRuleset(atRuleNode) {\n const bodyRules = atRuleNode.rules;\n return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0);\n }\n function getBodyRules(atRuleNode) {\n const nodeRules = atRuleNode.rules;\n if (hasFakeRuleset(atRuleNode)) {\n return nodeRules[0].rules;\n }\n\n return nodeRules;\n }\n // it is still true that it is only one ruleset in array\n // this is last such moment\n // process childs\n const originalRules = getBodyRules(atRuleNode);\n atRuleNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n\n if (!this.utils.isEmpty(atRuleNode)) {\n this._mergeRules(atRuleNode.rules[0].rules);\n }\n\n return this.utils.resolveVisibility(atRuleNode, originalRules);\n },\n\n visitAtRuleWithoutBody: function(atRuleNode, visitArgs) {\n if (atRuleNode.blocksVisibility()) {\n return;\n }\n\n if (atRuleNode.name === '@charset') {\n // Only output the debug info together with subsequent @charset definitions\n // a comment (or @media statement) before the actual @charset atrule would\n // be considered illegal css as it has to be on the first line\n if (this.charset) {\n if (atRuleNode.debugInfo) {\n const comment = new tree.Comment(`/* ${atRuleNode.toCSS(this._context).replace(/\\n/g, '')} */\\n`);\n comment.debugInfo = atRuleNode.debugInfo;\n return this._visitor.visit(comment);\n }\n return;\n }\n this.charset = true;\n }\n\n return atRuleNode;\n },\n\n checkValidNodes: function(rules, isRoot) {\n if (!rules) {\n return;\n }\n\n for (let i = 0; i < rules.length; i++) {\n const ruleNode = rules[i];\n if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) {\n throw { message: 'Properties must be inside selector blocks. They cannot be in the root',\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n if (ruleNode instanceof tree.Call) {\n throw { message: `Function '${ruleNode.name}' is undefined`,\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n if (ruleNode.type && !ruleNode.allowRoot) {\n throw { message: `${ruleNode.type} node returned by a function is not valid here`,\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n }\n },\n\n visitRuleset: function (rulesetNode, visitArgs) {\n // at this point rulesets are nested into each other\n let rule;\n\n const rulesets = [];\n\n this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot);\n\n if (!rulesetNode.root) {\n // remove invisible paths\n this._compileRulesetPaths(rulesetNode);\n\n // remove rulesets from this ruleset body and compile them separately\n const nodeRules = rulesetNode.rules;\n\n let nodeRuleCnt = nodeRules ? nodeRules.length : 0;\n for (let i = 0; i < nodeRuleCnt; ) {\n rule = nodeRules[i];\n if (rule && rule.rules) {\n // visit because we are moving them out from being a child\n rulesets.push(this._visitor.visit(rule));\n nodeRules.splice(i, 1);\n nodeRuleCnt--;\n continue;\n }\n i++;\n }\n // accept the visitor to remove rules and refactor itself\n // then we can decide nogw whether we want it or not\n // compile body\n if (nodeRuleCnt > 0) {\n rulesetNode.accept(this._visitor);\n } else {\n rulesetNode.rules = null;\n }\n visitArgs.visitDeeper = false;\n } else { // if (! rulesetNode.root) {\n rulesetNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n }\n\n if (rulesetNode.rules) {\n this._mergeRules(rulesetNode.rules);\n this._removeDuplicateRules(rulesetNode.rules);\n }\n\n // now decide whether we keep the ruleset\n if (this.utils.isVisibleRuleset(rulesetNode)) {\n rulesetNode.ensureVisibility();\n rulesets.splice(0, 0, rulesetNode);\n }\n\n if (rulesets.length === 1) {\n return rulesets[0];\n }\n return rulesets;\n },\n\n _compileRulesetPaths: function(rulesetNode) {\n if (rulesetNode.paths) {\n rulesetNode.paths = rulesetNode.paths\n .filter(p => {\n let i;\n if (p[0].elements[0].combinator.value === ' ') {\n p[0].elements[0].combinator = new(tree.Combinator)('');\n }\n for (i = 0; i < p.length; i++) {\n if (p[i].isVisible() && p[i].getIsOutput()) {\n return true;\n }\n }\n return false;\n });\n }\n },\n\n _removeDuplicateRules: function(rules) {\n if (!rules) { return; }\n\n // remove duplicates\n const ruleCache = {};\n\n let ruleList;\n let rule;\n let i;\n\n for (i = rules.length - 1; i >= 0 ; i--) {\n rule = rules[i];\n if (rule instanceof tree.Declaration) {\n if (!ruleCache[rule.name]) {\n ruleCache[rule.name] = rule;\n } else {\n ruleList = ruleCache[rule.name];\n if (ruleList instanceof tree.Declaration) {\n ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)];\n }\n const ruleCSS = rule.toCSS(this._context);\n if (ruleList.indexOf(ruleCSS) !== -1) {\n rules.splice(i, 1);\n } else {\n ruleList.push(ruleCSS);\n }\n }\n }\n }\n },\n\n _mergeRules: function(rules) {\n if (!rules) {\n return; \n }\n\n const groups = {};\n const groupsArr = [];\n\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (rule.merge) {\n const key = rule.name;\n groups[key] ? rules.splice(i--, 1) : \n groupsArr.push(groups[key] = []);\n groups[key].push(rule);\n }\n }\n\n groupsArr.forEach(group => {\n if (group.length > 0) {\n const result = group[0];\n let space = [];\n const comma = [new tree.Expression(space)];\n group.forEach(rule => {\n if ((rule.merge === '+') && (space.length > 0)) {\n comma.push(new tree.Expression(space = []));\n }\n space.push(rule.value);\n result.important = result.important || rule.important;\n });\n result.value = new tree.Value(comma);\n }\n });\n }\n};\n\nexport default ToCSSVisitor;\n"]} \ No newline at end of file diff --git a/packages/less/lib/less/visitors/visitor.js b/packages/less/lib/less/visitors/visitor.js deleted file mode 100644 index 8dbc6332b..000000000 --- a/packages/less/lib/less/visitors/visitor.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var tree_1 = __importDefault(require("../tree")); -var _visitArgs = { visitDeeper: true }; -var _hasIndexed = false; -function _noop(node) { - return node; -} -function indexNodeTypes(parent, ticker) { - // add .typeIndex to tree node types for lookup table - var key; - var child; - for (key in parent) { - /* eslint guard-for-in: 0 */ - child = parent[key]; - switch (typeof child) { - case 'function': - // ignore bound functions directly on tree which do not have a prototype - // or aren't nodes - if (child.prototype && child.prototype.type) { - child.prototype.typeIndex = ticker++; - } - break; - case 'object': - ticker = indexNodeTypes(child, ticker); - break; - } - } - return ticker; -} -var Visitor = /** @class */ (function () { - function Visitor(implementation) { - this._implementation = implementation; - this._visitInCache = {}; - this._visitOutCache = {}; - if (!_hasIndexed) { - indexNodeTypes(tree_1.default, 1); - _hasIndexed = true; - } - } - Visitor.prototype.visit = function (node) { - if (!node) { - return node; - } - var nodeTypeIndex = node.typeIndex; - if (!nodeTypeIndex) { - // MixinCall args aren't a node type? - if (node.value && node.value.typeIndex) { - this.visit(node.value); - } - return node; - } - var impl = this._implementation; - var func = this._visitInCache[nodeTypeIndex]; - var funcOut = this._visitOutCache[nodeTypeIndex]; - var visitArgs = _visitArgs; - var fnName; - visitArgs.visitDeeper = true; - if (!func) { - fnName = "visit" + node.type; - func = impl[fnName] || _noop; - funcOut = impl[fnName + "Out"] || _noop; - this._visitInCache[nodeTypeIndex] = func; - this._visitOutCache[nodeTypeIndex] = funcOut; - } - if (func !== _noop) { - var newNode = func.call(impl, node, visitArgs); - if (node && impl.isReplacing) { - node = newNode; - } - } - if (visitArgs.visitDeeper && node) { - if (node.length) { - for (var i = 0, cnt = node.length; i < cnt; i++) { - if (node[i].accept) { - node[i].accept(this); - } - } - } - else if (node.accept) { - node.accept(this); - } - } - if (funcOut != _noop) { - funcOut.call(impl, node); - } - return node; - }; - Visitor.prototype.visitArray = function (nodes, nonReplacing) { - if (!nodes) { - return nodes; - } - var cnt = nodes.length; - var i; - // Non-replacing - if (nonReplacing || !this._implementation.isReplacing) { - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - } - // Replacing - var out = []; - for (i = 0; i < cnt; i++) { - var evald = this.visit(nodes[i]); - if (evald === undefined) { - continue; - } - if (!evald.splice) { - out.push(evald); - } - else if (evald.length) { - this.flatten(evald, out); - } - } - return out; - }; - Visitor.prototype.flatten = function (arr, out) { - if (!out) { - out = []; - } - var cnt; - var i; - var item; - var nestedCnt; - var j; - var nestedItem; - for (i = 0, cnt = arr.length; i < cnt; i++) { - item = arr[i]; - if (item === undefined) { - continue; - } - if (!item.splice) { - out.push(item); - continue; - } - for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) { - nestedItem = item[j]; - if (nestedItem === undefined) { - continue; - } - if (!nestedItem.splice) { - out.push(nestedItem); - } - else if (nestedItem.length) { - this.flatten(nestedItem, out); - } - } - } - return out; - }; - return Visitor; -}()); -exports.default = Visitor; -//# sourceMappingURL=visitor.js.map \ No newline at end of file diff --git a/packages/less/lib/less/visitors/visitor.js.map b/packages/less/lib/less/visitors/visitor.js.map deleted file mode 100644 index e98ef7bb9..000000000 --- a/packages/less/lib/less/visitors/visitor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"visitor.js","sourceRoot":"","sources":["../../../src/less/visitors/visitor.js"],"names":[],"mappings":";;;;;AAAA,iDAA2B;AAC3B,IAAM,UAAU,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AACzC,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,SAAS,KAAK,CAAC,IAAI;IACf,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,MAAM,EAAE,MAAM;IAClC,qDAAqD;IACrD,IAAI,GAAG,CAAC;IAER,IAAI,KAAK,CAAC;IACV,KAAK,GAAG,IAAI,MAAM,EAAE;QAChB,4BAA4B;QAC5B,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACpB,QAAQ,OAAO,KAAK,EAAE;YAClB,KAAK,UAAU;gBACX,wEAAwE;gBACxE,kBAAkB;gBAClB,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE;oBACzC,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;iBACxC;gBACD,MAAM;YACV,KAAK,QAAQ;gBACT,MAAM,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACvC,MAAM;SAEb;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;IACI,iBAAY,cAAc;QACtB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QAEzB,IAAI,CAAC,WAAW,EAAE;YACd,cAAc,CAAC,cAAI,EAAE,CAAC,CAAC,CAAC;YACxB,WAAW,GAAG,IAAI,CAAC;SACtB;IACL,CAAC;IAED,u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;aACJ;SACJ;QAED,OAAO,GAAG,CAAC;IACf,CAAC;IACL,cAAC;AAAD,CAAC,AAvID,IAuIC;AAED,kBAAe,OAAO,CAAC","sourcesContent":["import tree from '../tree';\nconst _visitArgs = { visitDeeper: true };\nlet _hasIndexed = false;\n\nfunction _noop(node) {\n return node;\n}\n\nfunction indexNodeTypes(parent, ticker) {\n // add .typeIndex to tree node types for lookup table\n let key;\n\n let child;\n for (key in parent) { \n /* eslint guard-for-in: 0 */\n child = parent[key];\n switch (typeof child) {\n case 'function':\n // ignore bound functions directly on tree which do not have a prototype\n // or aren't nodes\n if (child.prototype && child.prototype.type) {\n child.prototype.typeIndex = ticker++;\n }\n break;\n case 'object':\n ticker = indexNodeTypes(child, ticker);\n break;\n \n }\n }\n return ticker;\n}\n\nclass Visitor {\n constructor(implementation) {\n this._implementation = implementation;\n this._visitInCache = {};\n this._visitOutCache = {};\n\n if (!_hasIndexed) {\n indexNodeTypes(tree, 1);\n _hasIndexed = true;\n }\n }\n\n visit(node) {\n if (!node) {\n return node;\n }\n\n const nodeTypeIndex = node.typeIndex;\n if (!nodeTypeIndex) {\n // MixinCall args aren't a node type?\n if (node.value && node.value.typeIndex) {\n this.visit(node.value);\n }\n return node;\n }\n\n const impl = this._implementation;\n let func = this._visitInCache[nodeTypeIndex];\n let funcOut = this._visitOutCache[nodeTypeIndex];\n const visitArgs = _visitArgs;\n let fnName;\n\n visitArgs.visitDeeper = true;\n\n if (!func) {\n fnName = `visit${node.type}`;\n func = impl[fnName] || _noop;\n funcOut = impl[`${fnName}Out`] || _noop;\n this._visitInCache[nodeTypeIndex] = func;\n this._visitOutCache[nodeTypeIndex] = funcOut;\n }\n\n if (func !== _noop) {\n const newNode = func.call(impl, node, visitArgs);\n if (node && impl.isReplacing) {\n node = newNode;\n }\n }\n\n if (visitArgs.visitDeeper && node) {\n if (node.length) {\n for (var i = 0, cnt = node.length; i < cnt; i++) {\n if (node[i].accept) {\n node[i].accept(this);\n }\n }\n } else if (node.accept) {\n node.accept(this);\n }\n }\n\n if (funcOut != _noop) {\n funcOut.call(impl, node);\n }\n\n return node;\n }\n\n visitArray(nodes, nonReplacing) {\n if (!nodes) {\n return nodes;\n }\n\n const cnt = nodes.length;\n let i;\n\n // Non-replacing\n if (nonReplacing || !this._implementation.isReplacing) {\n for (i = 0; i < cnt; i++) {\n this.visit(nodes[i]);\n }\n return nodes;\n }\n\n // Replacing\n const out = [];\n for (i = 0; i < cnt; i++) {\n const evald = this.visit(nodes[i]);\n if (evald === undefined) { continue; }\n if (!evald.splice) {\n out.push(evald);\n } else if (evald.length) {\n this.flatten(evald, out);\n }\n }\n return out;\n }\n\n flatten(arr, out) {\n if (!out) {\n out = [];\n }\n\n let cnt;\n let i;\n let item;\n let nestedCnt;\n let j;\n let nestedItem;\n\n for (i = 0, cnt = arr.length; i < cnt; i++) {\n item = arr[i];\n if (item === undefined) {\n continue;\n }\n if (!item.splice) {\n out.push(item);\n continue;\n }\n\n for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) {\n nestedItem = item[j];\n if (nestedItem === undefined) {\n continue;\n }\n if (!nestedItem.splice) {\n out.push(nestedItem);\n } else if (nestedItem.length) {\n this.flatten(nestedItem, out);\n }\n }\n }\n\n return out;\n }\n}\n\nexport default Visitor;\n"]} \ No newline at end of file diff --git a/packages/less/package.json b/packages/less/package.json index c0e16705d..38ec723da 100644 --- a/packages/less/package.json +++ b/packages/less/package.json @@ -41,7 +41,8 @@ "clean": "shx rm -rf ./lib tsconfig.tsbuildinfo", "compile": "tsc -p tsconfig.json", "copy:root": "shx cp -rf ./dist ../../", - "dev": "tsc -p tsconfig.json -w" + "dev": "tsc -p tsconfig.json -w", + "prepublishOnly": "grunt dist" }, "optionalDependencies": { "errno": "^0.1.1",