less 4.5.1 → 4.6.0

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