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,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var logger_1 = tslib_1.__importDefault(require("./logger"));
|
|
9
|
-
function default_1(environment) {
|
|
1
|
+
import contexts from './contexts.js';
|
|
2
|
+
import Parser from './parser/parser.js';
|
|
3
|
+
import LessError from './less-error.js';
|
|
4
|
+
import * as utils from './utils.js';
|
|
5
|
+
import logger from './logger.js';
|
|
6
|
+
|
|
7
|
+
export default function(environment) {
|
|
10
8
|
// FileInfo = {
|
|
11
9
|
// 'rewriteUrls' - option - whether to adjust URL's to be relative
|
|
12
10
|
// 'filename' - full resolved filename of current file
|
|
@@ -15,20 +13,22 @@ function default_1(environment) {
|
|
|
15
13
|
// 'rootFilename' - filename of the base file
|
|
16
14
|
// 'entryPath' - absolute path to the entry file
|
|
17
15
|
// 'reference' - whether the file should not be output and only output parts that are referenced
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
|
|
17
|
+
class ImportManager {
|
|
18
|
+
constructor(less, context, rootFileInfo) {
|
|
20
19
|
this.less = less;
|
|
21
20
|
this.rootFilename = rootFileInfo.filename;
|
|
22
|
-
this.paths = context.paths || [];
|
|
23
|
-
this.contents = {};
|
|
21
|
+
this.paths = context.paths || []; // Search paths, when importing
|
|
22
|
+
this.contents = {}; // map - filename to contents of all the files
|
|
24
23
|
this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore
|
|
25
24
|
this.mime = context.mime;
|
|
26
25
|
this.error = null;
|
|
27
26
|
this.context = context;
|
|
28
27
|
// Deprecated? Unused outside of here, could be useful.
|
|
29
|
-
this.queue = [];
|
|
30
|
-
this.files = {};
|
|
28
|
+
this.queue = []; // Files which haven't been imported yet
|
|
29
|
+
this.files = {}; // Holds the imported parse trees.
|
|
31
30
|
}
|
|
31
|
+
|
|
32
32
|
/**
|
|
33
33
|
* Add an import to be imported
|
|
34
34
|
* @param path - the raw path
|
|
@@ -37,44 +37,50 @@ function default_1(environment) {
|
|
|
37
37
|
* @param importOptions - import options
|
|
38
38
|
* @param callback - callback for when it is imported
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
push(path, tryAppendExtension, currentFileInfo, importOptions, callback) {
|
|
41
|
+
const importManager = this, pluginLoader = this.context.pluginManager.Loader;
|
|
42
|
+
|
|
42
43
|
this.queue.push(path);
|
|
43
|
-
|
|
44
|
+
|
|
45
|
+
const fileParsedFunc = function (e, root, fullPath) {
|
|
44
46
|
importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue
|
|
45
|
-
|
|
47
|
+
|
|
48
|
+
const importedEqualsRoot = fullPath === importManager.rootFilename;
|
|
46
49
|
if (importOptions.optional && e) {
|
|
47
|
-
callback(null, {
|
|
48
|
-
|
|
50
|
+
callback(null, {rules:[]}, false, null);
|
|
51
|
+
logger.info(`The file ${fullPath} was skipped because it was not found and the import was marked optional.`);
|
|
49
52
|
}
|
|
50
53
|
else {
|
|
51
54
|
// Inline imports aren't cached here.
|
|
52
55
|
// If we start to cache them, please make sure they won't conflict with non-inline imports of the
|
|
53
56
|
// same name as they used to do before this comment and the condition below have been added.
|
|
54
57
|
if (!importManager.files[fullPath] && !importOptions.inline) {
|
|
55
|
-
importManager.files[fullPath] = { root
|
|
56
|
-
}
|
|
57
|
-
if (e && !importManager.error) {
|
|
58
|
-
importManager.error = e;
|
|
58
|
+
importManager.files[fullPath] = { root, options: importOptions };
|
|
59
59
|
}
|
|
60
|
+
if (e && !importManager.error) { importManager.error = e; }
|
|
60
61
|
callback(e, root, importedEqualsRoot, fullPath);
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
+
|
|
65
|
+
const newFileInfo = {
|
|
64
66
|
rewriteUrls: this.context.rewriteUrls,
|
|
65
67
|
entryPath: currentFileInfo.entryPath,
|
|
66
68
|
rootpath: currentFileInfo.rootpath,
|
|
67
69
|
rootFilename: currentFileInfo.rootFilename
|
|
68
70
|
};
|
|
69
|
-
|
|
71
|
+
|
|
72
|
+
const fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment);
|
|
73
|
+
|
|
70
74
|
if (!fileManager) {
|
|
71
|
-
fileParsedFunc({ message:
|
|
75
|
+
fileParsedFunc({ message: `Could not find a file-manager for ${path}` });
|
|
72
76
|
return;
|
|
73
77
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
|
|
79
|
+
const loadFileCallback = function(loadedFile) {
|
|
80
|
+
let plugin;
|
|
81
|
+
const resolvedFilename = loadedFile.filename;
|
|
82
|
+
const contents = loadedFile.contents.replace(/^\uFEFF/, '');
|
|
83
|
+
|
|
78
84
|
// Pass on an updated rootpath if path of imported file is relative and file
|
|
79
85
|
// is in a (sub|sup) directory
|
|
80
86
|
//
|
|
@@ -85,90 +91,93 @@ function default_1(environment) {
|
|
|
85
91
|
// then rootpath should become 'less/../'
|
|
86
92
|
newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);
|
|
87
93
|
if (newFileInfo.rewriteUrls) {
|
|
88
|
-
newFileInfo.rootpath = fileManager.join(
|
|
94
|
+
newFileInfo.rootpath = fileManager.join(
|
|
95
|
+
(importManager.context.rootpath || ''),
|
|
96
|
+
fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
|
|
97
|
+
|
|
89
98
|
if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {
|
|
90
99
|
newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
102
|
newFileInfo.filename = resolvedFilename;
|
|
94
|
-
|
|
103
|
+
|
|
104
|
+
const newEnv = new contexts.Parse(importManager.context);
|
|
105
|
+
|
|
95
106
|
newEnv.processImports = false;
|
|
96
107
|
importManager.contents[resolvedFilename] = contents;
|
|
108
|
+
|
|
97
109
|
if (currentFileInfo.reference || importOptions.reference) {
|
|
98
110
|
newFileInfo.reference = true;
|
|
99
111
|
}
|
|
112
|
+
|
|
100
113
|
if (importOptions.isPlugin) {
|
|
101
114
|
plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo);
|
|
102
|
-
if (plugin instanceof
|
|
115
|
+
if (plugin instanceof LessError) {
|
|
103
116
|
fileParsedFunc(plugin, null, resolvedFilename);
|
|
104
117
|
}
|
|
105
118
|
else {
|
|
106
119
|
fileParsedFunc(null, plugin, resolvedFilename);
|
|
107
120
|
}
|
|
108
|
-
}
|
|
109
|
-
else if (importOptions.inline) {
|
|
121
|
+
} else if (importOptions.inline) {
|
|
110
122
|
fileParsedFunc(null, contents, resolvedFilename);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
123
|
+
} else {
|
|
113
124
|
// import (multiple) parse trees apparently get altered and can't be cached.
|
|
114
125
|
// TODO: investigate why this is
|
|
115
126
|
if (importManager.files[resolvedFilename]
|
|
116
127
|
&& !importManager.files[resolvedFilename].options.multiple
|
|
117
128
|
&& !importOptions.multiple) {
|
|
129
|
+
|
|
118
130
|
fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename);
|
|
119
131
|
}
|
|
120
132
|
else {
|
|
121
|
-
new
|
|
133
|
+
new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) {
|
|
122
134
|
fileParsedFunc(e, root, resolvedFilename);
|
|
123
135
|
});
|
|
124
136
|
}
|
|
125
137
|
}
|
|
126
138
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
let loadedFile;
|
|
140
|
+
let promise;
|
|
141
|
+
const context = utils.clone(this.context);
|
|
142
|
+
|
|
130
143
|
if (tryAppendExtension) {
|
|
131
144
|
context.ext = importOptions.isPlugin ? '.js' : '.less';
|
|
132
145
|
}
|
|
146
|
+
|
|
133
147
|
if (importOptions.isPlugin) {
|
|
134
148
|
context.mime = 'application/javascript';
|
|
149
|
+
|
|
135
150
|
if (context.syncImport) {
|
|
136
151
|
loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
152
|
+
} else {
|
|
139
153
|
promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager);
|
|
140
154
|
}
|
|
141
155
|
}
|
|
142
156
|
else {
|
|
143
157
|
if (context.syncImport) {
|
|
144
158
|
loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
});
|
|
159
|
+
} else {
|
|
160
|
+
promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment,
|
|
161
|
+
(err, loadedFile) => {
|
|
162
|
+
if (err) {
|
|
163
|
+
fileParsedFunc(err);
|
|
164
|
+
} else {
|
|
165
|
+
loadFileCallback(loadedFile);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
155
168
|
}
|
|
156
169
|
}
|
|
157
170
|
if (loadedFile) {
|
|
158
171
|
if (!loadedFile.filename) {
|
|
159
172
|
fileParsedFunc(loadedFile);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
173
|
+
} else {
|
|
162
174
|
loadFileCallback(loadedFile);
|
|
163
175
|
}
|
|
164
|
-
}
|
|
165
|
-
else if (promise) {
|
|
176
|
+
} else if (promise) {
|
|
166
177
|
promise.then(loadFileCallback, fileParsedFunc);
|
|
167
178
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
171
182
|
return ImportManager;
|
|
172
183
|
}
|
|
173
|
-
exports.default = default_1;
|
|
174
|
-
//# sourceMappingURL=import-manager.js.map
|
package/lib/less/index.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
import Environment from './environment/environment.js';
|
|
2
|
+
import data from './data/index.js';
|
|
3
|
+
import tree from './tree/index.js';
|
|
4
|
+
import AbstractFileManager from './environment/abstract-file-manager.js';
|
|
5
|
+
import AbstractPluginLoader from './environment/abstract-plugin-loader.js';
|
|
6
|
+
import visitors from './visitors/index.js';
|
|
7
|
+
import Parser from './parser/parser.js';
|
|
8
|
+
import functions from './functions/index.js';
|
|
9
|
+
import contexts from './contexts.js';
|
|
10
|
+
import LessError from './less-error.js';
|
|
11
|
+
import transformTree from './transform-tree.js';
|
|
12
|
+
import * as utils from './utils.js';
|
|
13
|
+
import PluginManager from './plugin-manager.js';
|
|
14
|
+
import logger from './logger.js';
|
|
15
|
+
import SourceMapOutput from './source-map-output.js';
|
|
16
|
+
import SourceMapBuilder from './source-map-builder.js';
|
|
17
|
+
import ParseTree from './parse-tree.js';
|
|
18
|
+
import ImportManager from './import-manager.js';
|
|
19
|
+
import Parse from './parse.js';
|
|
20
|
+
import Render from './render.js';
|
|
21
|
+
import parseVersion from 'parse-node-version';
|
|
22
|
+
|
|
23
|
+
export default function(environment, fileManagers, version = '0.0.0') {
|
|
24
|
+
let sourceMapOutput, sourceMapBuilder, parseTree, importManager;
|
|
25
|
+
|
|
26
|
+
environment = new Environment(environment, fileManagers);
|
|
27
|
+
sourceMapOutput = SourceMapOutput(environment);
|
|
28
|
+
sourceMapBuilder = SourceMapBuilder(sourceMapOutput, environment);
|
|
29
|
+
parseTree = ParseTree(sourceMapBuilder);
|
|
30
|
+
importManager = ImportManager(environment);
|
|
31
|
+
|
|
32
|
+
const render = Render(environment, parseTree, importManager);
|
|
33
|
+
const parse = Parse(environment, parseTree, importManager);
|
|
34
|
+
|
|
35
|
+
const v = parseVersion(`v${version}`);
|
|
36
|
+
const initial = {
|
|
37
37
|
version: [v.major, v.minor, v.patch],
|
|
38
|
-
data
|
|
39
|
-
tree
|
|
40
|
-
Environment
|
|
41
|
-
AbstractFileManager
|
|
42
|
-
AbstractPluginLoader
|
|
43
|
-
environment
|
|
44
|
-
visitors
|
|
45
|
-
Parser
|
|
46
|
-
functions: (
|
|
47
|
-
contexts
|
|
38
|
+
data,
|
|
39
|
+
tree,
|
|
40
|
+
Environment,
|
|
41
|
+
AbstractFileManager,
|
|
42
|
+
AbstractPluginLoader,
|
|
43
|
+
environment,
|
|
44
|
+
visitors,
|
|
45
|
+
Parser,
|
|
46
|
+
functions: functions(environment),
|
|
47
|
+
contexts,
|
|
48
48
|
SourceMapOutput: sourceMapOutput,
|
|
49
49
|
SourceMapBuilder: sourceMapBuilder,
|
|
50
50
|
ParseTree: parseTree,
|
|
51
51
|
ImportManager: importManager,
|
|
52
|
-
render
|
|
53
|
-
parse
|
|
54
|
-
LessError
|
|
55
|
-
transformTree
|
|
56
|
-
utils
|
|
57
|
-
PluginManager
|
|
58
|
-
logger
|
|
52
|
+
render,
|
|
53
|
+
parse,
|
|
54
|
+
LessError,
|
|
55
|
+
transformTree,
|
|
56
|
+
utils,
|
|
57
|
+
PluginManager,
|
|
58
|
+
logger
|
|
59
59
|
};
|
|
60
|
+
|
|
60
61
|
// Create a public API
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
t
|
|
65
|
-
return obj;
|
|
62
|
+
|
|
63
|
+
const ctor = function(t) {
|
|
64
|
+
return function(...args) {
|
|
65
|
+
return new t(...args);
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
for (
|
|
68
|
+
let t;
|
|
69
|
+
const api = Object.create(initial);
|
|
70
|
+
for (const n in initial.tree) {
|
|
71
71
|
/* eslint guard-for-in: 0 */
|
|
72
72
|
t = initial.tree[n];
|
|
73
73
|
if (typeof t === 'function') {
|
|
@@ -75,21 +75,21 @@ function default_1(environment, fileManagers) {
|
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
77
|
api[n] = Object.create(null);
|
|
78
|
-
for (
|
|
78
|
+
for (const o in t) {
|
|
79
79
|
/* eslint guard-for-in: 0 */
|
|
80
80
|
api[n][o.toLowerCase()] = ctor(t[o]);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
|
|
84
85
|
/**
|
|
85
86
|
* Some of the functions assume a `this` context of the API object,
|
|
86
87
|
* which causes it to fail when wrapped for ES6 imports.
|
|
87
|
-
*
|
|
88
|
+
*
|
|
88
89
|
* An assumed `this` should be removed in the future.
|
|
89
90
|
*/
|
|
90
91
|
initial.parse = initial.parse.bind(api);
|
|
91
92
|
initial.render = initial.render.bind(api);
|
|
93
|
+
|
|
92
94
|
return api;
|
|
93
95
|
}
|
|
94
|
-
exports.default = default_1;
|
|
95
|
-
//# sourceMappingURL=index.js.map
|
package/lib/less/less-error.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var anonymousFunc = /(<anonymous>|Function):(\d+):(\d+)/;
|
|
1
|
+
import * as utils from './utils.js';
|
|
2
|
+
|
|
3
|
+
const anonymousFunc = /(<anonymous>|Function):(\d+):(\d+)/;
|
|
4
|
+
|
|
6
5
|
/**
|
|
7
6
|
* This is a centralized class of any error that could be thrown internally (mostly by the parser).
|
|
8
7
|
* Besides standard .message it keeps some additional data like a path to the file where the error
|
|
@@ -25,26 +24,33 @@ var anonymousFunc = /(<anonymous>|Function):(\d+):(\d+)/;
|
|
|
25
24
|
* @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager?
|
|
26
25
|
* @param {string} [currentFilename]
|
|
27
26
|
*/
|
|
28
|
-
|
|
27
|
+
const LessError = function(e, fileContentMap, currentFilename) {
|
|
29
28
|
Error.call(this);
|
|
30
|
-
|
|
29
|
+
|
|
30
|
+
const filename = e.filename || currentFilename;
|
|
31
|
+
|
|
31
32
|
this.message = e.message;
|
|
32
33
|
this.stack = e.stack;
|
|
34
|
+
|
|
33
35
|
// Set type early so it's always available, even if fileContentMap is missing
|
|
34
36
|
this.type = e.type || 'Syntax';
|
|
37
|
+
|
|
35
38
|
if (fileContentMap && filename) {
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
const input = fileContentMap.contents[filename];
|
|
40
|
+
const loc = utils.getLocation(e.index, input);
|
|
38
41
|
var line = loc.line;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const col = loc.column;
|
|
43
|
+
const callLine = e.call && utils.getLocation(e.call, input).line;
|
|
44
|
+
const lines = input ? input.split('\n') : '';
|
|
45
|
+
|
|
42
46
|
this.filename = filename;
|
|
43
47
|
this.index = e.index;
|
|
44
48
|
this.line = typeof line === 'number' ? line + 1 : null;
|
|
45
49
|
this.column = col;
|
|
50
|
+
|
|
46
51
|
if (!this.line && this.stack) {
|
|
47
|
-
|
|
52
|
+
const found = this.stack.match(anonymousFunc);
|
|
53
|
+
|
|
48
54
|
/**
|
|
49
55
|
* We have to figure out how this environment stringifies anonymous functions
|
|
50
56
|
* so we can correctly map plugin errors.
|
|
@@ -52,15 +58,15 @@ var LessError = function (e, fileContentMap, currentFilename) {
|
|
|
52
58
|
* Note, in Node 8, the output of anonymous funcs varied based on parameters
|
|
53
59
|
* being present or not, so we inject dummy params.
|
|
54
60
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
const func = new Function('a', 'throw new Error()');
|
|
62
|
+
let lineAdjust = 0;
|
|
57
63
|
try {
|
|
58
64
|
func();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
var match = e.stack.match(anonymousFunc);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
const match = e.stack.match(anonymousFunc);
|
|
62
67
|
lineAdjust = 1 - parseInt(match[2]);
|
|
63
68
|
}
|
|
69
|
+
|
|
64
70
|
if (found) {
|
|
65
71
|
if (found[2]) {
|
|
66
72
|
this.line = parseInt(found[2]) + lineAdjust;
|
|
@@ -70,24 +76,29 @@ var LessError = function (e, fileContentMap, currentFilename) {
|
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
}
|
|
79
|
+
|
|
73
80
|
this.callLine = callLine + 1;
|
|
74
81
|
this.callExtract = lines[callLine];
|
|
82
|
+
|
|
75
83
|
this.extract = [
|
|
76
84
|
lines[this.line - 2],
|
|
77
85
|
lines[this.line - 1],
|
|
78
86
|
lines[this.line]
|
|
79
87
|
];
|
|
80
88
|
}
|
|
89
|
+
|
|
81
90
|
};
|
|
91
|
+
|
|
82
92
|
if (typeof Object.create === 'undefined') {
|
|
83
|
-
|
|
93
|
+
const F = function () {};
|
|
84
94
|
F.prototype = Error.prototype;
|
|
85
95
|
LessError.prototype = new F();
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
96
|
+
} else {
|
|
88
97
|
LessError.prototype = Object.create(Error.prototype);
|
|
89
98
|
}
|
|
99
|
+
|
|
90
100
|
LessError.prototype.constructor = LessError;
|
|
101
|
+
|
|
91
102
|
/**
|
|
92
103
|
* An overridden version of the default Object.prototype.toString
|
|
93
104
|
* which uses additional information to create a helpful message.
|
|
@@ -95,54 +106,61 @@ LessError.prototype.constructor = LessError;
|
|
|
95
106
|
* @param {Object} options
|
|
96
107
|
* @returns {string}
|
|
97
108
|
*/
|
|
98
|
-
LessError.prototype.toString = function
|
|
99
|
-
var _a;
|
|
109
|
+
LessError.prototype.toString = function(options) {
|
|
100
110
|
options = options || {};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
const isWarning = (this.type ?? '').toLowerCase().includes('warning');
|
|
112
|
+
const type = isWarning ? this.type : `${this.type}Error`;
|
|
113
|
+
const color = isWarning ? 'yellow' : 'red';
|
|
114
|
+
|
|
115
|
+
let message = '';
|
|
116
|
+
const extract = this.extract || [];
|
|
117
|
+
let error = [];
|
|
118
|
+
let stylize = function (str) { return str; };
|
|
108
119
|
if (options.stylize) {
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
throw Error(
|
|
120
|
+
const type = typeof options.stylize;
|
|
121
|
+
if (type !== 'function') {
|
|
122
|
+
throw Error(`options.stylize should be a function, got a ${type}!`);
|
|
112
123
|
}
|
|
113
124
|
stylize = options.stylize;
|
|
114
125
|
}
|
|
126
|
+
|
|
115
127
|
if (this.line !== null) {
|
|
116
128
|
if (!isWarning && typeof extract[0] === 'string') {
|
|
117
|
-
error.push(stylize(
|
|
129
|
+
error.push(stylize(`${this.line - 1} ${extract[0]}`, 'grey'));
|
|
118
130
|
}
|
|
131
|
+
|
|
119
132
|
if (typeof extract[1] === 'string') {
|
|
120
|
-
|
|
133
|
+
let errorTxt = `${this.line} `;
|
|
121
134
|
if (extract[1]) {
|
|
122
135
|
errorTxt += extract[1].slice(0, this.column) +
|
|
123
|
-
stylize(stylize(stylize(extract[1].
|
|
136
|
+
stylize(stylize(stylize(extract[1].slice(this.column, this.column + 1), 'bold') +
|
|
124
137
|
extract[1].slice(this.column + 1), 'red'), 'inverse');
|
|
125
138
|
}
|
|
126
139
|
error.push(errorTxt);
|
|
127
140
|
}
|
|
141
|
+
|
|
128
142
|
if (!isWarning && typeof extract[2] === 'string') {
|
|
129
|
-
error.push(stylize(
|
|
143
|
+
error.push(stylize(`${this.line + 1} ${extract[2]}`, 'grey'));
|
|
130
144
|
}
|
|
131
|
-
error =
|
|
145
|
+
error = `${error.join('\n') + stylize('', 'reset')}\n`;
|
|
132
146
|
}
|
|
133
|
-
|
|
147
|
+
|
|
148
|
+
message += stylize(`${type}: ${this.message}`, color);
|
|
134
149
|
if (this.filename) {
|
|
135
150
|
message += stylize(' in ', color) + this.filename;
|
|
136
151
|
}
|
|
137
152
|
if (this.line) {
|
|
138
|
-
message += stylize(
|
|
153
|
+
message += stylize(` on line ${this.line}, column ${this.column + 1}:`, 'grey');
|
|
139
154
|
}
|
|
140
|
-
|
|
155
|
+
|
|
156
|
+
message += `\n${error}`;
|
|
157
|
+
|
|
141
158
|
if (this.callLine) {
|
|
142
|
-
message +=
|
|
143
|
-
message +=
|
|
159
|
+
message += `${stylize('from ', color) + (this.filename || '')}/n`;
|
|
160
|
+
message += `${stylize(this.callLine, 'grey')} ${this.callExtract}/n`;
|
|
144
161
|
}
|
|
162
|
+
|
|
145
163
|
return message;
|
|
146
164
|
};
|
|
147
|
-
|
|
148
|
-
|
|
165
|
+
|
|
166
|
+
export default LessError;
|
package/lib/less/logger.js
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.default = {
|
|
4
|
-
error: function (msg) {
|
|
1
|
+
export default {
|
|
2
|
+
error: function(msg) {
|
|
5
3
|
this._fireEvent('error', msg);
|
|
6
4
|
},
|
|
7
|
-
warn: function
|
|
5
|
+
warn: function(msg) {
|
|
8
6
|
this._fireEvent('warn', msg);
|
|
9
7
|
},
|
|
10
|
-
info: function
|
|
8
|
+
info: function(msg) {
|
|
11
9
|
this._fireEvent('info', msg);
|
|
12
10
|
},
|
|
13
|
-
debug: function
|
|
11
|
+
debug: function(msg) {
|
|
14
12
|
this._fireEvent('debug', msg);
|
|
15
13
|
},
|
|
16
|
-
addListener: function
|
|
14
|
+
addListener: function(listener) {
|
|
17
15
|
this._listeners.push(listener);
|
|
18
16
|
},
|
|
19
|
-
removeListener: function
|
|
20
|
-
for (
|
|
17
|
+
removeListener: function(listener) {
|
|
18
|
+
for (let i = 0; i < this._listeners.length; i++) {
|
|
21
19
|
if (this._listeners[i] === listener) {
|
|
22
20
|
this._listeners.splice(i, 1);
|
|
23
21
|
return;
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
24
|
},
|
|
27
|
-
_fireEvent: function
|
|
28
|
-
for (
|
|
29
|
-
|
|
25
|
+
_fireEvent: function(type, msg) {
|
|
26
|
+
for (let i = 0; i < this._listeners.length; i++) {
|
|
27
|
+
const logFunction = this._listeners[i][type];
|
|
30
28
|
if (logFunction) {
|
|
31
29
|
logFunction(msg);
|
|
32
30
|
}
|
|
@@ -34,4 +32,3 @@ exports.default = {
|
|
|
34
32
|
},
|
|
35
33
|
_listeners: []
|
|
36
34
|
};
|
|
37
|
-
//# sourceMappingURL=logger.js.map
|