less 5.0.0-alpha.6 → 5.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/less-browser-dev.js +11 -11
- package/dist/less-node.cjs +28 -10
- package/lib/options.d.ts +7 -3
- package/lib/options.js +26 -8
- package/package.json +1 -1
package/dist/less-node.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Less - Leaner CSS v5.0.0-alpha.
|
|
2
|
+
* Less - Leaner CSS v5.0.0-alpha.7
|
|
3
3
|
* http://lesscss.org
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2009-2026, Alexis Sellier <self@cloudhead.net>
|
|
@@ -161,6 +161,25 @@ function stableStringify(value, seen = new WeakSet()) {
|
|
|
161
161
|
return `{${entries.join(',')}}`;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
/**
|
|
165
|
+
* `collapseNesting` accepts `false` (keep authored nesting — the v5 default),
|
|
166
|
+
* `'native'` (CSS Nesting desugaring: parent wrapped in `:is()`, child selector
|
|
167
|
+
* lists distributed, specificity-faithful), `'compact'` (like `'native'` but
|
|
168
|
+
* also folds same-combinator descendant runs into one `:is()`), or the
|
|
169
|
+
* deprecated boolean `true` (alias for `'native'`). Anything else is rejected.
|
|
170
|
+
* @param {unknown} value
|
|
171
|
+
* @returns {boolean|'native'|'compact'}
|
|
172
|
+
*/
|
|
173
|
+
function resolveCollapseNesting(value) {
|
|
174
|
+
if (value === false || value === true || value === 'native' || value === 'compact') {
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
throw new Error(
|
|
178
|
+
`collapseNesting must be false, 'native', 'compact', or true `
|
|
179
|
+
+ `(deprecated alias for 'native'); got ${JSON.stringify(value)}`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
164
183
|
/**
|
|
165
184
|
* Map Less render options to Jess compiler config.
|
|
166
185
|
* @param {import('./options.js').LessRenderOptions} [options] Less-style options
|
|
@@ -207,14 +226,13 @@ function createLessOptions(options) {
|
|
|
207
226
|
...(unitMode !== undefined && { unitMode }),
|
|
208
227
|
plugins,
|
|
209
228
|
},
|
|
210
|
-
// Less v5 preserves authored nesting unless
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
? [{ collapseNesting: opts.collapseNesting === true }]
|
|
229
|
+
// Less v5 preserves authored nesting unless `collapseNesting` requests a
|
|
230
|
+
// flattened projection. Pass the enum through unchanged; Jess owns the one
|
|
231
|
+
// renderer and its output mode. A file's styles.config may use an output
|
|
232
|
+
// array — a file-less output entry is the compiler's documented per-render
|
|
233
|
+
// override, so an explicit public Less option stays authoritative over it.
|
|
234
|
+
output: opts.collapseNesting !== undefined
|
|
235
|
+
? [{ collapseNesting: resolveCollapseNesting(opts.collapseNesting) }]
|
|
218
236
|
: {},
|
|
219
237
|
language: {},
|
|
220
238
|
};
|
|
@@ -261,7 +279,7 @@ function mapRenderResult(result, options) {
|
|
|
261
279
|
* @module less/lib/version
|
|
262
280
|
*/
|
|
263
281
|
|
|
264
|
-
const semver = "5.0.0-alpha.
|
|
282
|
+
const semver = "5.0.0-alpha.7";
|
|
265
283
|
const parsed = parseNodeVersion__default["default"](`v${semver}`);
|
|
266
284
|
|
|
267
285
|
const version = {
|
package/lib/options.d.ts
CHANGED
|
@@ -13,10 +13,14 @@ export interface LessRenderOptions {
|
|
|
13
13
|
plugins?: unknown[];
|
|
14
14
|
math?: number | 'always' | 'parens-division' | 'parens' | 'strict';
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* How to flatten authored nesting. Less v5 preserves authored nesting by
|
|
17
|
+
* default (`false`). `'native'` applies the CSS Nesting desugaring (parent
|
|
18
|
+
* wrapped in `:is()`, child selector lists distributed — specificity-faithful,
|
|
19
|
+
* matching the browser and Less 4.x); `'compact'` additionally folds
|
|
20
|
+
* same-combinator descendant runs into a single `:is()`. `true` is a
|
|
21
|
+
* deprecated alias for `'native'`.
|
|
18
22
|
*/
|
|
19
|
-
collapseNesting?: boolean;
|
|
23
|
+
collapseNesting?: boolean | 'native' | 'compact';
|
|
20
24
|
/** @internal Jess alpha benchmark-only flag for source graphs already proven @plugin-free. */
|
|
21
25
|
__jessSkipLessCompatWhenPluginFree?: boolean;
|
|
22
26
|
}
|
package/lib/options.js
CHANGED
|
@@ -64,6 +64,25 @@ function stableStringify(value, seen = new WeakSet()) {
|
|
|
64
64
|
return `{${entries.join(',')}}`;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* `collapseNesting` accepts `false` (keep authored nesting — the v5 default),
|
|
69
|
+
* `'native'` (CSS Nesting desugaring: parent wrapped in `:is()`, child selector
|
|
70
|
+
* lists distributed, specificity-faithful), `'compact'` (like `'native'` but
|
|
71
|
+
* also folds same-combinator descendant runs into one `:is()`), or the
|
|
72
|
+
* deprecated boolean `true` (alias for `'native'`). Anything else is rejected.
|
|
73
|
+
* @param {unknown} value
|
|
74
|
+
* @returns {boolean|'native'|'compact'}
|
|
75
|
+
*/
|
|
76
|
+
function resolveCollapseNesting(value) {
|
|
77
|
+
if (value === false || value === true || value === 'native' || value === 'compact') {
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
throw new Error(
|
|
81
|
+
`collapseNesting must be false, 'native', 'compact', or true `
|
|
82
|
+
+ `(deprecated alias for 'native'); got ${JSON.stringify(value)}`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
67
86
|
/**
|
|
68
87
|
* Map Less render options to Jess compiler config.
|
|
69
88
|
* @param {import('./options.js').LessRenderOptions} [options] Less-style options
|
|
@@ -110,14 +129,13 @@ export function createLessOptions(options) {
|
|
|
110
129
|
...(unitMode !== undefined && { unitMode }),
|
|
111
130
|
plugins,
|
|
112
131
|
},
|
|
113
|
-
// Less v5 preserves authored nesting unless
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
? [{ collapseNesting: opts.collapseNesting === true }]
|
|
132
|
+
// Less v5 preserves authored nesting unless `collapseNesting` requests a
|
|
133
|
+
// flattened projection. Pass the enum through unchanged; Jess owns the one
|
|
134
|
+
// renderer and its output mode. A file's styles.config may use an output
|
|
135
|
+
// array — a file-less output entry is the compiler's documented per-render
|
|
136
|
+
// override, so an explicit public Less option stays authoritative over it.
|
|
137
|
+
output: opts.collapseNesting !== undefined
|
|
138
|
+
? [{ collapseNesting: resolveCollapseNesting(opts.collapseNesting) }]
|
|
121
139
|
: {},
|
|
122
140
|
language: {},
|
|
123
141
|
};
|