From 6887e4d34f5985e4f1eeed0b96452bdba8d3cc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Fri, 15 Apr 2022 19:38:54 +0200 Subject: [PATCH] use explicit path --- packages/less/src/less/contexts.js | 2 +- packages/less/src/less/data/index.js | 4 +- .../environment/abstract-plugin-loader.js | 5 +- .../less/src/less/environment/environment.js | 2 +- packages/less/src/less/functions/boolean.js | 4 +- .../less/src/less/functions/color-blending.js | 2 +- packages/less/src/less/functions/color.js | 16 ++--- packages/less/src/less/functions/data-uri.js | 12 ++-- packages/less/src/less/functions/default.js | 2 +- .../src/less/functions/function-caller.js | 2 +- packages/less/src/less/functions/index.js | 26 +++---- packages/less/src/less/functions/list.js | 24 +++---- .../less/src/less/functions/math-helper.js | 2 +- packages/less/src/less/functions/number.js | 4 +- packages/less/src/less/functions/string.js | 6 +- packages/less/src/less/functions/svg.js | 10 +-- packages/less/src/less/functions/types.js | 16 ++--- packages/less/src/less/import-manager.js | 10 +-- packages/less/src/less/index.js | 42 ++++++------ packages/less/src/less/less-error.js | 4 +- packages/less/src/less/parse-tree.js | 8 +-- packages/less/src/less/parse.js | 10 +-- packages/less/src/less/parser/parser-input.js | 4 +- packages/less/src/less/parser/parser.js | 62 ++++++++--------- packages/less/src/less/render.js | 2 +- packages/less/src/less/transform-tree.js | 8 +-- packages/less/src/less/tree/anonymous.js | 2 +- packages/less/src/less/tree/assignment.js | 2 +- packages/less/src/less/tree/atrule.js | 8 +-- packages/less/src/less/tree/attribute.js | 2 +- packages/less/src/less/tree/call.js | 16 ++--- packages/less/src/less/tree/color.js | 4 +- packages/less/src/less/tree/combinator.js | 2 +- packages/less/src/less/tree/comment.js | 4 +- packages/less/src/less/tree/condition.js | 2 +- packages/less/src/less/tree/declaration.js | 10 +-- .../less/src/less/tree/detached-ruleset.js | 6 +- packages/less/src/less/tree/dimension.js | 8 +-- packages/less/src/less/tree/element.js | 6 +- packages/less/src/less/tree/expression.js | 10 +-- packages/less/src/less/tree/extend.js | 4 +- packages/less/src/less/tree/import.js | 16 ++--- packages/less/src/less/tree/index.js | 68 +++++++++---------- packages/less/src/less/tree/javascript.js | 8 +-- packages/less/src/less/tree/js-eval-node.js | 4 +- packages/less/src/less/tree/keyword.js | 2 +- packages/less/src/less/tree/media.js | 16 ++--- packages/less/src/less/tree/mixin-call.js | 8 +-- .../less/src/less/tree/mixin-definition.js | 16 ++--- .../less/src/less/tree/namespace-value.js | 14 ++-- packages/less/src/less/tree/negative.js | 6 +- packages/less/src/less/tree/operation.js | 8 +-- packages/less/src/less/tree/paren.js | 2 +- packages/less/src/less/tree/property.js | 4 +- packages/less/src/less/tree/quoted.js | 6 +- packages/less/src/less/tree/ruleset.js | 38 +++++------ packages/less/src/less/tree/selector.js | 12 ++-- .../less/src/less/tree/unicode-descriptor.js | 2 +- packages/less/src/less/tree/unit.js | 6 +- packages/less/src/less/tree/url.js | 2 +- packages/less/src/less/tree/value.js | 2 +- packages/less/src/less/tree/variable-call.js | 10 +-- packages/less/src/less/tree/variable.js | 4 +- packages/less/src/less/utils.js | 2 +- .../less/src/less/visitors/extend-visitor.js | 8 +-- 65 files changed, 319 insertions(+), 320 deletions(-) diff --git a/packages/less/src/less/contexts.js b/packages/less/src/less/contexts.js index e76658833..b14598346 100644 --- a/packages/less/src/less/contexts.js +++ b/packages/less/src/less/contexts.js @@ -1,6 +1,6 @@ const contexts = {}; export default contexts; -import * as Constants from './constants'; +import * as Constants from './constants.js'; const copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) { if (!original) { return; } diff --git a/packages/less/src/less/data/index.js b/packages/less/src/less/data/index.js index 1a7d75bc4..f3abd084a 100644 --- a/packages/less/src/less/data/index.js +++ b/packages/less/src/less/data/index.js @@ -1,4 +1,4 @@ -import colors from './colors'; -import unitConversions from './unit-conversions'; +import colors from './colors.js'; +import unitConversions from './unit-conversions.js'; export default { colors, unitConversions }; diff --git a/packages/less/src/less/environment/abstract-plugin-loader.js b/packages/less/src/less/environment/abstract-plugin-loader.js index 917c24baa..835170ed7 100644 --- a/packages/less/src/less/environment/abstract-plugin-loader.js +++ b/packages/less/src/less/environment/abstract-plugin-loader.js @@ -1,5 +1,5 @@ -import functionRegistry from '../functions/function-registry'; -import LessError from '../less-error'; +import functionRegistry from '../functions/function-registry.js'; +import LessError from '../less-error.js'; class AbstractPluginLoader { constructor() { @@ -182,4 +182,3 @@ class AbstractPluginLoader { } export default AbstractPluginLoader; - diff --git a/packages/less/src/less/environment/environment.js b/packages/less/src/less/environment/environment.js index 39de0d315..e57cbef7c 100644 --- a/packages/less/src/less/environment/environment.js +++ b/packages/less/src/less/environment/environment.js @@ -3,7 +3,7 @@ * environment, file managers, and plugin manager */ -import logger from '../logger'; +import logger from '../logger.js'; class Environment { constructor(externalEnvironment, fileManagers) { diff --git a/packages/less/src/less/functions/boolean.js b/packages/less/src/less/functions/boolean.js index e483bbb23..e6a57a3b3 100644 --- a/packages/less/src/less/functions/boolean.js +++ b/packages/less/src/less/functions/boolean.js @@ -1,5 +1,5 @@ -import Anonymous from '../tree/anonymous'; -import Keyword from '../tree/keyword'; +import Anonymous from '../tree/anonymous.js'; +import Keyword from '../tree/keyword.js'; function boolean(condition) { return condition ? Keyword.True : Keyword.False; diff --git a/packages/less/src/less/functions/color-blending.js b/packages/less/src/less/functions/color-blending.js index 9f01626d2..f9d10e668 100644 --- a/packages/less/src/less/functions/color-blending.js +++ b/packages/less/src/less/functions/color-blending.js @@ -1,4 +1,4 @@ -import Color from '../tree/color'; +import Color from '../tree/color.js'; // Color Blending // ref: http://www.w3.org/TR/compositing-1 diff --git a/packages/less/src/less/functions/color.js b/packages/less/src/less/functions/color.js index f070e1690..9d79ca19b 100644 --- a/packages/less/src/less/functions/color.js +++ b/packages/less/src/less/functions/color.js @@ -1,9 +1,9 @@ -import Dimension from '../tree/dimension'; -import Color from '../tree/color'; -import Quoted from '../tree/quoted'; -import Anonymous from '../tree/anonymous'; -import Expression from '../tree/expression'; -import Operation from '../tree/operation'; +import Dimension from '../tree/dimension.js'; +import Color from '../tree/color.js'; +import Quoted from '../tree/quoted.js'; +import Anonymous from '../tree/anonymous.js'; +import Expression from '../tree/expression.js'; +import Operation from '../tree/operation.js'; let colorFunctions; function clamp(val) { @@ -12,7 +12,7 @@ function clamp(val) { function hsla(origColor, hsl) { const color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a); if (color) { - if (origColor.value && + if (origColor.value && /^(rgb|hsl)/.test(origColor.value)) { color.value = origColor.value; } else { @@ -68,7 +68,7 @@ colorFunctions = { r = val[0] g = val[1] b = val[2] - /** + /** * @todo - should this be normalized in * function caller? Or parsed differently? */ diff --git a/packages/less/src/less/functions/data-uri.js b/packages/less/src/less/functions/data-uri.js index 3c09c507f..79707a687 100644 --- a/packages/less/src/less/functions/data-uri.js +++ b/packages/less/src/less/functions/data-uri.js @@ -1,11 +1,11 @@ -import Quoted from '../tree/quoted'; -import URL from '../tree/url'; -import * as utils from '../utils'; -import logger from '../logger'; +import Quoted from '../tree/quoted.js'; +import URL from '../tree/url.js'; +import * as utils from '../utils.js'; +import logger from '../logger.js'; export default environment => { - - const fallback = (functionThis, node) => new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); + + const fallback = (functionThis, node) => new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); return { 'data-uri': function(mimetypeNode, filePathNode) { diff --git a/packages/less/src/less/functions/default.js b/packages/less/src/less/functions/default.js index fc7fd63aa..219d5efd7 100644 --- a/packages/less/src/less/functions/default.js +++ b/packages/less/src/less/functions/default.js @@ -1,4 +1,4 @@ -import Keyword from '../tree/keyword'; +import Keyword from '../tree/keyword.js'; const defaultFunc = { eval: function () { diff --git a/packages/less/src/less/functions/function-caller.js b/packages/less/src/less/functions/function-caller.js index 4a46ec74b..19e6cf6b3 100644 --- a/packages/less/src/less/functions/function-caller.js +++ b/packages/less/src/less/functions/function-caller.js @@ -1,4 +1,4 @@ -import Expression from '../tree/expression'; +import Expression from '../tree/expression.js'; class functionCaller { constructor(name, context, index, currentFileInfo) { diff --git a/packages/less/src/less/functions/index.js b/packages/less/src/less/functions/index.js index 046da784c..e812cbddb 100644 --- a/packages/less/src/less/functions/index.js +++ b/packages/less/src/less/functions/index.js @@ -1,17 +1,17 @@ -import functionRegistry from './function-registry'; -import functionCaller from './function-caller'; +import functionRegistry from './function-registry.js'; +import functionCaller from './function-caller.js'; -import boolean from './boolean'; -import defaultFunc from './default'; -import color from './color'; -import colorBlending from './color-blending'; -import dataUri from './data-uri'; -import list from './list'; -import math from './math'; -import number from './number'; -import string from './string'; -import svg from './svg'; -import types from './types'; +import boolean from './boolean.js'; +import defaultFunc from './default.js'; +import color from './color.js'; +import colorBlending from './color-blending.js'; +import dataUri from './data-uri.js'; +import list from './list.js'; +import math from './math.js'; +import number from './number.js'; +import string from './string.js'; +import svg from './svg.js'; +import types from './types.js'; export default environment => { const functions = { functionRegistry, functionCaller }; diff --git a/packages/less/src/less/functions/list.js b/packages/less/src/less/functions/list.js index 98a4c72c9..45a1130cb 100644 --- a/packages/less/src/less/functions/list.js +++ b/packages/less/src/less/functions/list.js @@ -1,13 +1,13 @@ -import Comment from '../tree/comment'; -import Node from '../tree/node'; -import Dimension from '../tree/dimension'; -import Declaration from '../tree/declaration'; -import Expression from '../tree/expression'; -import Ruleset from '../tree/ruleset'; -import Selector from '../tree/selector'; -import Element from '../tree/element'; -import Quote from '../tree/quoted'; -import Value from '../tree/value'; +import Comment from '../tree/comment.js'; +import Node from '../tree/node.js'; +import Dimension from '../tree/dimension.js'; +import Declaration from '../tree/declaration.js'; +import Expression from '../tree/expression.js'; +import Ruleset from '../tree/ruleset.js'; +import Selector from '../tree/selector.js'; +import Element from '../tree/element.js'; +import Quote from '../tree/quoted.js'; +import Value from '../tree/value.js'; const getItemsFromNode = node => { // handle non-array values as an array of length 1 @@ -40,10 +40,10 @@ export default { /** * Creates a Less list of incremental values. * Modeled after Lodash's range function, also exists natively in PHP - * + * * @param {Dimension} [start=1] * @param {Dimension} end - e.g. 10 or 10px - unit is added to output - * @param {Dimension} [step=1] + * @param {Dimension} [step=1] */ range: function(start, end, step) { let from; diff --git a/packages/less/src/less/functions/math-helper.js b/packages/less/src/less/functions/math-helper.js index ed6deaa75..08abeddc7 100644 --- a/packages/less/src/less/functions/math-helper.js +++ b/packages/less/src/less/functions/math-helper.js @@ -1,4 +1,4 @@ -import Dimension from '../tree/dimension'; +import Dimension from '../tree/dimension.js'; const MathHelper = (fn, unit, n) => { if (!(n instanceof Dimension)) { diff --git a/packages/less/src/less/functions/number.js b/packages/less/src/less/functions/number.js index f01689472..9d7d021ab 100644 --- a/packages/less/src/less/functions/number.js +++ b/packages/less/src/less/functions/number.js @@ -1,5 +1,5 @@ -import Dimension from '../tree/dimension'; -import Anonymous from '../tree/anonymous'; +import Dimension from '../tree/dimension.js'; +import Anonymous from '../tree/anonymous.js'; import mathHelper from './math-helper.js'; const minMax = function (isMin, args) { diff --git a/packages/less/src/less/functions/string.js b/packages/less/src/less/functions/string.js index 2ded20551..b4de36356 100644 --- a/packages/less/src/less/functions/string.js +++ b/packages/less/src/less/functions/string.js @@ -1,6 +1,6 @@ -import Quoted from '../tree/quoted'; -import Anonymous from '../tree/anonymous'; -import JavaScript from '../tree/javascript'; +import Quoted from '../tree/quoted.js'; +import Anonymous from '../tree/anonymous.js'; +import JavaScript from '../tree/javascript.js'; export default { e: function (str) { diff --git a/packages/less/src/less/functions/svg.js b/packages/less/src/less/functions/svg.js index 3df96d66f..222d7e3be 100644 --- a/packages/less/src/less/functions/svg.js +++ b/packages/less/src/less/functions/svg.js @@ -1,8 +1,8 @@ -import Dimension from '../tree/dimension'; -import Color from '../tree/color'; -import Expression from '../tree/expression'; -import Quoted from '../tree/quoted'; -import URL from '../tree/url'; +import Dimension from '../tree/dimension.js'; +import Color from '../tree/color.js'; +import Expression from '../tree/expression.js'; +import Quoted from '../tree/quoted.js'; +import URL from '../tree/url.js'; export default environment => { return { 'svg-gradient': function(direction) { diff --git a/packages/less/src/less/functions/types.js b/packages/less/src/less/functions/types.js index 6f1aff30f..1f065f680 100644 --- a/packages/less/src/less/functions/types.js +++ b/packages/less/src/less/functions/types.js @@ -1,11 +1,11 @@ -import Keyword from '../tree/keyword'; -import DetachedRuleset from '../tree/detached-ruleset'; -import Dimension from '../tree/dimension'; -import Color from '../tree/color'; -import Quoted from '../tree/quoted'; -import Anonymous from '../tree/anonymous'; -import URL from '../tree/url'; -import Operation from '../tree/operation'; +import Keyword from '../tree/keyword.js'; +import DetachedRuleset from '../tree/detached-ruleset.js'; +import Dimension from '../tree/dimension.js'; +import Color from '../tree/color.js'; +import Quoted from '../tree/quoted.js'; +import Anonymous from '../tree/anonymous.js'; +import URL from '../tree/url.js'; +import Operation from '../tree/operation.js'; const isa = (n, Type) => (n instanceof Type) ? Keyword.True : Keyword.False; const isunit = (n, unit) => { diff --git a/packages/less/src/less/import-manager.js b/packages/less/src/less/import-manager.js index 227d120c4..07fec082e 100644 --- a/packages/less/src/less/import-manager.js +++ b/packages/less/src/less/import-manager.js @@ -1,8 +1,8 @@ -import contexts from './contexts'; -import Parser from './parser/parser'; -import LessError from './less-error'; -import * as utils from './utils'; -import logger from './logger'; +import contexts from './contexts.js'; +import Parser from './parser/parser.js'; +import LessError from './less-error.js'; +import * as utils from './utils.js'; +import logger from './logger.js'; export default function(environment) { // FileInfo = { diff --git a/packages/less/src/less/index.js b/packages/less/src/less/index.js index 4873f0b31..ee43aeae0 100644 --- a/packages/less/src/less/index.js +++ b/packages/less/src/less/index.js @@ -1,23 +1,23 @@ -import Environment from './environment/environment'; -import data from './data'; -import tree from './tree'; -import AbstractFileManager from './environment/abstract-file-manager'; -import AbstractPluginLoader from './environment/abstract-plugin-loader'; -import visitors from './visitors'; -import Parser from './parser/parser'; -import functions from './functions'; -import contexts from './contexts'; -import LessError from './less-error'; -import transformTree from './transform-tree'; -import * as utils from './utils'; -import PluginManager from './plugin-manager'; -import logger from './logger'; -import SourceMapOutput from './source-map-output'; -import SourceMapBuilder from './source-map-builder'; -import ParseTree from './parse-tree'; -import ImportManager from './import-manager'; -import Parse from './parse'; -import Render from './render'; +import Environment from './environment/environment.js'; +import data from './data/index.js'; +import tree from './tree/index.js'; +import AbstractFileManager from './environment/abstract-file-manager.js'; +import AbstractPluginLoader from './environment/abstract-plugin-loader.js'; +import visitors from './visitors/index.js'; +import Parser from './parser/parser.js'; +import functions from './functions/index.js'; +import contexts from './contexts.js'; +import LessError from './less-error.js'; +import transformTree from './transform-tree.js'; +import * as utils from './utils.js'; +import PluginManager from './plugin-manager.js'; +import logger from './logger.js'; +import SourceMapOutput from './source-map-output.js'; +import SourceMapBuilder from './source-map-builder.js'; +import ParseTree from './parse-tree.js'; +import ImportManager from './import-manager.js'; +import Parse from './parse.js'; +import Render from './render.js'; import { version } from '../../package.json'; import parseVersion from 'parse-node-version'; @@ -88,7 +88,7 @@ export default function(environment, fileManagers) { /** * Some of the functions assume a `this` context of the API object, * which causes it to fail when wrapped for ES6 imports. - * + * * An assumed `this` should be removed in the future. */ initial.parse = initial.parse.bind(api); diff --git a/packages/less/src/less/less-error.js b/packages/less/src/less/less-error.js index 9bd1aeb5a..32bcddfe1 100644 --- a/packages/less/src/less/less-error.js +++ b/packages/less/src/less/less-error.js @@ -1,4 +1,4 @@ -import * as utils from './utils'; +import * as utils from './utils.js'; const anonymousFunc = /(|Function):(\d+):(\d+)/; @@ -52,7 +52,7 @@ const LessError = function(e, fileContentMap, currentFilename) { /** * We have to figure out how this environment stringifies anonymous functions * so we can correctly map plugin errors. - * + * * Note, in Node 8, the output of anonymous funcs varied based on parameters * being present or not, so we inject dummy params. */ diff --git a/packages/less/src/less/parse-tree.js b/packages/less/src/less/parse-tree.js index 44f7deece..fd64e5fbb 100644 --- a/packages/less/src/less/parse-tree.js +++ b/packages/less/src/less/parse-tree.js @@ -1,6 +1,6 @@ -import LessError from './less-error'; -import transformTree from './transform-tree'; -import logger from './logger'; +import LessError from './less-error.js'; +import transformTree from './transform-tree.js'; +import logger from './logger.js'; export default function(SourceMapBuilder) { class ParseTree { @@ -22,7 +22,7 @@ export default function(SourceMapBuilder) { try { const compress = Boolean(options.compress); if (compress) { - logger.warn('The compress option has been deprecated. ' + + logger.warn('The compress option has been deprecated. ' + 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.'); } diff --git a/packages/less/src/less/parse.js b/packages/less/src/less/parse.js index 931c9a91c..35f550536 100644 --- a/packages/less/src/less/parse.js +++ b/packages/less/src/less/parse.js @@ -1,8 +1,8 @@ -import contexts from './contexts'; -import Parser from './parser/parser'; -import PluginManager from './plugin-manager'; -import LessError from './less-error'; -import * as utils from './utils'; +import contexts from './contexts.js'; +import Parser from './parser/parser.js'; +import PluginManager from './plugin-manager.js'; +import LessError from './less-error.js'; +import * as utils from './utils.js'; export default function(environment, ParseTree, ImportManager) { const parse = function (input, options, callback) { diff --git a/packages/less/src/less/parser/parser-input.js b/packages/less/src/less/parser/parser-input.js index 8e93a38a7..e12483c4f 100644 --- a/packages/less/src/less/parser/parser-input.js +++ b/packages/less/src/less/parser/parser-input.js @@ -1,4 +1,4 @@ -import chunker from './chunker'; +import chunker from './chunker.js'; export default () => { let // Less input string @@ -235,7 +235,7 @@ export default () => { loop = false } else { if (inComment) { - if (nextChar === '*' && + if (nextChar === '*' && input.charAt(i + 1) === '/') { i++; blockDepth--; diff --git a/packages/less/src/less/parser/parser.js b/packages/less/src/less/parser/parser.js index c7a65cb07..02434da8c 100644 --- a/packages/less/src/less/parser/parser.js +++ b/packages/less/src/less/parser/parser.js @@ -1,9 +1,9 @@ -import LessError from '../less-error'; -import tree from '../tree'; -import visitors from '../visitors'; -import getParserInput from './parser-input'; -import * as utils from '../utils'; -import functionRegistry from '../functions/function-registry'; +import LessError from '../less-error.js'; +import tree from '../tree/index.js'; +import visitors from '../visitors/index.js'; +import getParserInput from './parser-input.js'; +import * as utils from '../utils.js'; +import functionRegistry from '../functions/function-registry.js'; // // less.js - parser @@ -60,7 +60,7 @@ const Parser = function Parser(context, imports, fileInfo) { if (result) { return result; } - + error(msg || (typeof arg === 'string' ? `expected '${arg}' got '${parserInput.currentChar()}'` : 'unexpected token')); @@ -85,8 +85,8 @@ const Parser = function Parser(context, imports, fileInfo) { /** * Used after initial parsing to create nodes on the fly - * - * @param {String} str - string to parse + * + * @param {String} str - string to parse * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] * @param {Number} currentIndex - start number to begin indexing * @param {Object} fileInfo - fileInfo to attach to created nodes @@ -197,7 +197,7 @@ const Parser = function Parser(context, imports, fileInfo) { root.root = true; root.firstRoot = true; root.functionRegistry = functionRegistry.inherit(); - + } catch (e) { return callback(new LessError(e, imports, fileInfo.filename)); } @@ -327,7 +327,7 @@ const Parser = function Parser(context, imports, fileInfo) { continue; } - node = mixin.definition() || this.declaration() || mixin.call(false, false) || + node = mixin.definition() || this.declaration() || mixin.call(false, false) || this.ruleset() || this.variableCall() || this.entities.call() || this.atrule(); if (node) { root.push(node); @@ -423,7 +423,7 @@ const Parser = function Parser(context, imports, fileInfo) { name = parserInput.$re(/^([\w-]+|%|~|progid:[\w\.]+)\(/); if (!name) { - parserInput.forget(); + parserInput.forget(); return; } @@ -448,7 +448,7 @@ const Parser = function Parser(context, imports, fileInfo) { return new(tree.Call)(name, args, index, fileInfo); }, - + // // Parsing rules for functions with non-standard args, e.g.: // @@ -471,11 +471,11 @@ const Parser = function Parser(context, imports, fileInfo) { function f(parse, stop) { return { parse, // parsing function - stop // when true - stop after parse() and return its result, + stop // when true - stop after parse() and return its result, // otherwise continue for plain args }; } - + function condition() { return [expect(parsers.condition, 'expected condition')]; } @@ -581,8 +581,8 @@ const Parser = function Parser(context, imports, fileInfo) { expectChar(')'); - return new(tree.URL)((value.value != null || - value instanceof tree.Variable || + return new(tree.URL)((value.value != null || + value instanceof tree.Variable || value instanceof tree.Property) ? value : new(tree.Anonymous)(value, index), index, fileInfo); }, @@ -664,7 +664,7 @@ const Parser = function Parser(context, imports, fileInfo) { if (!rgb[2]) { parserInput.forget(); return new(tree.Color)(rgb[1], undefined, rgb[0]); - } + } } parserInput.restore(); }, @@ -946,7 +946,7 @@ const Parser = function Parser(context, imports, fileInfo) { while (true) { elemIndex = parserInput.i; e = parserInput.$re(re); - + if (!e) { break; } @@ -1157,13 +1157,13 @@ const Parser = function Parser(context, imports, fileInfo) { parserInput.restore(); } }, - + ruleLookups: function() { let rule; let args; const lookups = []; - if (parserInput.currentChar() !== '[') { + if (parserInput.currentChar() !== '[') { return; } @@ -1182,27 +1182,27 @@ const Parser = function Parser(context, imports, fileInfo) { return lookups; } }, - + lookupValue: function() { parserInput.save(); - - if (!parserInput.$char('[')) { + + if (!parserInput.$char('[')) { parserInput.restore(); return; } - + const name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/); - + if (!parserInput.$char(']')) { parserInput.restore(); return; - } + } if (name || name === '') { parserInput.forget(); return name; } - + parserInput.restore(); } }, @@ -1456,7 +1456,7 @@ const Parser = function Parser(context, imports, fileInfo) { parserInput.save(); if (parserInput.$re(/^[.#]\(/)) { /** - * DR args currently only implemented for each() function, and not + * DR args currently only implemented for each() function, and not * yet settable as `@dr: #(@arg) {}` * This should be done when DRs are merged with mixins. * See: https://github.com/less/less-meta/issues/16 @@ -1588,7 +1588,7 @@ const Parser = function Parser(context, imports, fileInfo) { * Used for custom properties, at-rules, and variables (as fallback) * Parses almost anything inside of {} [] () "" blocks * until it reaches outer-most tokens. - * + * * First, it will try to parse comments and entities to reach * the end. This is mostly like the Expression parser except no * math is allowed. @@ -1894,7 +1894,7 @@ const Parser = function Parser(context, imports, fileInfo) { parserInput.forget(); return args[1].trim(); } - else { + else { parserInput.restore(); return null; } diff --git a/packages/less/src/less/render.js b/packages/less/src/less/render.js index 9920d2fd1..e318a5300 100644 --- a/packages/less/src/less/render.js +++ b/packages/less/src/less/render.js @@ -1,4 +1,4 @@ -import * as utils from './utils'; +import * as utils from './utils.js'; export default function(environment, ParseTree, ImportManager) { const render = function (input, options, callback) { diff --git a/packages/less/src/less/transform-tree.js b/packages/less/src/less/transform-tree.js index 92479b73c..56232fb7f 100644 --- a/packages/less/src/less/transform-tree.js +++ b/packages/less/src/less/transform-tree.js @@ -1,6 +1,6 @@ -import contexts from './contexts'; -import visitor from './visitors'; -import tree from './tree'; +import contexts from './contexts.js'; +import visitor from './visitors/index.js'; +import tree from './tree/index.js'; export default function(root, options) { options = options || {}; @@ -49,7 +49,7 @@ export default function(root, options) { /** * first() / get() allows visitors to be added while visiting - * + * * @todo Add scoping for visitors just like functions for @plugin; right now they're global */ if (options.pluginManager) { diff --git a/packages/less/src/less/tree/anonymous.js b/packages/less/src/less/tree/anonymous.js index 9c40a9526..b5764c5e5 100644 --- a/packages/less/src/less/tree/anonymous.js +++ b/packages/less/src/less/tree/anonymous.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const Anonymous = function(value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { this.value = value; diff --git a/packages/less/src/less/tree/assignment.js b/packages/less/src/less/tree/assignment.js index 564d9220d..fa137d09b 100644 --- a/packages/less/src/less/tree/assignment.js +++ b/packages/less/src/less/tree/assignment.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const Assignment = function(key, val) { this.key = key; diff --git a/packages/less/src/less/tree/atrule.js b/packages/less/src/less/tree/atrule.js index 9b5a07aa0..4d99e7deb 100644 --- a/packages/less/src/less/tree/atrule.js +++ b/packages/less/src/less/tree/atrule.js @@ -1,7 +1,7 @@ -import Node from './node'; -import Selector from './selector'; -import Ruleset from './ruleset'; -import Anonymous from './anonymous'; +import Node from './node.js'; +import Selector from './selector.js'; +import Ruleset from './ruleset.js'; +import Anonymous from './anonymous.js'; const AtRule = function( name, diff --git a/packages/less/src/less/tree/attribute.js b/packages/less/src/less/tree/attribute.js index 0fa07eaba..8d2b0b0cd 100644 --- a/packages/less/src/less/tree/attribute.js +++ b/packages/less/src/less/tree/attribute.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const Attribute = function(key, op, value, cif) { this.key = key; diff --git a/packages/less/src/less/tree/call.js b/packages/less/src/less/tree/call.js index 61ed0173c..2acbecff1 100644 --- a/packages/less/src/less/tree/call.js +++ b/packages/less/src/less/tree/call.js @@ -1,6 +1,6 @@ -import Node from './node'; -import Anonymous from './anonymous'; -import FunctionCaller from '../functions/function-caller'; +import Node from './node.js'; +import Anonymous from './anonymous.js'; +import FunctionCaller from '../functions/function-caller.js'; // // A function call node. @@ -61,10 +61,10 @@ Call.prototype = Object.assign(new Node(), { if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) { throw e; } - throw { + throw { type: e.type || 'Runtime', message: `Error evaluating function \`${this.name}\`${e.message ? `: ${e.message}` : ''}`, - index: this.getIndex(), + index: this.getIndex(), filename: this.fileInfo().filename, line: e.lineNumber, column: e.columnNumber @@ -77,12 +77,12 @@ Call.prototype = Object.assign(new Node(), { // Falsy values or booleans are returned as empty nodes if (!(result instanceof Node)) { if (!result || result === true) { - result = new Anonymous(null); + result = new Anonymous(null); } else { - result = new Anonymous(result.toString()); + result = new Anonymous(result.toString()); } - + } result._index = this._index; result._fileInfo = this._fileInfo; diff --git a/packages/less/src/less/tree/color.js b/packages/less/src/less/tree/color.js index df068a59f..dfb605cd2 100644 --- a/packages/less/src/less/tree/color.js +++ b/packages/less/src/less/tree/color.js @@ -1,5 +1,5 @@ -import Node from './node'; -import colors from '../data/colors'; +import Node from './node.js'; +import colors from '../data/colors.js'; // // RGB Colors - #ff0014, #eee diff --git a/packages/less/src/less/tree/combinator.js b/packages/less/src/less/tree/combinator.js index a98347699..4d6958d94 100644 --- a/packages/less/src/less/tree/combinator.js +++ b/packages/less/src/less/tree/combinator.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const _noSpaceCombinators = { '': true, ' ': true, diff --git a/packages/less/src/less/tree/comment.js b/packages/less/src/less/tree/comment.js index ce18c4e58..38ba40733 100644 --- a/packages/less/src/less/tree/comment.js +++ b/packages/less/src/less/tree/comment.js @@ -1,5 +1,5 @@ -import Node from './node'; -import getDebugInfo from './debug-info'; +import Node from './node.js'; +import getDebugInfo from './debug-info.js'; const Comment = function(value, isLineComment, index, currentFileInfo) { this.value = value; diff --git a/packages/less/src/less/tree/condition.js b/packages/less/src/less/tree/condition.js index 4ae3beb43..64e99933e 100644 --- a/packages/less/src/less/tree/condition.js +++ b/packages/less/src/less/tree/condition.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const Condition = function(op, l, r, i, negate) { this.op = op.trim(); diff --git a/packages/less/src/less/tree/declaration.js b/packages/less/src/less/tree/declaration.js index 9291f495e..ca75d848d 100644 --- a/packages/less/src/less/tree/declaration.js +++ b/packages/less/src/less/tree/declaration.js @@ -1,8 +1,8 @@ -import Node from './node'; -import Value from './value'; -import Keyword from './keyword'; -import Anonymous from './anonymous'; -import * as Constants from '../constants'; +import Node from './node.js'; +import Value from './value.js'; +import Keyword from './keyword.js'; +import Anonymous from './anonymous.js'; +import * as Constants from '../constants.js'; const MATH = Constants.Math; function evalName(context, name) { diff --git a/packages/less/src/less/tree/detached-ruleset.js b/packages/less/src/less/tree/detached-ruleset.js index de5d91535..224ec918b 100644 --- a/packages/less/src/less/tree/detached-ruleset.js +++ b/packages/less/src/less/tree/detached-ruleset.js @@ -1,6 +1,6 @@ -import Node from './node'; -import contexts from '../contexts'; -import * as utils from '../utils'; +import Node from './node.js'; +import contexts from '../contexts.js'; +import * as utils from '../utils.js'; const DetachedRuleset = function(ruleset, frames) { this.ruleset = ruleset; diff --git a/packages/less/src/less/tree/dimension.js b/packages/less/src/less/tree/dimension.js index 8cbb3249d..03ea231c8 100644 --- a/packages/less/src/less/tree/dimension.js +++ b/packages/less/src/less/tree/dimension.js @@ -1,7 +1,7 @@ -import Node from './node'; -import unitConversions from '../data/unit-conversions'; -import Unit from './unit'; -import Color from './color'; +import Node from './node.js'; +import unitConversions from '../data/unit-conversions.js'; +import Unit from './unit.js'; +import Color from './color.js'; // // A number with a unit diff --git a/packages/less/src/less/tree/element.js b/packages/less/src/less/tree/element.js index 4331fbc44..30fb81c48 100644 --- a/packages/less/src/less/tree/element.js +++ b/packages/less/src/less/tree/element.js @@ -1,6 +1,6 @@ -import Node from './node'; -import Paren from './paren'; -import Combinator from './combinator'; +import Node from './node.js'; +import Paren from './paren.js'; +import Combinator from './combinator.js'; const Element = function(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) { this.combinator = combinator instanceof Combinator ? diff --git a/packages/less/src/less/tree/expression.js b/packages/less/src/less/tree/expression.js index 957505b87..1f6753430 100644 --- a/packages/less/src/less/tree/expression.js +++ b/packages/less/src/less/tree/expression.js @@ -1,7 +1,7 @@ -import Node from './node'; -import Paren from './paren'; -import Comment from './comment'; -import Dimension from './dimension'; +import Node from './node.js'; +import Paren from './paren.js'; +import Comment from './comment.js'; +import Dimension from './dimension.js'; const Expression = function(value, noSpacing) { this.value = value; @@ -45,7 +45,7 @@ Expression.prototype = Object.assign(new Node(), { if (inParenthesis) { context.outOfParenthesis(); } - if (this.parens && this.parensInOp && !mathOn && !doubleParen + if (this.parens && this.parensInOp && !mathOn && !doubleParen && (!(returnValue instanceof Dimension))) { returnValue = new Paren(returnValue); } diff --git a/packages/less/src/less/tree/extend.js b/packages/less/src/less/tree/extend.js index 6e10246bf..a6ed0045f 100644 --- a/packages/less/src/less/tree/extend.js +++ b/packages/less/src/less/tree/extend.js @@ -1,5 +1,5 @@ -import Node from './node'; -import Selector from './selector'; +import Node from './node.js'; +import Selector from './selector.js'; const Extend = function(selector, option, index, currentFileInfo, visibilityInfo) { this.selector = selector; diff --git a/packages/less/src/less/tree/import.js b/packages/less/src/less/tree/import.js index 00cfc7037..806aded49 100644 --- a/packages/less/src/less/tree/import.js +++ b/packages/less/src/less/tree/import.js @@ -1,11 +1,11 @@ -import Node from './node'; -import Media from './media'; -import URL from './url'; -import Quoted from './quoted'; -import Ruleset from './ruleset'; -import Anonymous from './anonymous'; -import * as utils from '../utils'; -import LessError from '../less-error'; +import Node from './node.js'; +import Media from './media.js'; +import URL from './url.js'; +import Quoted from './quoted.js'; +import Ruleset from './ruleset.js'; +import Anonymous from './anonymous.js'; +import * as utils from '../utils.js'; +import LessError from '../less-error.js'; // // CSS @import node diff --git a/packages/less/src/less/tree/index.js b/packages/less/src/less/tree/index.js index cf506ac59..4fd1e3a9c 100644 --- a/packages/less/src/less/tree/index.js +++ b/packages/less/src/less/tree/index.js @@ -1,37 +1,37 @@ -import Node from './node'; -import Color from './color'; -import AtRule from './atrule'; -import DetachedRuleset from './detached-ruleset'; -import Operation from './operation'; -import Dimension from './dimension'; -import Unit from './unit'; -import Keyword from './keyword'; -import Variable from './variable'; -import Property from './property'; -import Ruleset from './ruleset'; -import Element from './element'; -import Attribute from './attribute'; -import Combinator from './combinator'; -import Selector from './selector'; -import Quoted from './quoted'; -import Expression from './expression'; -import Declaration from './declaration'; -import Call from './call'; -import URL from './url'; -import Import from './import'; -import Comment from './comment'; -import Anonymous from './anonymous'; -import Value from './value'; -import JavaScript from './javascript'; -import Assignment from './assignment'; -import Condition from './condition'; -import Paren from './paren'; -import Media from './media'; -import UnicodeDescriptor from './unicode-descriptor'; -import Negative from './negative'; -import Extend from './extend'; -import VariableCall from './variable-call'; -import NamespaceValue from './namespace-value'; +import Node from './node.js'; +import Color from './color.js'; +import AtRule from './atrule.js'; +import DetachedRuleset from './detached-ruleset.js'; +import Operation from './operation.js'; +import Dimension from './dimension.js'; +import Unit from './unit.js'; +import Keyword from './keyword.js'; +import Variable from './variable.js'; +import Property from './property.js'; +import Ruleset from './ruleset.js'; +import Element from './element.js'; +import Attribute from './attribute.js'; +import Combinator from './combinator.js'; +import Selector from './selector.js'; +import Quoted from './quoted.js'; +import Expression from './expression.js'; +import Declaration from './declaration.js'; +import Call from './call.js'; +import URL from './url.js'; +import Import from './import.js'; +import Comment from './comment.js'; +import Anonymous from './anonymous.js'; +import Value from './value.js'; +import JavaScript from './javascript.js'; +import Assignment from './assignment.js'; +import Condition from './condition.js'; +import Paren from './paren.js'; +import Media from './media.js'; +import UnicodeDescriptor from './unicode-descriptor.js'; +import Negative from './negative.js'; +import Extend from './extend.js'; +import VariableCall from './variable-call.js'; +import NamespaceValue from './namespace-value.js'; // mixins import MixinCall from './mixin-call'; diff --git a/packages/less/src/less/tree/javascript.js b/packages/less/src/less/tree/javascript.js index ebdeeed88..9cdd3f1ee 100644 --- a/packages/less/src/less/tree/javascript.js +++ b/packages/less/src/less/tree/javascript.js @@ -1,7 +1,7 @@ -import JsEvalNode from './js-eval-node'; -import Dimension from './dimension'; -import Quoted from './quoted'; -import Anonymous from './anonymous'; +import JsEvalNode from './js-eval-node.js'; +import Dimension from './dimension.js'; +import Quoted from './quoted.js'; +import Anonymous from './anonymous.js'; const JavaScript = function(string, escaped, index, currentFileInfo) { this.escaped = escaped; diff --git a/packages/less/src/less/tree/js-eval-node.js b/packages/less/src/less/tree/js-eval-node.js index 8874f5f18..ac912fb21 100644 --- a/packages/less/src/less/tree/js-eval-node.js +++ b/packages/less/src/less/tree/js-eval-node.js @@ -1,5 +1,5 @@ -import Node from './node'; -import Variable from './variable'; +import Node from './node.js'; +import Variable from './variable.js'; const JsEvalNode = function() {}; diff --git a/packages/less/src/less/tree/keyword.js b/packages/less/src/less/tree/keyword.js index d3b3704e8..bf7ab8807 100644 --- a/packages/less/src/less/tree/keyword.js +++ b/packages/less/src/less/tree/keyword.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const Keyword = function(value) { this.value = value; diff --git a/packages/less/src/less/tree/media.js b/packages/less/src/less/tree/media.js index fd5c4f7c7..b067a9b91 100644 --- a/packages/less/src/less/tree/media.js +++ b/packages/less/src/less/tree/media.js @@ -1,10 +1,10 @@ -import Ruleset from './ruleset'; -import Value from './value'; -import Selector from './selector'; -import Anonymous from './anonymous'; -import Expression from './expression'; -import AtRule from './atrule'; -import * as utils from '../utils'; +import Ruleset from './ruleset.js'; +import Value from './value.js'; +import Selector from './selector.js'; +import Anonymous from './anonymous.js'; +import Expression from './expression.js'; +import AtRule from './atrule.js'; +import * as utils from '../utils.js'; const Media = function(value, features, index, currentFileInfo, visibilityInfo) { this._index = index; @@ -55,7 +55,7 @@ Media.prototype = Object.assign(new AtRule(), { this.rules[0].debugInfo = this.debugInfo; media.debugInfo = this.debugInfo; } - + media.features = this.features.eval(context); context.mediaPath.push(media); diff --git a/packages/less/src/less/tree/mixin-call.js b/packages/less/src/less/tree/mixin-call.js index 36e6b41ff..3b4219811 100644 --- a/packages/less/src/less/tree/mixin-call.js +++ b/packages/less/src/less/tree/mixin-call.js @@ -1,7 +1,7 @@ -import Node from './node'; -import Selector from './selector'; -import MixinDefinition from './mixin-definition'; -import defaultFunc from '../functions/default'; +import Node from './node.js'; +import Selector from './selector.js'; +import MixinDefinition from './mixin-definition.js'; +import defaultFunc from '../functions/default.js'; const MixinCall = function(elements, args, index, currentFileInfo, important) { this.selector = new Selector(elements); diff --git a/packages/less/src/less/tree/mixin-definition.js b/packages/less/src/less/tree/mixin-definition.js index eb22c44b0..ff6b393a4 100644 --- a/packages/less/src/less/tree/mixin-definition.js +++ b/packages/less/src/less/tree/mixin-definition.js @@ -1,11 +1,11 @@ -import Selector from './selector'; -import Element from './element'; -import Ruleset from './ruleset'; -import Declaration from './declaration'; -import DetachedRuleset from './detached-ruleset'; -import Expression from './expression'; -import contexts from '../contexts'; -import * as utils from '../utils'; +import Selector from './selector.js'; +import Element from './element.js'; +import Ruleset from './ruleset.js'; +import Declaration from './declaration.js'; +import DetachedRuleset from './detached-ruleset.js'; +import Expression from './expression.js'; +import contexts from '../contexts.js'; +import * as utils from '../utils.js'; const Definition = function(name, params, rules, condition, variadic, frames, visibilityInfo) { this.name = name || 'anonymous mixin'; diff --git a/packages/less/src/less/tree/namespace-value.js b/packages/less/src/less/tree/namespace-value.js index adbd9ea36..b30c9002d 100644 --- a/packages/less/src/less/tree/namespace-value.js +++ b/packages/less/src/less/tree/namespace-value.js @@ -1,7 +1,7 @@ -import Node from './node'; -import Variable from './variable'; -import Ruleset from './ruleset'; -import Selector from './selector'; +import Node from './node.js'; +import Variable from './variable.js'; +import Ruleset from './ruleset.js'; +import Selector from './selector.js'; const NamespaceValue = function(ruleCall, lookups, index, fileInfo) { this.value = ruleCall; @@ -15,7 +15,7 @@ NamespaceValue.prototype = Object.assign(new Node(), { eval(context) { let i, j, name, rules = this.value.eval(context); - + for (i = 0; i < this.lookups.length; i++) { name = this.lookups[i]; @@ -38,7 +38,7 @@ NamespaceValue.prototype = Object.assign(new Node(), { if (rules.variables) { rules = rules.variable(name); } - + if (!rules) { throw { type: 'Name', message: `variable ${name} not found`, @@ -56,7 +56,7 @@ NamespaceValue.prototype = Object.assign(new Node(), { if (rules.properties) { rules = rules.property(name); } - + if (!rules) { throw { type: 'Name', message: `property "${name.substr(1)}" not found`, diff --git a/packages/less/src/less/tree/negative.js b/packages/less/src/less/tree/negative.js index 7e1bcf1b2..0bedb65fc 100644 --- a/packages/less/src/less/tree/negative.js +++ b/packages/less/src/less/tree/negative.js @@ -1,6 +1,6 @@ -import Node from './node'; -import Operation from './operation'; -import Dimension from './dimension'; +import Node from './node.js'; +import Operation from './operation.js'; +import Dimension from './dimension.js'; const Negative = function(node) { this.value = node; diff --git a/packages/less/src/less/tree/operation.js b/packages/less/src/less/tree/operation.js index 2805326be..f220749cb 100644 --- a/packages/less/src/less/tree/operation.js +++ b/packages/less/src/less/tree/operation.js @@ -1,7 +1,7 @@ -import Node from './node'; -import Color from './color'; -import Dimension from './dimension'; -import * as Constants from '../constants'; +import Node from './node.js'; +import Color from './color.js'; +import Dimension from './dimension.js'; +import * as Constants from '../constants.js'; const MATH = Constants.Math; diff --git a/packages/less/src/less/tree/paren.js b/packages/less/src/less/tree/paren.js index 6e0d889a9..f7c4dd286 100644 --- a/packages/less/src/less/tree/paren.js +++ b/packages/less/src/less/tree/paren.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const Paren = function(node) { this.value = node; diff --git a/packages/less/src/less/tree/property.js b/packages/less/src/less/tree/property.js index d3b34fce7..183ad9bec 100644 --- a/packages/less/src/less/tree/property.js +++ b/packages/less/src/less/tree/property.js @@ -1,5 +1,5 @@ -import Node from './node'; -import Declaration from './declaration'; +import Node from './node.js'; +import Declaration from './declaration.js'; const Property = function(name, index, currentFileInfo) { this.name = name; diff --git a/packages/less/src/less/tree/quoted.js b/packages/less/src/less/tree/quoted.js index d73c40ca6..b97d35784 100644 --- a/packages/less/src/less/tree/quoted.js +++ b/packages/less/src/less/tree/quoted.js @@ -1,6 +1,6 @@ -import Node from './node'; -import Variable from './variable'; -import Property from './property'; +import Node from './node.js'; +import Variable from './variable.js'; +import Property from './property.js'; const Quoted = function(str, content, escaped, index, currentFileInfo) { diff --git a/packages/less/src/less/tree/ruleset.js b/packages/less/src/less/tree/ruleset.js index 22f68b75c..fd548eb3d 100644 --- a/packages/less/src/less/tree/ruleset.js +++ b/packages/less/src/less/tree/ruleset.js @@ -1,16 +1,16 @@ -import Node from './node'; -import Declaration from './declaration'; -import Keyword from './keyword'; -import Comment from './comment'; -import Paren from './paren'; -import Selector from './selector'; -import Element from './element'; -import Anonymous from './anonymous'; -import contexts from '../contexts'; -import globalFunctionRegistry from '../functions/function-registry'; -import defaultFunc from '../functions/default'; -import getDebugInfo from './debug-info'; -import * as utils from '../utils'; +import Node from './node.js'; +import Declaration from './declaration.js'; +import Keyword from './keyword.js'; +import Comment from './comment.js'; +import Paren from './paren.js'; +import Selector from './selector.js'; +import Element from './element.js'; +import Anonymous from './anonymous.js'; +import contexts from '../contexts.js'; +import globalFunctionRegistry from '../functions/function-registry.js'; +import defaultFunc from '../functions/default.js'; +import getDebugInfo from './debug-info.js'; +import * as utils from '../utils.js'; const Ruleset = function(selectors, rules, strictImports, visibilityInfo) { this.selectors = selectors; @@ -81,9 +81,9 @@ Ruleset.prototype = Object.assign(new Node(), { } this.parse.parseNode( toParseSelectors.join(','), - ["selectors"], - selectors[0].getIndex(), - selectors[0].fileInfo(), + ["selectors"], + selectors[0].getIndex(), + selectors[0].fileInfo(), function(err, result) { if (result) { selectors = utils.flattenArray(result); @@ -356,9 +356,9 @@ Ruleset.prototype = Object.assign(new Node(), { if (typeof decl.value.value === 'string') { this.parse.parseNode( decl.value.value, - ['value', 'important'], - decl.value.getIndex(), - decl.fileInfo(), + ['value', 'important'], + decl.value.getIndex(), + decl.fileInfo(), function(err, result) { if (err) { decl.parsed = true; diff --git a/packages/less/src/less/tree/selector.js b/packages/less/src/less/tree/selector.js index a198a7740..db6a846c7 100644 --- a/packages/less/src/less/tree/selector.js +++ b/packages/less/src/less/tree/selector.js @@ -1,6 +1,6 @@ -import Node from './node'; -import Element from './element'; -import LessError from '../less-error'; +import Node from './node.js'; +import Element from './element.js'; +import LessError from '../less-error.js'; const Selector = function(elements, extendList, condition, index, currentFileInfo, visibilityInfo) { this.extendList = extendList; @@ -44,10 +44,10 @@ Selector.prototype = Object.assign(new Node(), { } if (typeof els === 'string') { this.parse.parseNode( - els, + els, ['selector'], - this._index, - this._fileInfo, + this._index, + this._fileInfo, function(err, result) { if (err) { throw new LessError({ diff --git a/packages/less/src/less/tree/unicode-descriptor.js b/packages/less/src/less/tree/unicode-descriptor.js index 78a695065..c40e20942 100644 --- a/packages/less/src/less/tree/unicode-descriptor.js +++ b/packages/less/src/less/tree/unicode-descriptor.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const UnicodeDescriptor = function(value) { this.value = value; diff --git a/packages/less/src/less/tree/unit.js b/packages/less/src/less/tree/unit.js index 3943ad2c6..0e1bfa976 100644 --- a/packages/less/src/less/tree/unit.js +++ b/packages/less/src/less/tree/unit.js @@ -1,6 +1,6 @@ -import Node from './node'; -import unitConversions from '../data/unit-conversions'; -import * as utils from '../utils'; +import Node from './node.js'; +import unitConversions from '../data/unit-conversions.js'; +import * as utils from '../utils.js'; const Unit = function(numerator, denominator, backupUnit) { this.numerator = numerator ? utils.copyArray(numerator).sort() : []; diff --git a/packages/less/src/less/tree/url.js b/packages/less/src/less/tree/url.js index f0f329cab..0d25103ca 100644 --- a/packages/less/src/less/tree/url.js +++ b/packages/less/src/less/tree/url.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; function escapePath(path) { return path.replace(/[\(\)'"\s]/g, function(match) { return `\\${match}`; }); diff --git a/packages/less/src/less/tree/value.js b/packages/less/src/less/tree/value.js index b1eb57a89..73573bf5a 100644 --- a/packages/less/src/less/tree/value.js +++ b/packages/less/src/less/tree/value.js @@ -1,4 +1,4 @@ -import Node from './node'; +import Node from './node.js'; const Value = function(value) { if (!value) { diff --git a/packages/less/src/less/tree/variable-call.js b/packages/less/src/less/tree/variable-call.js index 9d1e8b941..0de63aca8 100644 --- a/packages/less/src/less/tree/variable-call.js +++ b/packages/less/src/less/tree/variable-call.js @@ -1,8 +1,8 @@ -import Node from './node'; -import Variable from './variable'; -import Ruleset from './ruleset'; -import DetachedRuleset from './detached-ruleset'; -import LessError from '../less-error'; +import Node from './node.js'; +import Variable from './variable.js'; +import Ruleset from './ruleset.js'; +import DetachedRuleset from './detached-ruleset.js'; +import LessError from '../less-error.js'; const VariableCall = function(variable, index, currentFileInfo) { this.variable = variable; diff --git a/packages/less/src/less/tree/variable.js b/packages/less/src/less/tree/variable.js index a81e3ecef..1a04b0d6d 100644 --- a/packages/less/src/less/tree/variable.js +++ b/packages/less/src/less/tree/variable.js @@ -1,5 +1,5 @@ -import Node from './node'; -import Call from './call'; +import Node from './node.js'; +import Call from './call.js'; const Variable = function(name, index, currentFileInfo) { this.name = name; diff --git a/packages/less/src/less/utils.js b/packages/less/src/less/utils.js index c0921b90d..01ac47173 100644 --- a/packages/less/src/less/utils.js +++ b/packages/less/src/less/utils.js @@ -1,5 +1,5 @@ /* jshint proto: true */ -import * as Constants from './constants'; +import * as Constants from './constants.js'; import { copy } from 'copy-anything'; export function getLocation(index, inputStream) { diff --git a/packages/less/src/less/visitors/extend-visitor.js b/packages/less/src/less/visitors/extend-visitor.js index 04a538f08..f7176d1c5 100644 --- a/packages/less/src/less/visitors/extend-visitor.js +++ b/packages/less/src/less/visitors/extend-visitor.js @@ -1,7 +1,7 @@ -import tree from '../tree'; -import Visitor from './visitor'; -import logger from '../logger'; -import * as utils from '../utils'; +import tree from '../tree/index.js'; +import Visitor from './visitor.js'; +import logger from '../logger.js'; +import * as utils from '../utils.js'; /* jshint loopfunc:true */