less 4.5.1 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -5
- package/bin/lessc +37 -23
- package/dist/less.js +14501 -11745
- package/dist/less.min.js +4 -4
- package/dist/less.min.js.map +1 -1
- package/index.cjs +41 -0
- package/lib/less/constants.js +5 -7
- package/lib/less/contexts.js +71 -55
- package/lib/less/data/colors.js +150 -153
- package/lib/less/data/index.js +4 -7
- package/lib/less/data/unit-conversions.js +2 -5
- package/lib/less/default-options.js +36 -26
- package/lib/less/deprecation.js +67 -0
- package/lib/less/environment/abstract-file-manager.js +62 -50
- package/lib/less/environment/abstract-plugin-loader.js +69 -46
- package/lib/less/environment/environment-api.ts +21 -0
- package/lib/less/environment/environment.js +34 -30
- package/lib/less/environment/file-manager-api.ts +77 -0
- package/lib/less/functions/boolean.js +13 -13
- package/lib/less/functions/color-blending.js +39 -31
- package/lib/less/functions/color.js +153 -137
- package/lib/less/functions/data-uri.js +73 -64
- package/lib/less/functions/default.js +9 -11
- package/lib/less/functions/function-caller.js +35 -34
- package/lib/less/functions/function-registry.js +16 -17
- package/lib/less/functions/index.js +33 -33
- package/lib/less/functions/list.js +88 -75
- package/lib/less/functions/math-helper.js +8 -11
- package/lib/less/functions/math.js +21 -21
- package/lib/less/functions/number.js +42 -53
- package/lib/less/functions/string.js +18 -22
- package/lib/less/functions/style.js +21 -20
- package/lib/less/functions/svg.js +83 -82
- package/lib/less/functions/types.js +28 -32
- package/lib/less/import-manager.js +73 -64
- package/lib/less/index.js +65 -65
- package/lib/less/less-error.js +63 -45
- package/lib/less/logger.js +11 -14
- package/lib/less/parse-tree.js +52 -53
- package/lib/less/parse.js +44 -44
- package/lib/less/parser/parser-input.js +151 -113
- package/lib/less/parser/parser.js +864 -658
- package/lib/less/plugin-manager.js +57 -46
- package/lib/less/render.js +17 -23
- package/lib/less/source-map-builder.js +52 -43
- package/lib/less/source-map-output.js +56 -43
- package/lib/less/transform-tree.js +40 -30
- package/lib/less/tree/anonymous.js +52 -28
- package/lib/less/tree/assignment.js +44 -27
- package/lib/less/tree/atrule-syntax.js +4 -6
- package/lib/less/tree/atrule.js +247 -140
- package/lib/less/tree/attribute.js +55 -24
- package/lib/less/tree/call.js +70 -42
- package/lib/less/tree/color.js +194 -145
- package/lib/less/tree/combinator.js +31 -21
- package/lib/less/tree/comment.js +44 -23
- package/lib/less/tree/condition.js +61 -36
- package/lib/less/tree/container.js +90 -34
- package/lib/less/tree/debug-info.js +28 -15
- package/lib/less/tree/declaration.js +97 -52
- package/lib/less/tree/detached-ruleset.js +42 -24
- package/lib/less/tree/dimension.js +127 -71
- package/lib/less/tree/element.js +82 -52
- package/lib/less/tree/expression.js +75 -50
- package/lib/less/tree/extend.js +71 -42
- package/lib/less/tree/import.js +184 -110
- package/lib/less/tree/index.js +52 -81
- package/lib/less/tree/javascript.js +43 -32
- package/lib/less/tree/js-eval-node.js +46 -32
- package/lib/less/tree/keyword.js +25 -17
- package/lib/less/tree/media.js +77 -35
- package/lib/less/tree/merge-rules.js +47 -0
- package/lib/less/tree/mixin-call.js +181 -98
- package/lib/less/tree/mixin-definition.js +211 -117
- package/lib/less/tree/namespace-value.js +63 -44
- package/lib/less/tree/negative.js +34 -21
- package/lib/less/tree/nested-at-rule.js +149 -66
- package/lib/less/tree/node.js +225 -90
- package/lib/less/tree/operation.js +59 -34
- package/lib/less/tree/paren.js +34 -17
- package/lib/less/tree/property.js +66 -35
- package/lib/less/tree/query-in-parens.js +52 -60
- package/lib/less/tree/quoted.js +93 -44
- package/lib/less/tree/ruleset.js +632 -318
- package/lib/less/tree/selector.js +151 -77
- package/lib/less/tree/unicode-descriptor.js +14 -12
- package/lib/less/tree/unit.js +111 -63
- package/lib/less/tree/url.js +62 -38
- package/lib/less/tree/value.js +50 -34
- package/lib/less/tree/variable-call.js +47 -30
- package/lib/less/tree/variable.js +53 -31
- package/lib/less/utils.js +44 -47
- package/lib/less/visitors/extend-visitor.js +233 -172
- package/lib/less/visitors/import-sequencer.js +24 -24
- package/lib/less/visitors/import-visitor.js +62 -52
- package/lib/less/visitors/index.js +14 -17
- package/lib/less/visitors/join-selector-visitor.js +40 -37
- package/lib/less/visitors/set-tree-visibility-visitor.js +32 -18
- package/lib/less/visitors/to-css-visitor.js +135 -128
- package/lib/less/visitors/visitor.js +60 -45
- package/lib/less-browser/add-default-options.js +23 -13
- package/lib/less-browser/bootstrap.js +23 -17
- package/lib/less-browser/browser.js +24 -21
- package/lib/less-browser/cache.js +17 -19
- package/lib/less-browser/error-reporting.js +52 -44
- package/lib/less-browser/file-manager.js +52 -42
- package/lib/less-browser/image-size.js +12 -12
- package/lib/less-browser/index.js +131 -105
- package/lib/less-browser/log-listener.js +30 -31
- package/lib/less-browser/plugin-loader.js +10 -10
- package/lib/less-browser/utils.js +19 -21
- package/lib/less-node/environment.js +32 -8
- package/lib/less-node/file-manager.js +62 -45
- package/lib/less-node/fs.js +11 -8
- package/lib/less-node/image-size.js +40 -31
- package/lib/less-node/index.js +28 -19
- package/lib/less-node/lessc-helper.js +20 -21
- package/lib/less-node/plugin-loader.js +35 -27
- package/lib/less-node/url-file-manager.js +33 -31
- package/package.json +29 -18
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -63
- package/Gruntfile.js +0 -403
- package/bower.json +0 -22
- package/lib/less/constants.js.map +0 -1
- package/lib/less/contexts.js.map +0 -1
- package/lib/less/data/colors.js.map +0 -1
- package/lib/less/data/index.js.map +0 -1
- package/lib/less/data/unit-conversions.js.map +0 -1
- package/lib/less/default-options.js.map +0 -1
- package/lib/less/environment/abstract-file-manager.js.map +0 -1
- package/lib/less/environment/abstract-plugin-loader.js.map +0 -1
- package/lib/less/environment/environment-api.js +0 -3
- package/lib/less/environment/environment-api.js.map +0 -1
- package/lib/less/environment/environment.js.map +0 -1
- package/lib/less/environment/file-manager-api.js +0 -3
- package/lib/less/environment/file-manager-api.js.map +0 -1
- package/lib/less/functions/boolean.js.map +0 -1
- package/lib/less/functions/color-blending.js.map +0 -1
- package/lib/less/functions/color.js.map +0 -1
- package/lib/less/functions/data-uri.js.map +0 -1
- package/lib/less/functions/default.js.map +0 -1
- package/lib/less/functions/function-caller.js.map +0 -1
- package/lib/less/functions/function-registry.js.map +0 -1
- package/lib/less/functions/index.js.map +0 -1
- package/lib/less/functions/list.js.map +0 -1
- package/lib/less/functions/math-helper.js.map +0 -1
- package/lib/less/functions/math.js.map +0 -1
- package/lib/less/functions/number.js.map +0 -1
- package/lib/less/functions/string.js.map +0 -1
- package/lib/less/functions/style.js.map +0 -1
- package/lib/less/functions/svg.js.map +0 -1
- package/lib/less/functions/types.js.map +0 -1
- package/lib/less/import-manager.js.map +0 -1
- package/lib/less/index.js.map +0 -1
- package/lib/less/less-error.js.map +0 -1
- package/lib/less/logger.js.map +0 -1
- package/lib/less/parse-tree.js.map +0 -1
- package/lib/less/parse.js.map +0 -1
- package/lib/less/parser/parser-input.js.map +0 -1
- package/lib/less/parser/parser.js.map +0 -1
- package/lib/less/plugin-manager.js.map +0 -1
- package/lib/less/render.js.map +0 -1
- package/lib/less/source-map-builder.js.map +0 -1
- package/lib/less/source-map-output.js.map +0 -1
- package/lib/less/transform-tree.js.map +0 -1
- package/lib/less/tree/anonymous.js.map +0 -1
- package/lib/less/tree/assignment.js.map +0 -1
- package/lib/less/tree/atrule-syntax.js.map +0 -1
- package/lib/less/tree/atrule.js.map +0 -1
- package/lib/less/tree/attribute.js.map +0 -1
- package/lib/less/tree/call.js.map +0 -1
- package/lib/less/tree/color.js.map +0 -1
- package/lib/less/tree/combinator.js.map +0 -1
- package/lib/less/tree/comment.js.map +0 -1
- package/lib/less/tree/condition.js.map +0 -1
- package/lib/less/tree/container.js.map +0 -1
- package/lib/less/tree/debug-info.js.map +0 -1
- package/lib/less/tree/declaration.js.map +0 -1
- package/lib/less/tree/detached-ruleset.js.map +0 -1
- package/lib/less/tree/dimension.js.map +0 -1
- package/lib/less/tree/element.js.map +0 -1
- package/lib/less/tree/expression.js.map +0 -1
- package/lib/less/tree/extend.js.map +0 -1
- package/lib/less/tree/import.js.map +0 -1
- package/lib/less/tree/index.js.map +0 -1
- package/lib/less/tree/javascript.js.map +0 -1
- package/lib/less/tree/js-eval-node.js.map +0 -1
- package/lib/less/tree/keyword.js.map +0 -1
- package/lib/less/tree/media.js.map +0 -1
- package/lib/less/tree/mixin-call.js.map +0 -1
- package/lib/less/tree/mixin-definition.js.map +0 -1
- package/lib/less/tree/namespace-value.js.map +0 -1
- package/lib/less/tree/negative.js.map +0 -1
- package/lib/less/tree/nested-at-rule.js.map +0 -1
- package/lib/less/tree/node.js.map +0 -1
- package/lib/less/tree/operation.js.map +0 -1
- package/lib/less/tree/paren.js.map +0 -1
- package/lib/less/tree/property.js.map +0 -1
- package/lib/less/tree/query-in-parens.js.map +0 -1
- package/lib/less/tree/quoted.js.map +0 -1
- package/lib/less/tree/ruleset.js.map +0 -1
- package/lib/less/tree/selector.js.map +0 -1
- package/lib/less/tree/unicode-descriptor.js.map +0 -1
- package/lib/less/tree/unit.js.map +0 -1
- package/lib/less/tree/url.js.map +0 -1
- package/lib/less/tree/value.js.map +0 -1
- package/lib/less/tree/variable-call.js.map +0 -1
- package/lib/less/tree/variable.js.map +0 -1
- package/lib/less/utils.js.map +0 -1
- package/lib/less/visitors/extend-visitor.js.map +0 -1
- package/lib/less/visitors/import-sequencer.js.map +0 -1
- package/lib/less/visitors/import-visitor.js.map +0 -1
- package/lib/less/visitors/index.js.map +0 -1
- package/lib/less/visitors/join-selector-visitor.js.map +0 -1
- package/lib/less/visitors/set-tree-visibility-visitor.js.map +0 -1
- package/lib/less/visitors/to-css-visitor.js.map +0 -1
- package/lib/less/visitors/visitor.js.map +0 -1
- package/lib/less-browser/add-default-options.js.map +0 -1
- package/lib/less-browser/bootstrap.js.map +0 -1
- package/lib/less-browser/browser.js.map +0 -1
- package/lib/less-browser/cache.js.map +0 -1
- package/lib/less-browser/error-reporting.js.map +0 -1
- package/lib/less-browser/file-manager.js.map +0 -1
- package/lib/less-browser/image-size.js.map +0 -1
- package/lib/less-browser/index.js.map +0 -1
- package/lib/less-browser/log-listener.js.map +0 -1
- package/lib/less-browser/plugin-loader.js.map +0 -1
- package/lib/less-browser/utils.js.map +0 -1
- package/lib/less-node/environment.js.map +0 -1
- package/lib/less-node/file-manager.js.map +0 -1
- package/lib/less-node/fs.js.map +0 -1
- package/lib/less-node/image-size.js.map +0 -1
- package/lib/less-node/index.js.map +0 -1
- package/lib/less-node/lessc-helper.js.map +0 -1
- package/lib/less-node/plugin-loader.js.map +0 -1
- package/lib/less-node/url-file-manager.js.map +0 -1
- package/scripts/coverage-lines.js +0 -207
- package/scripts/coverage-report.js +0 -158
- package/scripts/postinstall.js +0 -61
- package/test/.eslintrc.json +0 -9
- package/test/README.md +0 -3
- package/test/browser/common.js +0 -251
- package/test/browser/css/global-vars/simple.css +0 -3
- package/test/browser/css/modify-vars/simple.css +0 -8
- package/test/browser/css/plugin/plugin.css +0 -3
- package/test/browser/css/postProcessor/postProcessor.css +0 -4
- package/test/browser/css/relative-urls/urls.css +0 -36
- package/test/browser/css/rewrite-urls/urls.css +0 -36
- package/test/browser/css/rootpath/urls.css +0 -35
- package/test/browser/css/rootpath-relative/urls.css +0 -35
- package/test/browser/css/rootpath-rewrite-urls/urls.css +0 -35
- package/test/browser/css/urls.css +0 -54
- package/test/browser/generator/benchmark.config.js +0 -50
- package/test/browser/generator/generate.js +0 -78
- package/test/browser/generator/runner.config.js +0 -184
- package/test/browser/generator/runner.js +0 -2
- package/test/browser/generator/template.js +0 -104
- package/test/browser/generator/utils.js +0 -14
- package/test/browser/less/console-errors/test-error.less +0 -3
- package/test/browser/less/console-errors/test-error.txt +0 -2
- package/test/browser/less/errors/image-height-error.less +0 -3
- package/test/browser/less/errors/image-height-error.txt +0 -4
- package/test/browser/less/errors/image-size-error.less +0 -3
- package/test/browser/less/errors/image-size-error.txt +0 -4
- package/test/browser/less/errors/image-width-error.less +0 -3
- package/test/browser/less/errors/image-width-error.txt +0 -4
- package/test/browser/less/global-vars/simple.less +0 -3
- package/test/browser/less/imports/urls.less +0 -4
- package/test/browser/less/imports/urls2.less +0 -4
- package/test/browser/less/modify-vars/imports/simple2.less +0 -4
- package/test/browser/less/modify-vars/simple.less +0 -8
- package/test/browser/less/nested-gradient-with-svg-gradient/mixin-consumer.less +0 -5
- package/test/browser/less/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +0 -15
- package/test/browser/less/plugin/plugin.js +0 -4
- package/test/browser/less/plugin/plugin.less +0 -4
- package/test/browser/less/postProcessor/postProcessor.less +0 -4
- package/test/browser/less/relative-urls/urls.less +0 -34
- package/test/browser/less/rewrite-urls/urls.less +0 -34
- package/test/browser/less/rootpath/urls.less +0 -33
- package/test/browser/less/rootpath-relative/urls.less +0 -33
- package/test/browser/less/rootpath-rewrite-urls/urls.less +0 -33
- package/test/browser/less/urls.less +0 -62
- package/test/browser/runner-VisitorPlugin-options.js +0 -3
- package/test/browser/runner-VisitorPlugin.js +0 -3
- package/test/browser/runner-browser-options.js +0 -51
- package/test/browser/runner-browser-spec.js +0 -12
- package/test/browser/runner-console-errors.js +0 -5
- package/test/browser/runner-errors-options.js +0 -6
- package/test/browser/runner-errors-spec.js +0 -3
- package/test/browser/runner-filemanagerPlugin-options.js +0 -5
- package/test/browser/runner-filemanagerPlugin.js +0 -3
- package/test/browser/runner-global-vars-options.js +0 -7
- package/test/browser/runner-global-vars-spec.js +0 -3
- package/test/browser/runner-main-options.js +0 -17
- package/test/browser/runner-main-spec.js +0 -7
- package/test/browser/runner-modify-vars-options.js +0 -5
- package/test/browser/runner-modify-vars-spec.js +0 -33
- package/test/browser/runner-no-js-errors-options.js +0 -4
- package/test/browser/runner-no-js-errors-spec.js +0 -3
- package/test/browser/runner-postProcessorPlugin-options.js +0 -3
- package/test/browser/runner-postProcessorPlugin.js +0 -3
- package/test/browser/runner-preProcessorPlugin-options.js +0 -3
- package/test/browser/runner-preProcessorPlugin.js +0 -3
- package/test/browser/runner-production-options.js +0 -3
- package/test/browser/runner-production-spec.js +0 -5
- package/test/browser/runner-relative-urls-options.js +0 -3
- package/test/browser/runner-relative-urls-spec.js +0 -3
- package/test/browser/runner-rewrite-urls-options.js +0 -3
- package/test/browser/runner-rewrite-urls-spec.js +0 -3
- package/test/browser/runner-rootpath-options.js +0 -3
- package/test/browser/runner-rootpath-relative-options.js +0 -4
- package/test/browser/runner-rootpath-relative-spec.js +0 -3
- package/test/browser/runner-rootpath-rewrite-urls-options.js +0 -4
- package/test/browser/runner-rootpath-rewrite-urls-spec.js +0 -3
- package/test/browser/runner-rootpath-spec.js +0 -3
- package/test/browser/runner-strict-units-options.js +0 -5
- package/test/browser/runner-strict-units-spec.js +0 -3
- package/test/index.js +0 -307
- package/test/less-test.js +0 -984
- package/test/mocha-playwright/runner.js +0 -210
- package/test/modify-vars.js +0 -28
- package/test/plugins/filemanager/index.js +0 -19
- package/test/plugins/postprocess/index.js +0 -14
- package/test/plugins/preprocess/index.js +0 -19
- package/test/plugins/visitor/index.js +0 -24
- package/test/sourcemaps/basic.json +0 -1
- package/test/sourcemaps/comprehensive.json +0 -1
- package/test/sourcemaps/custom-props.json +0 -1
- package/test/sourcemaps/index.html +0 -17
- package/test/sourcemaps/sourcemaps-basepath.json +0 -1
- package/test/sourcemaps/sourcemaps-include-source.json +0 -1
- package/test/sourcemaps/sourcemaps-rootpath.json +0 -1
- package/test/sourcemaps/sourcemaps-url.json +0 -1
- package/test/sourcemaps-disable-annotation/basic.json +0 -1
- package/test/sourcemaps-variable-selector/basic.json +0 -1
- package/test/test-es6.ts +0 -17
- package/test.less +0 -1
- package/tsconfig.build.json +0 -7
- package/tsconfig.json +0 -21
|
@@ -1,79 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
// Export a new default each time
|
|
4
|
-
function
|
|
2
|
+
export default function() {
|
|
5
3
|
return {
|
|
6
4
|
/* Inline Javascript - @plugin still allowed */
|
|
7
5
|
javascriptEnabled: false,
|
|
6
|
+
|
|
8
7
|
/* Outputs a makefile import dependency list to stdout. */
|
|
9
8
|
depends: false,
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
/* (DEPRECATED) Compress using less built-in compression.
|
|
11
|
+
* This does an okay job but does not utilise all the tricks of
|
|
12
12
|
* dedicated css compression. */
|
|
13
13
|
compress: false,
|
|
14
|
+
|
|
14
15
|
/* Runs the less parser and just reports errors without any output. */
|
|
15
16
|
lint: false,
|
|
17
|
+
|
|
16
18
|
/* Sets available include paths.
|
|
17
|
-
* If the file in an @import rule does not exist at that exact location,
|
|
18
|
-
* less will look for it at the location(s) passed to this option.
|
|
19
|
-
* You might use this for instance to specify a path to a library which
|
|
19
|
+
* If the file in an @import rule does not exist at that exact location,
|
|
20
|
+
* less will look for it at the location(s) passed to this option.
|
|
21
|
+
* You might use this for instance to specify a path to a library which
|
|
20
22
|
* you want to be referenced simply and relatively in the less files. */
|
|
21
23
|
paths: [],
|
|
24
|
+
|
|
22
25
|
/* color output in the terminal */
|
|
23
26
|
color: true,
|
|
27
|
+
|
|
24
28
|
/**
|
|
25
29
|
* @deprecated This option has confusing behavior and may be removed in a future version.
|
|
26
|
-
*
|
|
30
|
+
*
|
|
27
31
|
* When true, prevents @import statements for .less files from being evaluated inside
|
|
28
32
|
* selector blocks (rulesets). The imports are silently ignored and not output.
|
|
29
|
-
*
|
|
33
|
+
*
|
|
30
34
|
* Behavior:
|
|
31
35
|
* - @import at root level: Always processed
|
|
32
36
|
* - @import inside @-rules (@media, @supports, etc.): Processed (these are not selector blocks)
|
|
33
37
|
* - @import inside selector blocks (.class, #id, etc.): NOT processed (silently ignored)
|
|
34
|
-
*
|
|
38
|
+
*
|
|
35
39
|
* When false (default): All @import statements are processed regardless of context.
|
|
36
|
-
*
|
|
40
|
+
*
|
|
37
41
|
* Note: Despite the name "strict", this option does NOT throw an error when imports
|
|
38
42
|
* are used in selector blocks - it silently ignores them. This is confusing
|
|
39
43
|
* behavior that may catch users off guard.
|
|
40
|
-
*
|
|
44
|
+
*
|
|
41
45
|
* Note: Only affects .less file imports. CSS imports (url(...) or .css files) are
|
|
42
46
|
* always output as CSS @import statements regardless of this setting.
|
|
43
|
-
*
|
|
47
|
+
*
|
|
44
48
|
* @see https://github.com/less/less.js/issues/656
|
|
45
49
|
*/
|
|
46
50
|
strictImports: false,
|
|
51
|
+
|
|
47
52
|
/* Allow Imports from Insecure HTTPS Hosts */
|
|
48
53
|
insecure: false,
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
|
|
55
|
+
/* Allows you to add a path to every generated import and url in your css.
|
|
56
|
+
* This does not affect less import statements that are processed, just ones
|
|
51
57
|
* that are left in the output css. */
|
|
52
58
|
rootpath: '',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
59
|
+
|
|
60
|
+
/* By default URLs are kept as-is, so if you import a file in a sub-directory
|
|
61
|
+
* that references an image, exactly the same URL will be output in the css.
|
|
62
|
+
* This option allows you to re-write URL's in imported files so that the
|
|
56
63
|
* URL is always relative to the base imported file */
|
|
57
64
|
rewriteUrls: false,
|
|
58
|
-
|
|
65
|
+
|
|
66
|
+
/* How to process math
|
|
59
67
|
* 0 always - eagerly try to solve all operations
|
|
60
68
|
* 1 parens-division - require parens for division "/"
|
|
61
69
|
* 2 parens | strict - require parens for all operations
|
|
62
70
|
* 3 strict-legacy - legacy strict behavior (super-strict)
|
|
63
71
|
*/
|
|
64
72
|
math: 1,
|
|
73
|
+
|
|
65
74
|
/* Without this option, less attempts to guess at the output unit when it does maths. */
|
|
66
75
|
strictUnits: false,
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
|
|
77
|
+
/* Effectively the declaration is put at the top of your base Less file,
|
|
78
|
+
* meaning it can be used but it also can be overridden if this variable
|
|
69
79
|
* is defined in the file. */
|
|
70
80
|
globalVars: null,
|
|
81
|
+
|
|
71
82
|
/* As opposed to the global variable option, this puts the declaration at the
|
|
72
83
|
* end of your base file, meaning it will override anything defined in your Less file. */
|
|
73
84
|
modifyVars: null,
|
|
85
|
+
|
|
74
86
|
/* This option allows you to specify a argument to go on to every URL. */
|
|
75
87
|
urlArgs: ''
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.default = default_1;
|
|
79
|
-
//# sourceMappingURL=default-options.js.map
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deprecation registry for Less.js
|
|
3
|
+
*
|
|
4
|
+
* Each deprecation has a unique ID and description.
|
|
5
|
+
* Repetition limiting caps warnings at 5 per deprecation type per parse.
|
|
6
|
+
* Use --quiet-deprecations to suppress all deprecation warnings.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const deprecations = {
|
|
10
|
+
'mixin-call-no-parens': {
|
|
11
|
+
description: 'Calling a mixin without parentheses is deprecated.'
|
|
12
|
+
},
|
|
13
|
+
'mixin-call-whitespace': {
|
|
14
|
+
description: 'Whitespace between a mixin name and parentheses for a mixin call is deprecated.'
|
|
15
|
+
},
|
|
16
|
+
'dot-slash-operator': {
|
|
17
|
+
description: 'The ./ operator is deprecated.'
|
|
18
|
+
},
|
|
19
|
+
'variable-in-unknown-value': {
|
|
20
|
+
description: '@[ident] in custom property values is treated as literal text.'
|
|
21
|
+
},
|
|
22
|
+
'property-in-unknown-value': {
|
|
23
|
+
description: '$[ident] in custom property values is treated as literal text.'
|
|
24
|
+
},
|
|
25
|
+
'js-eval': {
|
|
26
|
+
description: 'Inline JavaScript evaluation (backtick expressions) is deprecated and will be removed in Less 5.x.'
|
|
27
|
+
},
|
|
28
|
+
'at-plugin': {
|
|
29
|
+
description: 'The @plugin directive is deprecated and will be replaced in Less 5.x.'
|
|
30
|
+
},
|
|
31
|
+
'dump-line-numbers': {
|
|
32
|
+
description: 'The dumpLineNumbers option is deprecated and will be removed in Less 5.x.'
|
|
33
|
+
},
|
|
34
|
+
'math-always': {
|
|
35
|
+
description: '--math=always is deprecated and will be removed in Less 5.x.'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const MAX_REPETITIONS = 5;
|
|
40
|
+
|
|
41
|
+
class DeprecationHandler {
|
|
42
|
+
constructor() {
|
|
43
|
+
/** @type {Record<string, number>} */
|
|
44
|
+
this._counts = {};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** @param {string} deprecationId */
|
|
48
|
+
shouldWarn(deprecationId) {
|
|
49
|
+
if (!deprecationId) { return true; }
|
|
50
|
+
const count = (this._counts[deprecationId] || 0) + 1;
|
|
51
|
+
this._counts[deprecationId] = count;
|
|
52
|
+
return count <= MAX_REPETITIONS;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @param {{ warn: (msg: string) => void }} logger */
|
|
56
|
+
summarize(logger) {
|
|
57
|
+
for (const id of Object.keys(this._counts)) {
|
|
58
|
+
const omitted = this._counts[id] - MAX_REPETITIONS;
|
|
59
|
+
if (omitted > 0) {
|
|
60
|
+
logger.warn(`${omitted} repetitive "${id}" deprecation warning(s) omitted.`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { deprecations, DeprecationHandler, MAX_REPETITIONS };
|
|
67
|
+
export default { deprecations, DeprecationHandler };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function AbstractFileManager() {
|
|
5
|
-
}
|
|
6
|
-
AbstractFileManager.prototype.getPath = function (filename) {
|
|
7
|
-
var j = filename.lastIndexOf('?');
|
|
1
|
+
class AbstractFileManager {
|
|
2
|
+
getPath(filename) {
|
|
3
|
+
let j = filename.lastIndexOf('?');
|
|
8
4
|
if (j > 0) {
|
|
9
5
|
filename = filename.slice(0, j);
|
|
10
6
|
}
|
|
@@ -16,46 +12,53 @@ var AbstractFileManager = /** @class */ (function () {
|
|
|
16
12
|
return '';
|
|
17
13
|
}
|
|
18
14
|
return filename.slice(0, j + 1);
|
|
19
|
-
}
|
|
20
|
-
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
tryAppendExtension(path, ext) {
|
|
21
18
|
return /(\.[a-z]*$)|([?;].*)$/.test(path) ? path : path + ext;
|
|
22
|
-
}
|
|
23
|
-
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
tryAppendLessExtension(path) {
|
|
24
22
|
return this.tryAppendExtension(path, '.less');
|
|
25
|
-
}
|
|
26
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
supportsSync() {
|
|
27
26
|
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
alwaysMakePathsAbsolute() {
|
|
30
30
|
return false;
|
|
31
|
-
}
|
|
32
|
-
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
isPathAbsolute(filename) {
|
|
33
34
|
return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename);
|
|
34
|
-
}
|
|
35
|
+
}
|
|
36
|
+
|
|
35
37
|
// TODO: pull out / replace?
|
|
36
|
-
|
|
38
|
+
join(basePath, laterPath) {
|
|
37
39
|
if (!basePath) {
|
|
38
40
|
return laterPath;
|
|
39
41
|
}
|
|
40
42
|
return basePath + laterPath;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
pathDiff(url, baseUrl) {
|
|
43
46
|
// diff between two paths to create a relative path
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
|
|
48
|
+
const urlParts = this.extractUrlParts(url);
|
|
49
|
+
|
|
50
|
+
const baseUrlParts = this.extractUrlParts(baseUrl);
|
|
51
|
+
let i;
|
|
52
|
+
let max;
|
|
53
|
+
let urlDirectories;
|
|
54
|
+
let baseUrlDirectories;
|
|
55
|
+
let diff = '';
|
|
51
56
|
if (urlParts.hostPart !== baseUrlParts.hostPart) {
|
|
52
57
|
return '';
|
|
53
58
|
}
|
|
54
59
|
max = Math.max(baseUrlParts.directories.length, urlParts.directories.length);
|
|
55
60
|
for (i = 0; i < max; i++) {
|
|
56
|
-
if (baseUrlParts.directories[i] !== urlParts.directories[i]) {
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
61
|
+
if (baseUrlParts.directories[i] !== urlParts.directories[i]) { break; }
|
|
59
62
|
}
|
|
60
63
|
baseUrlDirectories = baseUrlParts.directories.slice(i);
|
|
61
64
|
urlDirectories = urlParts.directories.slice(i);
|
|
@@ -63,56 +66,66 @@ var AbstractFileManager = /** @class */ (function () {
|
|
|
63
66
|
diff += '../';
|
|
64
67
|
}
|
|
65
68
|
for (i = 0; i < urlDirectories.length - 1; i++) {
|
|
66
|
-
diff +=
|
|
69
|
+
diff += `${urlDirectories[i]}/`;
|
|
67
70
|
}
|
|
68
71
|
return diff;
|
|
69
|
-
}
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
/**
|
|
71
75
|
* Helper function, not part of API.
|
|
72
76
|
* This should be replaceable by newer Node / Browser APIs
|
|
73
|
-
*
|
|
74
|
-
* @param {string} url
|
|
77
|
+
*
|
|
78
|
+
* @param {string} url
|
|
75
79
|
* @param {string} baseUrl
|
|
76
80
|
*/
|
|
77
|
-
|
|
81
|
+
extractUrlParts(url, baseUrl) {
|
|
78
82
|
// urlParts[1] = protocol://hostname/ OR /
|
|
79
83
|
// urlParts[2] = / if path relative to host base
|
|
80
84
|
// urlParts[3] = directories
|
|
81
85
|
// urlParts[4] = filename
|
|
82
86
|
// urlParts[5] = parameters
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
|
|
88
|
+
const urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^/?#]*\/)|([/\\]))?((?:[^/\\?#]*[/\\])*)([^/\\?#]*)([#?].*)?$/i;
|
|
89
|
+
|
|
90
|
+
const urlParts = url.match(urlPartsRegex);
|
|
91
|
+
const returner = {};
|
|
92
|
+
let rawDirectories = [];
|
|
93
|
+
const directories = [];
|
|
94
|
+
let i;
|
|
95
|
+
let baseUrlParts;
|
|
96
|
+
|
|
90
97
|
if (!urlParts) {
|
|
91
|
-
throw new Error(
|
|
98
|
+
throw new Error(`Could not parse sheet href - '${url}'`);
|
|
92
99
|
}
|
|
100
|
+
|
|
93
101
|
// Stylesheets in IE don't always return the full path
|
|
94
102
|
if (baseUrl && (!urlParts[1] || urlParts[2])) {
|
|
95
103
|
baseUrlParts = baseUrl.match(urlPartsRegex);
|
|
96
104
|
if (!baseUrlParts) {
|
|
97
|
-
throw new Error(
|
|
105
|
+
throw new Error(`Could not parse page url - '${baseUrl}'`);
|
|
98
106
|
}
|
|
99
107
|
urlParts[1] = urlParts[1] || baseUrlParts[1] || '';
|
|
100
108
|
if (!urlParts[2]) {
|
|
101
109
|
urlParts[3] = baseUrlParts[3] + urlParts[3];
|
|
102
110
|
}
|
|
103
111
|
}
|
|
112
|
+
|
|
104
113
|
if (urlParts[3]) {
|
|
105
114
|
rawDirectories = urlParts[3].replace(/\\/g, '/').split('/');
|
|
115
|
+
|
|
106
116
|
// collapse '..' and skip '.'
|
|
107
117
|
for (i = 0; i < rawDirectories.length; i++) {
|
|
118
|
+
|
|
108
119
|
if (rawDirectories[i] === '..') {
|
|
109
120
|
directories.pop();
|
|
110
121
|
}
|
|
111
122
|
else if (rawDirectories[i] !== '.') {
|
|
112
123
|
directories.push(rawDirectories[i]);
|
|
113
124
|
}
|
|
125
|
+
|
|
114
126
|
}
|
|
115
127
|
}
|
|
128
|
+
|
|
116
129
|
returner.hostPart = urlParts[1];
|
|
117
130
|
returner.directories = directories;
|
|
118
131
|
returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/');
|
|
@@ -121,8 +134,7 @@ var AbstractFileManager = /** @class */ (function () {
|
|
|
121
134
|
returner.fileUrl = returner.path + (urlParts[4] || '');
|
|
122
135
|
returner.url = returner.fileUrl + (urlParts[5] || '');
|
|
123
136
|
return returner;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
//# sourceMappingURL=abstract-file-manager.js.map
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export default AbstractFileManager;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var AbstractPluginLoader = /** @class */ (function () {
|
|
7
|
-
function AbstractPluginLoader() {
|
|
1
|
+
import functionRegistry from '../functions/function-registry.js';
|
|
2
|
+
import LessError from '../less-error.js';
|
|
3
|
+
|
|
4
|
+
class AbstractPluginLoader {
|
|
5
|
+
constructor() {
|
|
8
6
|
// Implemented by Node.js plugin loader
|
|
9
|
-
this.require = function
|
|
7
|
+
this.require = function() {
|
|
10
8
|
return null;
|
|
11
|
-
}
|
|
9
|
+
}
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
|
|
12
|
+
evalPlugin(contents, context, imports, pluginOptions, fileInfo) {
|
|
13
|
+
|
|
14
|
+
let loader, registry, pluginObj, localModule, pluginManager, filename, result;
|
|
15
|
+
|
|
15
16
|
pluginManager = context.pluginManager;
|
|
17
|
+
|
|
16
18
|
if (fileInfo) {
|
|
17
19
|
if (typeof fileInfo === 'string') {
|
|
18
20
|
filename = fileInfo;
|
|
@@ -21,9 +23,11 @@ var AbstractPluginLoader = /** @class */ (function () {
|
|
|
21
23
|
filename = fileInfo.filename;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
|
|
26
|
+
const shortname = (new this.less.FileManager()).extractUrlParts(filename).filename;
|
|
27
|
+
|
|
25
28
|
if (filename) {
|
|
26
29
|
pluginObj = pluginManager.get(filename);
|
|
30
|
+
|
|
27
31
|
if (pluginObj) {
|
|
28
32
|
result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
|
|
29
33
|
if (result) {
|
|
@@ -36,52 +40,62 @@ var AbstractPluginLoader = /** @class */ (function () {
|
|
|
36
40
|
}
|
|
37
41
|
catch (e) {
|
|
38
42
|
e.message = e.message || 'Error during @plugin call';
|
|
39
|
-
return new
|
|
43
|
+
return new LessError(e, imports, filename);
|
|
40
44
|
}
|
|
41
45
|
return pluginObj;
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
localModule = {
|
|
45
49
|
exports: {},
|
|
46
|
-
pluginManager
|
|
47
|
-
fileInfo
|
|
50
|
+
pluginManager,
|
|
51
|
+
fileInfo
|
|
48
52
|
};
|
|
49
|
-
registry =
|
|
50
|
-
|
|
53
|
+
registry = functionRegistry.create();
|
|
54
|
+
|
|
55
|
+
const registerPlugin = function(obj) {
|
|
51
56
|
pluginObj = obj;
|
|
52
57
|
};
|
|
58
|
+
|
|
53
59
|
try {
|
|
54
60
|
loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents);
|
|
55
61
|
loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo);
|
|
56
62
|
}
|
|
57
63
|
catch (e) {
|
|
58
|
-
return new
|
|
64
|
+
return new LessError(e, imports, filename);
|
|
59
65
|
}
|
|
66
|
+
|
|
60
67
|
if (!pluginObj) {
|
|
61
68
|
pluginObj = localModule.exports;
|
|
62
69
|
}
|
|
63
70
|
pluginObj = this.validatePlugin(pluginObj, filename, shortname);
|
|
64
|
-
|
|
71
|
+
|
|
72
|
+
if (pluginObj instanceof LessError) {
|
|
65
73
|
return pluginObj;
|
|
66
74
|
}
|
|
75
|
+
|
|
67
76
|
if (pluginObj) {
|
|
68
77
|
pluginObj.imports = imports;
|
|
69
78
|
pluginObj.filename = filename;
|
|
79
|
+
|
|
70
80
|
// For < 3.x (or unspecified minVersion) - setOptions() before install()
|
|
71
81
|
if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) {
|
|
72
82
|
result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
|
|
83
|
+
|
|
73
84
|
if (result) {
|
|
74
85
|
return result;
|
|
75
86
|
}
|
|
76
87
|
}
|
|
88
|
+
|
|
77
89
|
// Run on first load
|
|
78
90
|
pluginManager.addPlugin(pluginObj, fileInfo.filename, registry);
|
|
79
91
|
pluginObj.functions = registry.getLocalFunctions();
|
|
92
|
+
|
|
80
93
|
// Need to call setOptions again because the pluginObj might have functions
|
|
81
94
|
result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
|
|
82
95
|
if (result) {
|
|
83
96
|
return result;
|
|
84
97
|
}
|
|
98
|
+
|
|
85
99
|
// Run every @plugin call
|
|
86
100
|
try {
|
|
87
101
|
if (pluginObj.use) {
|
|
@@ -90,73 +104,82 @@ var AbstractPluginLoader = /** @class */ (function () {
|
|
|
90
104
|
}
|
|
91
105
|
catch (e) {
|
|
92
106
|
e.message = e.message || 'Error during @plugin call';
|
|
93
|
-
return new
|
|
107
|
+
return new LessError(e, imports, filename);
|
|
94
108
|
}
|
|
109
|
+
|
|
95
110
|
}
|
|
96
111
|
else {
|
|
97
|
-
return new
|
|
112
|
+
return new LessError({ message: 'Not a valid plugin' }, imports, filename);
|
|
98
113
|
}
|
|
114
|
+
|
|
99
115
|
return pluginObj;
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
trySetOptions(plugin, filename, name, options) {
|
|
102
120
|
if (options && !plugin.setOptions) {
|
|
103
|
-
return new
|
|
104
|
-
message:
|
|
121
|
+
return new LessError({
|
|
122
|
+
message: `Options have been provided but the plugin ${name} does not support any options.`
|
|
105
123
|
});
|
|
106
124
|
}
|
|
107
125
|
try {
|
|
108
126
|
plugin.setOptions && plugin.setOptions(options);
|
|
109
127
|
}
|
|
110
128
|
catch (e) {
|
|
111
|
-
return new
|
|
129
|
+
return new LessError(e);
|
|
112
130
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
validatePlugin(plugin, filename, name) {
|
|
115
134
|
if (plugin) {
|
|
116
135
|
// support plugins being a function
|
|
117
136
|
// so that the plugin can be more usable programmatically
|
|
118
137
|
if (typeof plugin === 'function') {
|
|
119
138
|
plugin = new plugin();
|
|
120
139
|
}
|
|
140
|
+
|
|
121
141
|
if (plugin.minVersion) {
|
|
122
142
|
if (this.compareVersion(plugin.minVersion, this.less.version) < 0) {
|
|
123
|
-
return new
|
|
124
|
-
message:
|
|
143
|
+
return new LessError({
|
|
144
|
+
message: `Plugin ${name} requires version ${this.versionToString(plugin.minVersion)}`
|
|
125
145
|
});
|
|
126
146
|
}
|
|
127
147
|
}
|
|
128
148
|
return plugin;
|
|
129
149
|
}
|
|
130
150
|
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
compareVersion(aVersion, bVersion) {
|
|
133
154
|
if (typeof aVersion === 'string') {
|
|
134
155
|
aVersion = aVersion.match(/^(\d+)\.?(\d+)?\.?(\d+)?/);
|
|
135
156
|
aVersion.shift();
|
|
136
157
|
}
|
|
137
|
-
for (
|
|
158
|
+
for (let i = 0; i < aVersion.length; i++) {
|
|
138
159
|
if (aVersion[i] !== bVersion[i]) {
|
|
139
160
|
return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1;
|
|
140
161
|
}
|
|
141
162
|
}
|
|
142
163
|
return 0;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
versionToString(version) {
|
|
167
|
+
let versionString = '';
|
|
168
|
+
for (let i = 0; i < version.length; i++) {
|
|
147
169
|
versionString += (versionString ? '.' : '') + version[i];
|
|
148
170
|
}
|
|
149
171
|
return versionString;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
printUsage(plugins) {
|
|
175
|
+
for (let i = 0; i < plugins.length; i++) {
|
|
176
|
+
const plugin = plugins[i];
|
|
154
177
|
if (plugin.printUsage) {
|
|
155
178
|
plugin.printUsage();
|
|
156
179
|
}
|
|
157
180
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export default AbstractPluginLoader;
|
|
185
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface Environment {
|
|
2
|
+
/**
|
|
3
|
+
* Converts a string to a base 64 string
|
|
4
|
+
*/
|
|
5
|
+
encodeBase64(str: string): string
|
|
6
|
+
/**
|
|
7
|
+
* Lookup the mime-type of a filename
|
|
8
|
+
*/
|
|
9
|
+
mimeLookup(filename: string): string
|
|
10
|
+
/**
|
|
11
|
+
* Look up the charset of a mime type
|
|
12
|
+
* @param mime
|
|
13
|
+
*/
|
|
14
|
+
charsetLookup(mime: string): string
|
|
15
|
+
/**
|
|
16
|
+
* Gets a source map generator
|
|
17
|
+
*
|
|
18
|
+
* @todo - Figure out precise type
|
|
19
|
+
*/
|
|
20
|
+
getSourceMapGenerator(): any
|
|
21
|
+
}
|