less 4.9.1 → 5.0.0-alpha.10

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.
Files changed (134) hide show
  1. package/README.md +23 -5
  2. package/V5-STATUS.md +71 -0
  3. package/bin/lessc +302 -626
  4. package/dist/less-browser-dev.js +2550 -0
  5. package/dist/less-node.cjs +480 -14561
  6. package/index.cjs +5 -2
  7. package/lib/browser-dev.js +86 -0
  8. package/lib/index.js +164 -0
  9. package/lib/lessc-helper.js +64 -0
  10. package/lib/logger.js +76 -0
  11. package/lib/options.d.ts +82 -0
  12. package/lib/options.js +227 -0
  13. package/lib/types.js +20 -0
  14. package/lib/version.js +19 -0
  15. package/package.json +36 -40
  16. package/dist/less.cjs +0 -15218
  17. package/dist/less.js +0 -15218
  18. package/dist/less.min.js +0 -11
  19. package/dist/less.min.js.map +0 -1
  20. package/lib/less/constants.js +0 -13
  21. package/lib/less/contexts.js +0 -165
  22. package/lib/less/data/colors.js +0 -150
  23. package/lib/less/data/index.js +0 -4
  24. package/lib/less/data/unit-conversions.js +0 -21
  25. package/lib/less/default-options.js +0 -89
  26. package/lib/less/deprecation.js +0 -82
  27. package/lib/less/environment/abstract-file-manager.js +0 -140
  28. package/lib/less/environment/abstract-plugin-loader.js +0 -185
  29. package/lib/less/environment/environment-api.ts +0 -21
  30. package/lib/less/environment/environment.js +0 -59
  31. package/lib/less/environment/file-manager-api.ts +0 -77
  32. package/lib/less/functions/boolean.js +0 -29
  33. package/lib/less/functions/color-blending.js +0 -85
  34. package/lib/less/functions/color.js +0 -452
  35. package/lib/less/functions/data-uri.js +0 -74
  36. package/lib/less/functions/default.js +0 -26
  37. package/lib/less/functions/function-caller.js +0 -55
  38. package/lib/less/functions/function-registry.js +0 -36
  39. package/lib/less/functions/index.js +0 -35
  40. package/lib/less/functions/list.js +0 -158
  41. package/lib/less/functions/math-helper.js +0 -22
  42. package/lib/less/functions/math.js +0 -30
  43. package/lib/less/functions/number.js +0 -95
  44. package/lib/less/functions/string.js +0 -39
  45. package/lib/less/functions/style.js +0 -29
  46. package/lib/less/functions/svg.js +0 -87
  47. package/lib/less/functions/types.js +0 -70
  48. package/lib/less/import-manager.js +0 -183
  49. package/lib/less/index.js +0 -95
  50. package/lib/less/less-error.js +0 -166
  51. package/lib/less/logger.js +0 -34
  52. package/lib/less/parse-tree.js +0 -124
  53. package/lib/less/parse.js +0 -87
  54. package/lib/less/parser/lookup-pattern.js +0 -26
  55. package/lib/less/parser/parser-input.js +0 -400
  56. package/lib/less/parser/parser.js +0 -2998
  57. package/lib/less/plugin-manager.js +0 -168
  58. package/lib/less/render.js +0 -41
  59. package/lib/less/source-map-builder.js +0 -82
  60. package/lib/less/source-map-output.js +0 -151
  61. package/lib/less/transform-tree.js +0 -102
  62. package/lib/less/tree/anonymous.js +0 -61
  63. package/lib/less/tree/assignment.js +0 -48
  64. package/lib/less/tree/atrule-syntax.js +0 -8
  65. package/lib/less/tree/atrule.js +0 -340
  66. package/lib/less/tree/attribute.js +0 -63
  67. package/lib/less/tree/call.js +0 -132
  68. package/lib/less/tree/color.js +0 -285
  69. package/lib/less/tree/combinator.js +0 -38
  70. package/lib/less/tree/comment.js +0 -48
  71. package/lib/less/tree/condition.js +0 -65
  72. package/lib/less/tree/container.js +0 -104
  73. package/lib/less/tree/debug-info.js +0 -80
  74. package/lib/less/tree/declaration.js +0 -142
  75. package/lib/less/tree/detached-ruleset.js +0 -45
  76. package/lib/less/tree/dimension.js +0 -215
  77. package/lib/less/tree/element.js +0 -93
  78. package/lib/less/tree/expression.js +0 -100
  79. package/lib/less/tree/extend.js +0 -88
  80. package/lib/less/tree/import.js +0 -299
  81. package/lib/less/tree/index.js +0 -56
  82. package/lib/less/tree/interpolated-variable.js +0 -106
  83. package/lib/less/tree/javascript.js +0 -45
  84. package/lib/less/tree/js-eval-node.js +0 -80
  85. package/lib/less/tree/keyword.js +0 -28
  86. package/lib/less/tree/media.js +0 -90
  87. package/lib/less/tree/merge-rules.js +0 -47
  88. package/lib/less/tree/mixin-call.js +0 -283
  89. package/lib/less/tree/mixin-definition.js +0 -319
  90. package/lib/less/tree/namespace-value.js +0 -95
  91. package/lib/less/tree/negative.js +0 -37
  92. package/lib/less/tree/nested-at-rule.js +0 -239
  93. package/lib/less/tree/node.js +0 -310
  94. package/lib/less/tree/operation.js +0 -81
  95. package/lib/less/tree/paren.js +0 -41
  96. package/lib/less/tree/property.js +0 -96
  97. package/lib/less/tree/query-in-parens.js +0 -64
  98. package/lib/less/tree/quoted.js +0 -131
  99. package/lib/less/tree/ruleset.js +0 -1068
  100. package/lib/less/tree/selector.js +0 -201
  101. package/lib/less/tree/unicode-descriptor.js +0 -14
  102. package/lib/less/tree/unit.js +0 -170
  103. package/lib/less/tree/url.js +0 -83
  104. package/lib/less/tree/value.js +0 -60
  105. package/lib/less/tree/variable-call.js +0 -60
  106. package/lib/less/tree/variable.js +0 -85
  107. package/lib/less/utils.js +0 -126
  108. package/lib/less/visitors/extend-visitor.js +0 -505
  109. package/lib/less/visitors/import-sequencer.js +0 -56
  110. package/lib/less/visitors/import-visitor.js +0 -203
  111. package/lib/less/visitors/index.js +0 -15
  112. package/lib/less/visitors/join-selector-visitor.js +0 -65
  113. package/lib/less/visitors/set-tree-visibility-visitor.js +0 -57
  114. package/lib/less/visitors/to-css-visitor.js +0 -332
  115. package/lib/less/visitors/visitor.js +0 -165
  116. package/lib/less-browser/add-default-options.js +0 -53
  117. package/lib/less-browser/bootstrap.js +0 -67
  118. package/lib/less-browser/browser.js +0 -65
  119. package/lib/less-browser/cache.js +0 -43
  120. package/lib/less-browser/error-reporting.js +0 -170
  121. package/lib/less-browser/file-manager.js +0 -112
  122. package/lib/less-browser/image-size.js +0 -28
  123. package/lib/less-browser/index.js +0 -284
  124. package/lib/less-browser/log-listener.js +0 -42
  125. package/lib/less-browser/plugin-loader.js +0 -24
  126. package/lib/less-browser/utils.js +0 -30
  127. package/lib/less-node/environment.js +0 -43
  128. package/lib/less-node/file-manager.js +0 -156
  129. package/lib/less-node/fs.js +0 -14
  130. package/lib/less-node/image-size.js +0 -78
  131. package/lib/less-node/index.js +0 -31
  132. package/lib/less-node/lessc-helper.js +0 -95
  133. package/lib/less-node/plugin-loader.js +0 -62
  134. package/lib/less-node/url-file-manager.js +0 -60
