less 4.4.1 → 4.5.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/Gruntfile.js +16 -17
- package/bin/lessc +35 -40
- package/dist/less.js +125 -186
- package/dist/less.min.js +2 -2
- package/dist/less.min.js.map +1 -1
- package/lib/less/contexts.js +0 -1
- package/lib/less/contexts.js.map +1 -1
- package/lib/less/default-options.js +22 -3
- package/lib/less/default-options.js.map +1 -1
- package/lib/less/less-error.js +2 -1
- package/lib/less/less-error.js.map +1 -1
- package/lib/less/parse-tree.js +58 -1
- package/lib/less/parse-tree.js.map +1 -1
- package/lib/less/parser/parser-input.js +2 -19
- package/lib/less/parser/parser-input.js.map +1 -1
- package/lib/less/parser/parser.js +8 -14
- package/lib/less/parser/parser.js.map +1 -1
- package/lib/less/source-map-output.js +1 -1
- package/lib/less/source-map-output.js.map +1 -1
- package/lib/less/tree/debug-info.js +29 -0
- package/lib/less/tree/debug-info.js.map +1 -1
- package/lib/less/tree/nested-at-rule.js +1 -1
- package/lib/less/tree/nested-at-rule.js.map +1 -1
- package/lib/less-node/lessc-helper.js +8 -7
- package/lib/less-node/lessc-helper.js.map +1 -1
- package/package.json +10 -5
- package/scripts/coverage-lines.js +207 -0
- package/scripts/coverage-report.js +158 -0
- package/scripts/postinstall.js +61 -0
- package/test/browser/common.js +22 -1
- package/test/browser/generator/runner.config.js +20 -24
- package/test/browser/generator/template.js +14 -3
- package/test/browser/runner-browser-options.js +5 -5
- package/test/index.js +293 -98
- package/test/less-test.js +453 -94
- package/test/sourcemaps/comprehensive.json +1 -0
- package/test/sourcemaps/sourcemaps-basepath.json +1 -0
- package/test/sourcemaps/sourcemaps-include-source.json +1 -0
- package/test/sourcemaps/sourcemaps-rootpath.json +1 -0
- package/test/sourcemaps/sourcemaps-url.json +1 -0
- package/test.less +1 -0
- package/tsconfig.json +20 -20
- package/lib/less/parser/chunker.js +0 -148
- package/lib/less/parser/chunker.js.map +0 -1
- package/test/browser/runner-legacy-options.js +0 -6
- package/test/browser/runner-legacy-spec.js +0 -3
package/lib/less/contexts.js
CHANGED
package/lib/less/contexts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.js","sourceRoot":"","sources":["../../src/less/contexts.js"],"names":[],"mappings":";;;AAAA,IAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,kBAAe,QAAQ,CAAC;AACxB,6DAAyC;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,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE;YACrE,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;SACpE;KACJ;AACL,CAAC,CAAC;AAEF;;GAEG;AACH,IAAM,mBAAmB,GAAG;IACxB,UAAU;IACV,OAAO;IACP,aAAa;IACb,UAAU;IACV,eAAe;IACf,UAAU;IACV,iBAAiB;IACjB,UAAU;IACV,YAAY;IACZ,
|
|
1
|
+
{"version":3,"file":"contexts.js","sourceRoot":"","sources":["../../src/less/contexts.js"],"names":[],"mappings":";;;AAAA,IAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,kBAAe,QAAQ,CAAC;AACxB,6DAAyC;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,CA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AAa,GAAG,UAAU,IAAI;IAClD,IAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3C,IAAI,OAAO,CAAC;IAEZ,IAAI,GAAG,EAAE,CAAC;IACV,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;QACzB,QAAS,OAAO,EAAG;YACf,KAAK,GAAG;gBACJ,MAAM;YACV,KAAK,IAAI;gBACL,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE;oBACzD,IAAI,CAAC,IAAI,CAAE,OAAO,CAAE,CAAC;iBACxB;qBAAM;oBACH,IAAI,CAAC,GAAG,EAAE,CAAC;iBACd;gBACD,MAAM;YACV;gBACI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACnB,MAAM;SACb;KACJ;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,SAAS,cAAc,CAAC,IAAI;IACxB,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAI;IAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAClC,CAAC;AAED,qCAAqC","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 (Object.prototype.hasOwnProperty.call(original, 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 - @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. All modes ('comments', 'mediaquery', 'all') will be removed in a future version.\n 'compress', // option - whether to compress\n 'syncImport', // option - whether to import synchronously\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 'quiet', // option - whether to log warnings\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\ncontexts.Eval = function(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};\n\ncontexts.Eval.prototype.enterCalc = function () {\n if (!this.calcStack) {\n this.calcStack = [];\n }\n this.calcStack.push(true);\n this.inCalc = true;\n};\n\ncontexts.Eval.prototype.exitCalc = function () {\n this.calcStack.pop();\n if (!this.calcStack.length) {\n this.inCalc = false;\n }\n};\n\ncontexts.Eval.prototype.inParenthesis = function () {\n if (!this.parensStack) {\n this.parensStack = [];\n }\n this.parensStack.push(true);\n};\n\ncontexts.Eval.prototype.outOfParenthesis = function () {\n this.parensStack.pop();\n};\n\ncontexts.Eval.prototype.inCalc = false;\ncontexts.Eval.prototype.mathOn = true;\ncontexts.Eval.prototype.isMathOn = function (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\ncontexts.Eval.prototype.pathRequiresRewrite = function (path) {\n const isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;\n\n return isRelative(path);\n};\n\ncontexts.Eval.prototype.rewritePath = function (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\ncontexts.Eval.prototype.normalizePath = function (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\nfunction isPathRelative(path) {\n return !/^(?:[a-z-]+:|\\/|#)/i.test(path);\n}\n\nfunction isPathLocalRelative(path) {\n return path.charAt(0) === '.';\n}\n\n// todo - do the same for the toCSS ?\n"]}
|
|
@@ -21,9 +21,28 @@ function default_1() {
|
|
|
21
21
|
paths: [],
|
|
22
22
|
/* color output in the terminal */
|
|
23
23
|
color: true,
|
|
24
|
-
|
|
25
|
-
* @
|
|
26
|
-
*
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated This option has confusing behavior and may be removed in a future version.
|
|
26
|
+
*
|
|
27
|
+
* When true, prevents @import statements for .less files from being evaluated inside
|
|
28
|
+
* selector blocks (rulesets). The imports are silently ignored and not output.
|
|
29
|
+
*
|
|
30
|
+
* Behavior:
|
|
31
|
+
* - @import at root level: Always processed
|
|
32
|
+
* - @import inside @-rules (@media, @supports, etc.): Processed (these are not selector blocks)
|
|
33
|
+
* - @import inside selector blocks (.class, #id, etc.): NOT processed (silently ignored)
|
|
34
|
+
*
|
|
35
|
+
* When false (default): All @import statements are processed regardless of context.
|
|
36
|
+
*
|
|
37
|
+
* Note: Despite the name "strict", this option does NOT throw an error when imports
|
|
38
|
+
* are used in selector blocks - it silently ignores them. This is confusing
|
|
39
|
+
* behavior that may catch users off guard.
|
|
40
|
+
*
|
|
41
|
+
* Note: Only affects .less file imports. CSS imports (url(...) or .css files) are
|
|
42
|
+
* always output as CSS @import statements regardless of this setting.
|
|
43
|
+
*
|
|
44
|
+
* @see https://github.com/less/less.js/issues/656
|
|
45
|
+
*/
|
|
27
46
|
strictImports: false,
|
|
28
47
|
/* Allow Imports from Insecure HTTPS Hosts */
|
|
29
48
|
insecure: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-options.js","sourceRoot":"","sources":["../../src/less/default-options.js"],"names":[],"mappings":";;AAAA,iCAAiC;AACjC;IACI,OAAO;QACH,+CAA+C;QAC/C,iBAAiB,EAAE,KAAK;QAExB,0DAA0D;QAC1D,OAAO,EAAE,KAAK;QAEd;;wCAEgC;QAChC,QAAQ,EAAE,KAAK;QAEf,sEAAsE;QACtE,IAAI,EAAE,KAAK;QAEX;;;;gFAIwE;QACxE,KAAK,EAAE,EAAE;QAET,kCAAkC;QAClC,KAAK,EAAE,IAAI;QAEX
|
|
1
|
+
{"version":3,"file":"default-options.js","sourceRoot":"","sources":["../../src/less/default-options.js"],"names":[],"mappings":";;AAAA,iCAAiC;AACjC;IACI,OAAO;QACH,+CAA+C;QAC/C,iBAAiB,EAAE,KAAK;QAExB,0DAA0D;QAC1D,OAAO,EAAE,KAAK;QAEd;;wCAEgC;QAChC,QAAQ,EAAE,KAAK;QAEf,sEAAsE;QACtE,IAAI,EAAE,KAAK;QAEX;;;;gFAIwE;QACxE,KAAK,EAAE,EAAE;QAET,kCAAkC;QAClC,KAAK,EAAE,IAAI;QAEX;;;;;;;;;;;;;;;;;;;;;WAqBG;QACH,aAAa,EAAE,KAAK;QAEpB,6CAA6C;QAC7C,QAAQ,EAAE,KAAK;QAEf;;8CAEsC;QACtC,QAAQ,EAAE,EAAE;QAEZ;;;8DAGsD;QACtD,WAAW,EAAE,KAAK;QAElB;;;;;WAKG;QACH,IAAI,EAAE,CAAC;QAEP,wFAAwF;QACxF,WAAW,EAAE,KAAK;QAElB;;qCAE6B;QAC7B,UAAU,EAAE,IAAI;QAEhB;iGACyF;QACzF,UAAU,EAAE,IAAI;QAEhB,0EAA0E;QAC1E,OAAO,EAAE,EAAE;KACd,CAAA;AACL,CAAC;AAvFD,4BAuFC","sourcesContent":["// Export a new default each time\nexport default function() {\n return {\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 /**\n * @deprecated This option has confusing behavior and may be removed in a future version.\n * \n * When true, prevents @import statements for .less files from being evaluated inside\n * selector blocks (rulesets). The imports are silently ignored and not output.\n * \n * Behavior:\n * - @import at root level: Always processed\n * - @import inside @-rules (@media, @supports, etc.): Processed (these are not selector blocks)\n * - @import inside selector blocks (.class, #id, etc.): NOT processed (silently ignored)\n * \n * When false (default): All @import statements are processed regardless of context.\n * \n * Note: Despite the name \"strict\", this option does NOT throw an error when imports\n * are used in selector blocks - it silently ignores them. This is confusing\n * behavior that may catch users off guard.\n * \n * Note: Only affects .less file imports. CSS imports (url(...) or .css files) are\n * always output as CSS @import statements regardless of this setting.\n * \n * @see https://github.com/less/less.js/issues/656\n */\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: 1,\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 }\n}"]}
|
package/lib/less/less-error.js
CHANGED
|
@@ -30,6 +30,8 @@ var LessError = function (e, fileContentMap, currentFilename) {
|
|
|
30
30
|
var filename = e.filename || currentFilename;
|
|
31
31
|
this.message = e.message;
|
|
32
32
|
this.stack = e.stack;
|
|
33
|
+
// Set type early so it's always available, even if fileContentMap is missing
|
|
34
|
+
this.type = e.type || 'Syntax';
|
|
33
35
|
if (fileContentMap && filename) {
|
|
34
36
|
var input = fileContentMap.contents[filename];
|
|
35
37
|
var loc = utils.getLocation(e.index, input);
|
|
@@ -37,7 +39,6 @@ var LessError = function (e, fileContentMap, currentFilename) {
|
|
|
37
39
|
var col = loc.column;
|
|
38
40
|
var callLine = e.call && utils.getLocation(e.call, input).line;
|
|
39
41
|
var lines = input ? input.split('\n') : '';
|
|
40
|
-
this.type = e.type || 'Syntax';
|
|
41
42
|
this.filename = filename;
|
|
42
43
|
this.index = e.index;
|
|
43
44
|
this.line = typeof line === 'number' ? line + 1 : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"less-error.js","sourceRoot":"","sources":["../../src/less/less-error.js"],"names":[],"mappings":";;;AAAA,qDAAiC;AAEjC,IAAM,aAAa,GAAG,oCAAoC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,IAAM,SAAS,GAAG,UAAS,CAAC,EAAE,cAAc,EAAE,eAAe;IACzD,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,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACpB,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,C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OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YAC9C,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAG,IAAI,CAAC,IAAI,GAAG,CAAC,cAAI,OAAO,CAAC,CAAC,CAAC,CAAE,EAAE,MAAM,CAAC,CAAC,CAAC;SACjE;QACD,KAAK,GAAG,UAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,OAAI,CAAC;KAC1D;IAED,OAAO,IAAI,OAAO,CAAC,UAAG,IAAI,eAAK,IAAI,CAAC,OAAO,CAAE,EAAE,KAAK,CAAC,CAAC;IACtD,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,mBAAY,IAAI,CAAC,IAAI,sBAAY,IAAI,CAAC,MAAM,GAAG,CAAC,MAAG,EAAE,MAAM,CAAC,CAAC;KACnF;IAED,OAAO,IAAI,YAAK,KAAK,CAAE,CAAC;IAExB,IAAI,IAAI,CAAC,QAAQ,EAAE;QACf,OAAO,IAAI,UAAG,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,OAAI,CAAC;QAClE,OAAO,IAAI,UAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,cAAI,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 = /(<anonymous>|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(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 var 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 lineAdjust = 1 - parseInt(match[2]);\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 = function () {};\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 options = options || {};\n const isWarning = (this.type ?? '').toLowerCase().includes('warning');\n const type = isWarning ? this.type : `${this.type}Error`;\n const color = isWarning ? 'yellow' : 'red';\n\n let message = '';\n const extract = this.extract || [];\n let error = [];\n let stylize = function (str) { return 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 (!isWarning && 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 (!isWarning && 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(`${type}: ${this.message}`, color);\n if (this.filename) {\n message += stylize(' in ', color) + 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 ', color) + (this.filename || '')}/n`;\n message += `${stylize(this.callLine, 'grey')} ${this.callExtract}/n`;\n }\n\n return message;\n};\n\nexport default LessError;"]}
|
|
1
|
+
{"version":3,"file":"less-error.js","sourceRoot":"","sources":["../../src/less/less-error.js"],"names":[],"mappings":";;;AAAA,qDAAiC;AAEjC,IAAM,aAAa,GAAG,oCAAoC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,IAAM,SAAS,GAAG,UAAS,CAAC,EAAE,cAAc,EAAE,eAAe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I,CAAC,QAAQ,CAAC;KACrD;IACD,IAAI,IAAI,CAAC,IAAI,EAAE;QACX,OAAO,IAAI,OAAO,CAAC,mBAAY,IAAI,CAAC,IAAI,sBAAY,IAAI,CAAC,MAAM,GAAG,CAAC,MAAG,EAAE,MAAM,CAAC,CAAC;KACnF;IAED,OAAO,IAAI,YAAK,KAAK,CAAE,CAAC;IAExB,IAAI,IAAI,CAAC,QAAQ,EAAE;QACf,OAAO,IAAI,UAAG,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,OAAI,CAAC;QAClE,OAAO,IAAI,UAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,cAAI,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 = /(<anonymous>|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(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 // Set type early so it's always available, even if fileContentMap is missing\n this.type = e.type || 'Syntax';\n\n if (fileContentMap && filename) {\n const input = fileContentMap.contents[filename];\n const loc = utils.getLocation(e.index, input);\n var 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.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 lineAdjust = 1 - parseInt(match[2]);\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 = function () {};\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 options = options || {};\n const isWarning = (this.type ?? '').toLowerCase().includes('warning');\n const type = isWarning ? this.type : `${this.type}Error`;\n const color = isWarning ? 'yellow' : 'red';\n\n let message = '';\n const extract = this.extract || [];\n let error = [];\n let stylize = function (str) { return 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 (!isWarning && 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 (!isWarning && 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(`${type}: ${this.message}`, color);\n if (this.filename) {\n message += stylize(' in ', color) + 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 ', color) + (this.filename || '')}/n`;\n message += `${stylize(this.callLine, 'grey')} ${this.callExtract}/n`;\n }\n\n return message;\n};\n\nexport default LessError;"]}
|
package/lib/less/parse-tree.js
CHANGED
|
@@ -28,12 +28,69 @@ function default_1(SourceMapBuilder) {
|
|
|
28
28
|
}
|
|
29
29
|
var toCSSOptions = {
|
|
30
30
|
compress: compress,
|
|
31
|
+
// @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. All modes will be removed in a future version.
|
|
31
32
|
dumpLineNumbers: options.dumpLineNumbers,
|
|
32
33
|
strictUnits: Boolean(options.strictUnits),
|
|
33
34
|
numPrecision: 8
|
|
34
35
|
};
|
|
35
36
|
if (options.sourceMap) {
|
|
36
|
-
|
|
37
|
+
// Normalize sourceMap option: if it's just true, convert to object
|
|
38
|
+
if (options.sourceMap === true) {
|
|
39
|
+
options.sourceMap = {};
|
|
40
|
+
}
|
|
41
|
+
var sourceMapOpts = options.sourceMap;
|
|
42
|
+
// Set sourceMapInputFilename if not set and filename is available
|
|
43
|
+
if (!sourceMapOpts.sourceMapInputFilename && options.filename) {
|
|
44
|
+
sourceMapOpts.sourceMapInputFilename = options.filename;
|
|
45
|
+
}
|
|
46
|
+
// Default sourceMapBasepath to the input file's directory if not set
|
|
47
|
+
// This matches the behavior documented and implemented in bin/lessc
|
|
48
|
+
if (sourceMapOpts.sourceMapBasepath === undefined && options.filename) {
|
|
49
|
+
// Get directory from filename using string manipulation (works cross-platform)
|
|
50
|
+
var lastSlash = Math.max(options.filename.lastIndexOf('/'), options.filename.lastIndexOf('\\'));
|
|
51
|
+
if (lastSlash >= 0) {
|
|
52
|
+
sourceMapOpts.sourceMapBasepath = options.filename.substring(0, lastSlash);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// No directory separator found, use current directory
|
|
56
|
+
sourceMapOpts.sourceMapBasepath = '.';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Handle sourceMapFullFilename (CLI-specific: --source-map=filename)
|
|
60
|
+
// This is converted to sourceMapFilename and sourceMapOutputFilename
|
|
61
|
+
if (sourceMapOpts.sourceMapFullFilename && !sourceMapOpts.sourceMapFileInline) {
|
|
62
|
+
// This case is handled by lessc before calling render
|
|
63
|
+
// We just need to ensure sourceMapFilename is set if sourceMapFullFilename is provided
|
|
64
|
+
if (!sourceMapOpts.sourceMapFilename && !sourceMapOpts.sourceMapURL) {
|
|
65
|
+
// Extract just the basename for the sourceMappingURL comment
|
|
66
|
+
var mapBase = sourceMapOpts.sourceMapFullFilename.split(/[/\\]/).pop();
|
|
67
|
+
sourceMapOpts.sourceMapFilename = mapBase;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (!sourceMapOpts.sourceMapFilename && !sourceMapOpts.sourceMapURL) {
|
|
71
|
+
// If sourceMapFilename is not set and sourceMapURL is not set,
|
|
72
|
+
// derive it from the output filename (if available) or input filename
|
|
73
|
+
if (sourceMapOpts.sourceMapOutputFilename) {
|
|
74
|
+
// Use output filename + .map
|
|
75
|
+
sourceMapOpts.sourceMapFilename = sourceMapOpts.sourceMapOutputFilename + '.map';
|
|
76
|
+
}
|
|
77
|
+
else if (options.filename) {
|
|
78
|
+
// Fallback to input filename + .css.map
|
|
79
|
+
var inputBase = options.filename.replace(/\.[^/.]+$/, '');
|
|
80
|
+
sourceMapOpts.sourceMapFilename = inputBase + '.css.map';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Default sourceMapOutputFilename if not set
|
|
84
|
+
if (!sourceMapOpts.sourceMapOutputFilename) {
|
|
85
|
+
if (options.filename) {
|
|
86
|
+
var inputBase = options.filename.replace(/\.[^/.]+$/, '');
|
|
87
|
+
sourceMapOpts.sourceMapOutputFilename = inputBase + '.css';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
sourceMapOpts.sourceMapOutputFilename = 'output.css';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
sourceMapBuilder = new SourceMapBuilder(sourceMapOpts);
|
|
37
94
|
result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports);
|
|
38
95
|
}
|
|
39
96
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-tree.js","sourceRoot":"","sources":["../../src/less/parse-tree.js"],"names":[],"mappings":";;;AAAA,oEAAqC;AACrC,4EAA6C;AAC7C,4DAA8B;AAE9B,mBAAwB,gBAAgB;IACpC;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,IAAA,wBAAa,EAAC,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,QA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AAG,EAAE,CAAC;YACpB,KAAK,IAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;gBACnC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;oBACtG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC7B;aACJ;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QACL,gBAAC;IAAD,CAAC,AAzDD,IAyDC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AA7DD,4BA6DC","sourcesContent":["import LessError from './less-error';\nimport transformTree from './transform-tree';\nimport logger from './logger';\n\nexport default function(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 result.imports = [];\n for (const file in this.imports.files) {\n if (Object.prototype.hasOwnProperty.call(this.imports.files, file) && file !== this.imports.rootFilename) {\n result.imports.push(file);\n }\n }\n return result;\n }\n }\n\n return ParseTree;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parse-tree.js","sourceRoot":"","sources":["../../src/less/parse-tree.js"],"names":[],"mappings":";;;AAAA,oEAAqC;AACrC,4EAA6C;AAC7C,4DAA8B;AAE9B,mBAAwB,gBAAgB;IACpC;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,IAAA,wBAAa,EAAC,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,gBAAM,CAAC,IAAI,CAAC,2CAA2C;wBACnD,wFAAwF,CAAC,CAAC;iBACjG;gBAED,IAAM,YAAY,GAAG;oBACjB,QAAQ,UAAA;oBACR,+HAA+H;oBAC/H,eAAe,EAAE,OAAO,CAAC,eAAe;oBACxC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;oBACzC,YAAY,EAAE,CAAC;iBAAC,CAAC;gBAErB,IAAI,OAAO,CAAC,SAAS,EAAE;oBACnB,mEAAmE;oBACnE,IAAI,OAAO,CAAC,SAAS,KA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,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC5C,MAAM,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,SAAA,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;iBACvH;aACJ;YACD,IAAI,OAAO,CAAC,SAAS,EAAE;gBACnB,MAAM,CAAC,GAAG,GAAG,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;aACxD;YAED,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;YACpB,KAAK,IAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;gBACnC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;oBACtG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC7B;aACJ;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QACL,gBAAC;IAAD,CAAC,AAnHD,IAmHC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAvHD,4BAuHC","sourcesContent":["import LessError from './less-error';\nimport transformTree from './transform-tree';\nimport logger from './logger';\n\nexport default function(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 // @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. All modes will be removed in a future version.\n dumpLineNumbers: options.dumpLineNumbers,\n strictUnits: Boolean(options.strictUnits),\n numPrecision: 8};\n\n if (options.sourceMap) {\n // Normalize sourceMap option: if it's just true, convert to object\n if (options.sourceMap === true) {\n options.sourceMap = {};\n }\n const sourceMapOpts = options.sourceMap;\n \n // Set sourceMapInputFilename if not set and filename is available\n if (!sourceMapOpts.sourceMapInputFilename && options.filename) {\n sourceMapOpts.sourceMapInputFilename = options.filename;\n }\n \n // Default sourceMapBasepath to the input file's directory if not set\n // This matches the behavior documented and implemented in bin/lessc\n if (sourceMapOpts.sourceMapBasepath === undefined && options.filename) {\n // Get directory from filename using string manipulation (works cross-platform)\n const lastSlash = Math.max(options.filename.lastIndexOf('/'), options.filename.lastIndexOf('\\\\'));\n if (lastSlash >= 0) {\n sourceMapOpts.sourceMapBasepath = options.filename.substring(0, lastSlash);\n } else {\n // No directory separator found, use current directory\n sourceMapOpts.sourceMapBasepath = '.';\n }\n }\n \n // Handle sourceMapFullFilename (CLI-specific: --source-map=filename)\n // This is converted to sourceMapFilename and sourceMapOutputFilename\n if (sourceMapOpts.sourceMapFullFilename && !sourceMapOpts.sourceMapFileInline) {\n // This case is handled by lessc before calling render\n // We just need to ensure sourceMapFilename is set if sourceMapFullFilename is provided\n if (!sourceMapOpts.sourceMapFilename && !sourceMapOpts.sourceMapURL) {\n // Extract just the basename for the sourceMappingURL comment\n const mapBase = sourceMapOpts.sourceMapFullFilename.split(/[/\\\\]/).pop();\n sourceMapOpts.sourceMapFilename = mapBase;\n }\n } else if (!sourceMapOpts.sourceMapFilename && !sourceMapOpts.sourceMapURL) {\n // If sourceMapFilename is not set and sourceMapURL is not set,\n // derive it from the output filename (if available) or input filename\n if (sourceMapOpts.sourceMapOutputFilename) {\n // Use output filename + .map\n sourceMapOpts.sourceMapFilename = sourceMapOpts.sourceMapOutputFilename + '.map';\n } else if (options.filename) {\n // Fallback to input filename + .css.map\n const inputBase = options.filename.replace(/\\.[^/.]+$/, '');\n sourceMapOpts.sourceMapFilename = inputBase + '.css.map';\n }\n }\n \n // Default sourceMapOutputFilename if not set\n if (!sourceMapOpts.sourceMapOutputFilename) {\n if (options.filename) {\n const inputBase = options.filename.replace(/\\.[^/.]+$/, '');\n sourceMapOpts.sourceMapOutputFilename = inputBase + '.css';\n } else {\n sourceMapOpts.sourceMapOutputFilename = 'output.css';\n }\n }\n \n sourceMapBuilder = new SourceMapBuilder(sourceMapOpts);\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 result.imports = [];\n for (const file in this.imports.files) {\n if (Object.prototype.hasOwnProperty.call(this.imports.files, file) && file !== this.imports.rootFilename) {\n result.imports.push(file);\n }\n }\n return result;\n }\n }\n\n return ParseTree;\n}\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var chunker_1 = tslib_1.__importDefault(require("./chunker"));
|
|
5
3
|
exports.default = (function () {
|
|
6
4
|
var // Less input string
|
|
7
5
|
input;
|
|
@@ -317,25 +315,10 @@ exports.default = (function () {
|
|
|
317
315
|
// Is the first char of the dimension 0-9, '.', '+' or '-'
|
|
318
316
|
return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA;
|
|
319
317
|
};
|
|
320
|
-
parserInput.start = function (str
|
|
318
|
+
parserInput.start = function (str) {
|
|
321
319
|
input = str;
|
|
322
320
|
parserInput.i = j = currentPos = furthest = 0;
|
|
323
|
-
|
|
324
|
-
// it might actually make things slower in node at least)
|
|
325
|
-
// and it is a non-perfect parse - it can't recognise
|
|
326
|
-
// unquoted urls, meaning it can't distinguish comments
|
|
327
|
-
// meaning comments with quotes or {}() in them get 'counted'
|
|
328
|
-
// and then lead to parse errors.
|
|
329
|
-
// In addition if the chunking chunks in the wrong place we might
|
|
330
|
-
// not be able to parse a parser statement in one go
|
|
331
|
-
// this is officially deprecated but can be switched on via an option
|
|
332
|
-
// in the case it causes too much performance issues.
|
|
333
|
-
if (chunkInput) {
|
|
334
|
-
chunks = (0, chunker_1.default)(str, failFunction);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
chunks = [str];
|
|
338
|
-
}
|
|
321
|
+
chunks = [str];
|
|
339
322
|
current = chunks[0];
|
|
340
323
|
skipWhitespace(0);
|
|
341
324
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-input.js","sourceRoot":"","sources":["../../../src/less/parser/parser-input.js"],"names":[],"mappings":";;;AAAA,8DAAgC;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,IA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vB,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.$peekChar = tok => {\n if (input.charAt(parserInput.i) !== tok) {\n return null;\n }\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 }\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 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 }\n i++;\n if (i > length) {\n loop = false;\n }\n }\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"]}
|
|
1
|
+
{"version":3,"file":"parser-input.js","sourceRoot":"","sources":["../../../src/less/parser/parser-input.js"],"names":[],"mappings":";;AAAA,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,GA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M,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":["export 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.$peekChar = tok => {\n if (input.charAt(parserInput.i) !== tok) {\n return null;\n }\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 }\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 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 }\n i++;\n if (i > length) {\n loop = false;\n }\n }\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) => {\n input = str;\n parserInput.i = j = currentPos = furthest = 0;\n\n chunks = [str];\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"]}
|
|
@@ -108,12 +108,7 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
|
|
|
108
108
|
var returnNodes = [];
|
|
109
109
|
var parser = parserInput;
|
|
110
110
|
try {
|
|
111
|
-
parser.start(str
|
|
112
|
-
callback({
|
|
113
|
-
message: msg,
|
|
114
|
-
index: index + currentIndex
|
|
115
|
-
});
|
|
116
|
-
});
|
|
111
|
+
parser.start(str);
|
|
117
112
|
for (var x = 0, p = void 0; (p = parseList[x]); x++) {
|
|
118
113
|
result = parsers[p]();
|
|
119
114
|
returnNodes.push(result || null);
|
|
@@ -186,14 +181,7 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
|
|
|
186
181
|
// with the `root` property set to true, so no `{}` are
|
|
187
182
|
// output. The callback is called when the input is parsed.
|
|
188
183
|
try {
|
|
189
|
-
parserInput.start(str
|
|
190
|
-
throw new less_error_1.default({
|
|
191
|
-
index: index,
|
|
192
|
-
type: 'Parse',
|
|
193
|
-
message: msg,
|
|
194
|
-
filename: fileInfo.filename
|
|
195
|
-
}, imports);
|
|
196
|
-
});
|
|
184
|
+
parserInput.start(str);
|
|
197
185
|
tree_1.default.Node.prototype.parse = this;
|
|
198
186
|
root = new tree_1.default.Ruleset(null, this.parsers.primary());
|
|
199
187
|
tree_1.default.Node.prototype.rootNode = root;
|
|
@@ -1799,6 +1787,9 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
|
|
|
1799
1787
|
if (!parserInput.$char(',')) {
|
|
1800
1788
|
break;
|
|
1801
1789
|
}
|
|
1790
|
+
else if (!features[features.length - 1].noSpacing) {
|
|
1791
|
+
features[features.length - 1].noSpacing = false;
|
|
1792
|
+
}
|
|
1802
1793
|
}
|
|
1803
1794
|
else {
|
|
1804
1795
|
e = entities.variable() || entities.mixinLookup();
|
|
@@ -1807,6 +1798,9 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
|
|
|
1807
1798
|
if (!parserInput.$char(',')) {
|
|
1808
1799
|
break;
|
|
1809
1800
|
}
|
|
1801
|
+
else if (!features[features.length - 1].noSpacing) {
|
|
1802
|
+
features[features.length - 1].noSpacing = false;
|
|
1803
|
+
}
|
|
1810
1804
|
}
|
|
1811
1805
|
}
|
|
1812
1806
|
} while (e);
|