@@ -1,13 +0,0 @@
1
-
2
- export const Math = {
3
- ALWAYS: 0,
4
- PARENS_DIVISION: 1,
5
- PARENS: 2
6
- // removed - STRICT_LEGACY: 3
7
- };
8
-
9
- export const RewriteUrls = {
10
- OFF: 0,
11
- LOCAL: 1,
12
- ALL: 2
13
- };
@@ -1,165 +0,0 @@
1
- const contexts = {};
2
- export default contexts;
3
- import * as Constants from './constants.js';
4
-
5
- const copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) {
6
- if (!original) { return; }
7
-
8
- for (let i = 0; i < propertiesToCopy.length; i++) {
9
- if (Object.prototype.hasOwnProperty.call(original, propertiesToCopy[i])) {
10
- destination[propertiesToCopy[i]] = original[propertiesToCopy[i]];
11
- }
12
- }
13
- };
14
-
15
- /*
16
- parse is used whilst parsing
17
- */
18
- const parseCopyProperties = [
19
- // options
20
- 'paths', // option - unmodified - paths to search for imports on
21
- 'rewriteUrls', // option - whether to adjust URL's to be relative
22
- 'rootpath', // option - rootpath to append to URL's
23
- 'strictImports', // option -
24
- 'insecure', // option - whether to allow imports from insecure ssl hosts
25
- 'dumpLineNumbers', // option - @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. All modes ('comments', 'mediaquery', 'all') will be removed in a future version.
26
- 'compress', // option - whether to compress
27
- 'syncImport', // option - whether to import synchronously
28
- 'mime', // browser only - mime type for sheet import
29
- 'useFileCache', // browser only - whether to use the per file session cache
30
- // context
31
- 'processImports', // option & context - whether to process imports. if false then imports will not be imported.
32
- // Used by the import manager to stop multiple import visitors being created.
33
- 'pluginManager', // Used as the plugin manager for the session
34
- 'quiet', // option - whether to log warnings
35
- 'quietDeprecations', // option - whether to suppress deprecation warnings only
36
- ];
37
-
38
- contexts.Parse = function(options) {
39
- copyFromOriginal(options, this, parseCopyProperties);
40
-
41
- if (typeof this.paths === 'string') { this.paths = [this.paths]; }
42
- };
43
-
44
- const evalCopyProperties = [
45
- 'paths', // additional include paths
46
- 'compress', // whether to compress
47
- 'math', // whether math has to be within parenthesis
48
- 'strictUnits', // whether units need to evaluate correctly
49
- 'sourceMap', // whether to output a source map
50
- 'importMultiple', // whether we are currently importing multiple copies
51
- 'urlArgs', // whether to add args into url tokens
52
- 'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false
53
- 'pluginManager', // Used as the plugin manager for the session
54
- 'importantScope', // used to bubble up !important statements
55
- 'rewriteUrls' // option - whether to adjust URL's to be relative
56
- ];
57
-
58
- contexts.Eval = function(options, frames) {
59
- copyFromOriginal(options, this, evalCopyProperties);
60
-
61
- if (typeof this.paths === 'string') { this.paths = [this.paths]; }
62
-
63
- this.frames = frames || [];
64
- this.importantScope = this.importantScope || [];
65
- };
66
-
67
- contexts.Eval.prototype.enterCalc = function () {
68
- if (!this.calcStack) {
69
- this.calcStack = [];
70
- }
71
- this.calcStack.push(true);
72
- this.inCalc = true;
73
- };
74
-
75
- contexts.Eval.prototype.exitCalc = function () {
76
- this.calcStack.pop();
77
- if (!this.calcStack.length) {
78
- this.inCalc = false;
79
- }
80
- };
81
-
82
- contexts.Eval.prototype.inParenthesis = function () {
83
- if (!this.parensStack) {
84
- this.parensStack = [];
85
- }
86
- this.parensStack.push(true);
87
- };
88
-
89
- contexts.Eval.prototype.outOfParenthesis = function () {
90
- this.parensStack.pop();
91
- };
92
-
93
- contexts.Eval.prototype.inCalc = false;
94
- contexts.Eval.prototype.mathOn = true;
95
- contexts.Eval.prototype.isMathOn = function (op) {
96
- if (!this.mathOn) {
97
- return false;
98
- }
99
- if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {
100
- return false;
101
- }
102
- if (this.math > Constants.Math.PARENS_DIVISION) {
103
- return this.parensStack && this.parensStack.length;
104
- }
105
- return true;
106
- };
107
-
108
- contexts.Eval.prototype.pathRequiresRewrite = function (path) {
109
- const isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;
110
-
111
- return isRelative(path);
112
- };
113
-
114
- contexts.Eval.prototype.rewritePath = function (path, rootpath) {
115
- let newPath;
116
-
117
- rootpath = rootpath || '';
118
- newPath = this.normalizePath(rootpath + path);
119
-
120
- // If a path was explicit relative and the rootpath was not an absolute path
121
- // we must ensure that the new path is also explicit relative.
122
- if (isPathLocalRelative(path) &&
123
- isPathRelative(rootpath) &&
124
- isPathLocalRelative(newPath) === false) {
125
- newPath = `./${newPath}`;
126
- }
127
-
128
- return newPath;
129
- };
130
-
131
- contexts.Eval.prototype.normalizePath = function (path) {
132
- const segments = path.split('/').reverse();
133
- let segment;
134
-
135
- path = [];
136
- while (segments.length !== 0) {
137
- segment = segments.pop();
138
- switch ( segment ) {
139
- case '.':
140
- break;
141
- case '..':
142
- if ((path.length === 0) || (path[path.length - 1] === '..')) {
143
- path.push( segment );
144
- } else {
145
- path.pop();
146
- }
147
- break;
148
- default:
149
- path.push(segment);
150
- break;
151
- }
152
- }
153
-
154
- return path.join('/');
155
- };
156
-
157
- function isPathRelative(path) {
158
- return !/^(?:[a-z-]+:|\/|#)/i.test(path);
159
- }
160
-
161
- function isPathLocalRelative(path) {
162
- return path.charAt(0) === '.';
163
- }
164
-
165
- // todo - do the same for the toCSS ?
@@ -1,150 +0,0 @@
1
- export default {
2
- 'aliceblue':'#f0f8ff',
3
- 'antiquewhite':'#faebd7',
4
- 'aqua':'#00ffff',
5
- 'aquamarine':'#7fffd4',
6
- 'azure':'#f0ffff',
7
- 'beige':'#f5f5dc',
8
- 'bisque':'#ffe4c4',
9
- 'black':'#000000',
10
- 'blanchedalmond':'#ffebcd',
11
- 'blue':'#0000ff',
12
- 'blueviolet':'#8a2be2',
13
- 'brown':'#a52a2a',
14
- 'burlywood':'#deb887',
15
- 'cadetblue':'#5f9ea0',
16
- 'chartreuse':'#7fff00',
17
- 'chocolate':'#d2691e',
18
- 'coral':'#ff7f50',
19
- 'cornflowerblue':'#6495ed',
20
- 'cornsilk':'#fff8dc',
21
- 'crimson':'#dc143c',
22
- 'cyan':'#00ffff',
23
- 'darkblue':'#00008b',
24
- 'darkcyan':'#008b8b',
25
- 'darkgoldenrod':'#b8860b',
26
- 'darkgray':'#a9a9a9',
27
- 'darkgrey':'#a9a9a9',
28
- 'darkgreen':'#006400',
29
- 'darkkhaki':'#bdb76b',
30
- 'darkmagenta':'#8b008b',
31
- 'darkolivegreen':'#556b2f',
32
- 'darkorange':'#ff8c00',
33
- 'darkorchid':'#9932cc',
34
- 'darkred':'#8b0000',
35
- 'darksalmon':'#e9967a',
36
- 'darkseagreen':'#8fbc8f',
37
- 'darkslateblue':'#483d8b',
38
- 'darkslategray':'#2f4f4f',
39
- 'darkslategrey':'#2f4f4f',
40
- 'darkturquoise':'#00ced1',
41
- 'darkviolet':'#9400d3',
42
- 'deeppink':'#ff1493',
43
- 'deepskyblue':'#00bfff',
44
- 'dimgray':'#696969',
45
- 'dimgrey':'#696969',
46
- 'dodgerblue':'#1e90ff',
47
- 'firebrick':'#b22222',
48
- 'floralwhite':'#fffaf0',
49
- 'forestgreen':'#228b22',
50
- 'fuchsia':'#ff00ff',
51
- 'gainsboro':'#dcdcdc',
52
- 'ghostwhite':'#f8f8ff',
53
- 'gold':'#ffd700',
54
- 'goldenrod':'#daa520',
55
- 'gray':'#808080',
56
- 'grey':'#808080',
57
- 'green':'#008000',
58
- 'greenyellow':'#adff2f',
59
- 'honeydew':'#f0fff0',
60
- 'hotpink':'#ff69b4',
61
- 'indianred':'#cd5c5c',
62
- 'indigo':'#4b0082',
63
- 'ivory':'#fffff0',
64
- 'khaki':'#f0e68c',
65
- 'lavender':'#e6e6fa',
66
- 'lavenderblush':'#fff0f5',
67
- 'lawngreen':'#7cfc00',
68
- 'lemonchiffon':'#fffacd',
69
- 'lightblue':'#add8e6',
70
- 'lightcoral':'#f08080',
71
- 'lightcyan':'#e0ffff',
72
- 'lightgoldenrodyellow':'#fafad2',
73
- 'lightgray':'#d3d3d3',
74
- 'lightgrey':'#d3d3d3',
75
- 'lightgreen':'#90ee90',
76
- 'lightpink':'#ffb6c1',
77
- 'lightsalmon':'#ffa07a',
78
- 'lightseagreen':'#20b2aa',
79
- 'lightskyblue':'#87cefa',
80
- 'lightslategray':'#778899',
81
- 'lightslategrey':'#778899',
82
- 'lightsteelblue':'#b0c4de',
83
- 'lightyellow':'#ffffe0',
84
- 'lime':'#00ff00',
85
- 'limegreen':'#32cd32',
86
- 'linen':'#faf0e6',
87
- 'magenta':'#ff00ff',
88
- 'maroon':'#800000',
89
- 'mediumaquamarine':'#66cdaa',
90
- 'mediumblue':'#0000cd',
91
- 'mediumorchid':'#ba55d3',
92
- 'mediumpurple':'#9370d8',
93
- 'mediumseagreen':'#3cb371',
94
- 'mediumslateblue':'#7b68ee',
95
- 'mediumspringgreen':'#00fa9a',
96
- 'mediumturquoise':'#48d1cc',
97
- 'mediumvioletred':'#c71585',
98
- 'midnightblue':'#191970',
99
- 'mintcream':'#f5fffa',
100
- 'mistyrose':'#ffe4e1',
101
- 'moccasin':'#ffe4b5',
102
- 'navajowhite':'#ffdead',
103
- 'navy':'#000080',
104
- 'oldlace':'#fdf5e6',
105
- 'olive':'#808000',
106
- 'olivedrab':'#6b8e23',
107
- 'orange':'#ffa500',
108
- 'orangered':'#ff4500',
109
- 'orchid':'#da70d6',
110
- 'palegoldenrod':'#eee8aa',
111
- 'palegreen':'#98fb98',
112
- 'paleturquoise':'#afeeee',
113
- 'palevioletred':'#d87093',
114
- 'papayawhip':'#ffefd5',
115
- 'peachpuff':'#ffdab9',
116
- 'peru':'#cd853f',
117
- 'pink':'#ffc0cb',
118
- 'plum':'#dda0dd',
119
- 'powderblue':'#b0e0e6',
120
- 'purple':'#800080',
121
- 'rebeccapurple':'#663399',
122
- 'red':'#ff0000',
123
- 'rosybrown':'#bc8f8f',
124
- 'royalblue':'#4169e1',
125
- 'saddlebrown':'#8b4513',
126
- 'salmon':'#fa8072',
127
- 'sandybrown':'#f4a460',
128
- 'seagreen':'#2e8b57',
129
- 'seashell':'#fff5ee',
130
- 'sienna':'#a0522d',
131
- 'silver':'#c0c0c0',
132
- 'skyblue':'#87ceeb',
133
- 'slateblue':'#6a5acd',
134
- 'slategray':'#708090',
135
- 'slategrey':'#708090',
136
- 'snow':'#fffafa',
137
- 'springgreen':'#00ff7f',
138
- 'steelblue':'#4682b4',
139
- 'tan':'#d2b48c',
140
- 'teal':'#008080',
141
- 'thistle':'#d8bfd8',
142
- 'tomato':'#ff6347',
143
- 'turquoise':'#40e0d0',
144
- 'violet':'#ee82ee',
145
- 'wheat':'#f5deb3',
146
- 'white':'#ffffff',
147
- 'whitesmoke':'#f5f5f5',
148
- 'yellow':'#ffff00',
149
- 'yellowgreen':'#9acd32'
150
- };
@@ -1,4 +0,0 @@
1
- import colors from './colors.js';
2
- import unitConversions from './unit-conversions.js';
3
-
4
- export default { colors, unitConversions };
@@ -1,21 +0,0 @@
1
- export default {
2
- length: {
3
- 'm': 1,
4
- 'cm': 0.01,
5
- 'mm': 0.001,
6
- 'in': 0.0254,
7
- 'px': 0.0254 / 96,
8
- 'pt': 0.0254 / 72,
9
- 'pc': 0.0254 / 72 * 12
10
- },
11
- duration: {
12
- 's': 1,
13
- 'ms': 0.001
14
- },
15
- angle: {
16
- 'rad': 1 / (2 * Math.PI),
17
- 'deg': 1 / 360,
18
- 'grad': 1 / 400,
19
- 'turn': 1
20
- }
21
- };
@@ -1,89 +0,0 @@
1
- // Export a new default each time
2
- export default function() {
3
- return {
4
- /* Inline Javascript - @plugin still allowed */
5
- javascriptEnabled: false,
6
-
7
- /* Outputs a makefile import dependency list to stdout. */
8
- depends: false,
9
-
10
- /* (DEPRECATED) Compress using less built-in compression.
11
- * This does an okay job but does not utilise all the tricks of
12
- * dedicated css compression. */
13
- compress: false,
14
-
15
- /* Runs the less parser and just reports errors without any output. */
16
- lint: false,
17
-
18
- /* Sets available include paths.
19
- * If the file in an @import rule does not exist at that exact location,
20
- * less will look for it at the location(s) passed to this option.
21
- * You might use this for instance to specify a path to a library which
22
- * you want to be referenced simply and relatively in the less files. */
23
- paths: [],
24
-
25
- /* color output in the terminal */
26
- color: true,
27
-
28
- /**
29
- * @deprecated This option has confusing behavior and may be removed in a future version.
30
- *
31
- * When true, prevents @import statements for .less files from being evaluated inside
32
- * selector blocks (rulesets). The imports are silently ignored and not output.
33
- *
34
- * Behavior:
35
- * - @import at root level: Always processed
36
- * - @import inside @-rules (@media, @supports, etc.): Processed (these are not selector blocks)
37
- * - @import inside selector blocks (.class, #id, etc.): NOT processed (silently ignored)
38
- *
39
- * When false (default): All @import statements are processed regardless of context.
40
- *
41
- * Note: Despite the name "strict", this option does NOT throw an error when imports
42
- * are used in selector blocks - it silently ignores them. This is confusing
43
- * behavior that may catch users off guard.
44
- *
45
- * Note: Only affects .less file imports. CSS imports (url(...) or .css files) are
46
- * always output as CSS @import statements regardless of this setting.
47
- *
48
- * @see https://github.com/less/less.js/issues/656
49
- */
50
- strictImports: false,
51
-
52
- /* Allow Imports from Insecure HTTPS Hosts */
53
- insecure: false,
54
-
55
- /* Allows you to add a path to every generated import and url in your css.
56
- * This does not affect less import statements that are processed, just ones
57
- * that are left in the output css. */
58
- rootpath: '',
59
-
60
- /* By default URLs are kept as-is, so if you import a file in a sub-directory
61
- * that references an image, exactly the same URL will be output in the css.
62
- * This option allows you to re-write URL's in imported files so that the
63
- * URL is always relative to the base imported file */
64
- rewriteUrls: false,
65
-
66
- /* How to process math
67
- * 0 always - eagerly try to solve all operations
68
- * 1 parens-division - require parens for division "/"
69
- * 2 parens | strict - require parens for all operations
70
- * 3 strict-legacy - legacy strict behavior (super-strict)
71
- */
72
- math: 1,
73
-
74
- /* Without this option, less attempts to guess at the output unit when it does maths. */
75
- strictUnits: false,
76
-
77
- /* Effectively the declaration is put at the top of your base Less file,
78
- * meaning it can be used but it also can be overridden if this variable
79
- * is defined in the file. */
80
- globalVars: null,
81
-
82
- /* As opposed to the global variable option, this puts the declaration at the
83
- * end of your base file, meaning it will override anything defined in your Less file. */
84
- modifyVars: null,
85
-
86
- /* This option allows you to specify a argument to go on to every URL. */
87
- urlArgs: ''
88
- }
89
- }
@@ -1,82 +0,0 @@
1
- /**
2
- * Deprecation registry for Less.js
3
- *
4
- * Each deprecation has a unique ID and description.
5
- * Repetition limiting caps warnings at 5 per deprecation type per parse.
6
- * Use --quiet-deprecations to suppress all deprecation warnings.
7
- */
8
-
9
- const deprecations = {
10
- 'mixin-call-no-parens': {
11
- description: 'Calling a mixin without parentheses is deprecated.'
12
- },
13
- 'mixin-call-whitespace': {
14
- description: 'Whitespace between a mixin name and parentheses for a mixin call is deprecated.'
15
- },
16
- 'dot-slash-operator': {
17
- description: 'The ./ operator is deprecated.'
18
- },
19
- 'variable-in-unknown-value': {
20
- description: '@variable in custom property values is treated as literal text.'
21
- },
22
- 'variable-in-at-rule-prelude': {
23
- description: 'A bare @variable in an at-rule prelude (e.g. @media @foo) is deprecated. Use @{variable} interpolation instead.'
24
- },
25
- 'numeric-variable-name': {
26
- description: 'Variable names beginning with a number are deprecated and will be removed in Less 5.x.'
27
- },
28
- 'dash-only-variable-name': {
29
- description: 'The dash-only variable names @- and @{-} are deprecated and will be removed in Less 5.x.'
30
- },
31
- 'dash-only-mixin-name': {
32
- description: 'The dash-only mixin names .-() and #-() are deprecated and will be removed in Less 5.x.'
33
- },
34
- 'dynamic-charset': {
35
- description: 'Dynamic @charset interpolation is deprecated and will be removed in Less 5.x.'
36
- },
37
- 'property-in-unknown-value': {
38
- description: '$property in custom property values is treated as literal text.'
39
- },
40
- 'js-eval': {
41
- description: 'Inline JavaScript evaluation (backtick expressions) is deprecated and will be removed in Less 5.x.'
42
- },
43
- 'at-plugin': {
44
- description: 'The @plugin directive is deprecated and will be replaced in Less 5.x.'
45
- },
46
- 'dump-line-numbers': {
47
- description: 'The dumpLineNumbers option is deprecated and will be removed in Less 5.x.'
48
- },
49
- 'math-always': {
50
- description: '--math=always is deprecated and will be removed in Less 5.x.'
51
- }
52
- };
53
-
54
- const MAX_REPETITIONS = 5;
55
-
56
- class DeprecationHandler {
57
- constructor() {
58
- /** @type {Record<string, number>} */
59
- this._counts = {};
60
- }
61
-
62
- /** @param {string} deprecationId */
63
- shouldWarn(deprecationId) {
64
- if (!deprecationId) { return true; }
65
- const count = (this._counts[deprecationId] || 0) + 1;
66
- this._counts[deprecationId] = count;
67
- return count <= MAX_REPETITIONS;
68
- }
69
-
70
- /** @param {{ warn: (msg: string) => void }} logger */
71
- summarize(logger) {
72
- for (const id of Object.keys(this._counts)) {
73
- const omitted = this._counts[id] - MAX_REPETITIONS;
74
- if (omitted > 0) {
75
- logger.warn(`${omitted} repetitive "${id}" deprecation warning(s) omitted.`);
76
- }
77
- }
78
- }
79
- }
80
-
81
- export { deprecations, DeprecationHandler, MAX_REPETITIONS };
82
- export default { deprecations, DeprecationHandler };
@@ -1,140 +0,0 @@
1
- class AbstractFileManager {
2
- getPath(filename) {
3
- let j = filename.lastIndexOf('?');
4
- if (j > 0) {
5
- filename = filename.slice(0, j);
6
- }
7
- j = filename.lastIndexOf('/');
8
- if (j < 0) {
9
- j = filename.lastIndexOf('\\');
10
- }
11
- if (j < 0) {
12
- return '';
13
- }
14
- return filename.slice(0, j + 1);
15
- }
16
-
17
- tryAppendExtension(path, ext) {
18
- return /(\.[a-z]*$)|([?;].*)$/.test(path) ? path : path + ext;
19
- }
20
-
21
- tryAppendLessExtension(path) {
22
- return this.tryAppendExtension(path, '.less');
23
- }
24
-
25
- supportsSync() {
26
- return false;
27
- }
28
-
29
- alwaysMakePathsAbsolute() {
30
- return false;
31
- }
32
-
33
- isPathAbsolute(filename) {
34
- return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename);
35
- }
36
-
37
- // TODO: pull out / replace?
38
- join(basePath, laterPath) {
39
- if (!basePath) {
40
- return laterPath;
41
- }
42
- return basePath + laterPath;
43
- }
44
-
45
- pathDiff(url, baseUrl) {
46
- // diff between two paths to create a relative path
47
-
48
- const urlParts = this.extractUrlParts(url);
49
-
50
- const baseUrlParts = this.extractUrlParts(baseUrl);
51
- let i;
52
- let max;
53
- let urlDirectories;
54
- let baseUrlDirectories;
55
- let diff = '';
56
- if (urlParts.hostPart !== baseUrlParts.hostPart) {
57
- return '';
58
- }
59
- max = Math.max(baseUrlParts.directories.length, urlParts.directories.length);
60
- for (i = 0; i < max; i++) {
61
- if (baseUrlParts.directories[i] !== urlParts.directories[i]) { break; }
62
- }
63
- baseUrlDirectories = baseUrlParts.directories.slice(i);
64
- urlDirectories = urlParts.directories.slice(i);
65
- for (i = 0; i < baseUrlDirectories.length - 1; i++) {
66
- diff += '../';
67
- }
68
- for (i = 0; i < urlDirectories.length - 1; i++) {
69
- diff += `${urlDirectories[i]}/`;
70
- }
71
- return diff;
72
- }
73
-
74
- /**
75
- * Helper function, not part of API.
76
- * This should be replaceable by newer Node / Browser APIs
77
- *
78
- * @param {string} url
79
- * @param {string} baseUrl
80
- */
81
- extractUrlParts(url, baseUrl) {
82
- // urlParts[1] = protocol://hostname/ OR /
83
- // urlParts[2] = / if path relative to host base
84
- // urlParts[3] = directories
85
- // urlParts[4] = filename
86
- // urlParts[5] = parameters
87
-
88
- const urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^/?#]*\/)|([/\\]))?((?:[^/\\?#]*[/\\])*)([^/\\?#]*)([#?].*)?$/i;
89
-
90
- const urlParts = url.match(urlPartsRegex);
91
- const returner = {};
92
- let rawDirectories = [];
93
- const directories = [];
94
- let i;
95
- let baseUrlParts;
96
-
97
- if (!urlParts) {
98
- throw new Error(`Could not parse sheet href - '${url}'`);
99
- }
100
-
101
- // Stylesheets in IE don't always return the full path
102
- if (baseUrl && (!urlParts[1] || urlParts[2])) {
103
- baseUrlParts = baseUrl.match(urlPartsRegex);
104
- if (!baseUrlParts) {
105
- throw new Error(`Could not parse page url - '${baseUrl}'`);
106
- }
107
- urlParts[1] = urlParts[1] || baseUrlParts[1] || '';
108
- if (!urlParts[2]) {
109
- urlParts[3] = baseUrlParts[3] + urlParts[3];
110
- }
111
- }
112
-
113
- if (urlParts[3]) {
114
- rawDirectories = urlParts[3].replace(/\\/g, '/').split('/');
115
-
116
- // collapse '..' and skip '.'
117
- for (i = 0; i < rawDirectories.length; i++) {
118
-
119
- if (rawDirectories[i] === '..') {
120
- directories.pop();
121
- }
122
- else if (rawDirectories[i] !== '.') {
123
- directories.push(rawDirectories[i]);
124
- }
125
-
126
- }
127
- }
128
-
129
- returner.hostPart = urlParts[1];
130
- returner.directories = directories;
131
- returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/');
132
- returner.path = (urlParts[1] || '') + directories.join('/');
133
- returner.filename = urlParts[4];
134
- returner.fileUrl = returner.path + (urlParts[4] || '');
135
- returner.url = returner.fileUrl + (urlParts[5] || '');
136
- return returner;
137
- }
138
- }
139
-
140
- export default AbstractFileManager;