@jesscss/plugin-less 2.0.0-alpha.5 → 2.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/lib/index.cjs +233 -0
- package/lib/index.d.ts +24 -7
- package/lib/index.js +201 -262
- package/package.json +12 -15
- package/lib/index.js.map +0 -1
- package/lib/options.js +0 -2
- package/lib/options.js.map +0 -1
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __create = Object.create;
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
let _jesscss_core = require("@jesscss/core");
|
|
28
|
+
let _jesscss_fns = require("@jesscss/fns");
|
|
29
|
+
_jesscss_fns = __toESM(_jesscss_fns);
|
|
30
|
+
let _jesscss_less_parser_jess = require("@jesscss/less-parser/jess");
|
|
31
|
+
let node_path = require("node:path");
|
|
32
|
+
node_path = __toESM(node_path);
|
|
33
|
+
let node_module = require("node:module");
|
|
34
|
+
let _jesscss_style_resolver = require("@jesscss/style-resolver");
|
|
35
|
+
//#region src/index.ts
|
|
36
|
+
/**
|
|
37
|
+
* The Less plugin's default option values — the single source of truth for the
|
|
38
|
+
* v5 defaults. The `LessPlugin` constructor fills any unset option from here,
|
|
39
|
+
* and the `lessc` CLI imports the same object so its defaults can never drift
|
|
40
|
+
* from the engine's. Note `collapseNesting: false` — v5 preserves nesting by
|
|
41
|
+
* default (Less 4.x flattened; that is now an explicit opt-in).
|
|
42
|
+
*/
|
|
43
|
+
const lessPluginDefaults = {
|
|
44
|
+
mathMode: "parens-division",
|
|
45
|
+
unitMode: "preserve",
|
|
46
|
+
equalityMode: "less",
|
|
47
|
+
leakyScope: true,
|
|
48
|
+
bubbleRootAtRules: true,
|
|
49
|
+
collapseNesting: false
|
|
50
|
+
};
|
|
51
|
+
var LessPlugin = class extends _jesscss_core.AbstractPlugin {
|
|
52
|
+
name = "less";
|
|
53
|
+
supportedExtensions = [".less"];
|
|
54
|
+
parser;
|
|
55
|
+
mathMode;
|
|
56
|
+
unitMode;
|
|
57
|
+
equalityMode;
|
|
58
|
+
leakyScope;
|
|
59
|
+
bubbleRootAtRules;
|
|
60
|
+
collapseNesting;
|
|
61
|
+
constructor(opts = {}) {
|
|
62
|
+
super();
|
|
63
|
+
this.opts = opts;
|
|
64
|
+
let mathMode;
|
|
65
|
+
if (opts.mathMode !== void 0) mathMode = opts.mathMode;
|
|
66
|
+
else if (opts.math !== void 0) if (opts.math === 0 || opts.math === "always") mathMode = "always";
|
|
67
|
+
else if (opts.math === 1 || opts.math === "parens-division") mathMode = "parens-division";
|
|
68
|
+
else if (opts.math === 2 || opts.math === "parens" || opts.math === "strict") mathMode = "parens";
|
|
69
|
+
else mathMode = "parens";
|
|
70
|
+
else mathMode = lessPluginDefaults.mathMode;
|
|
71
|
+
this.mathMode = mathMode;
|
|
72
|
+
let unitMode;
|
|
73
|
+
if (opts.unitMode !== void 0) unitMode = opts.unitMode;
|
|
74
|
+
else if (opts.strictUnits === true) unitMode = "strict";
|
|
75
|
+
else unitMode = lessPluginDefaults.unitMode;
|
|
76
|
+
this.unitMode = unitMode;
|
|
77
|
+
this.equalityMode = opts.equalityMode ?? lessPluginDefaults.equalityMode;
|
|
78
|
+
this.leakyScope = opts.leakyScope ?? lessPluginDefaults.leakyScope;
|
|
79
|
+
this.bubbleRootAtRules = opts.bubbleRootAtRules ?? lessPluginDefaults.bubbleRootAtRules;
|
|
80
|
+
this.collapseNesting = opts.collapseNesting ?? lessPluginDefaults.collapseNesting;
|
|
81
|
+
this.parser = new _jesscss_less_parser_jess.Parser();
|
|
82
|
+
}
|
|
83
|
+
createTreeContext(filePath, source) {
|
|
84
|
+
return new _jesscss_core.TreeContext({
|
|
85
|
+
file: {
|
|
86
|
+
name: node_path.default.basename(filePath),
|
|
87
|
+
path: node_path.default.dirname(filePath),
|
|
88
|
+
fullPath: filePath,
|
|
89
|
+
source
|
|
90
|
+
},
|
|
91
|
+
mathMode: this.mathMode,
|
|
92
|
+
unitMode: this.unitMode,
|
|
93
|
+
equalityMode: this.equalityMode,
|
|
94
|
+
plugin: this,
|
|
95
|
+
allowExtendSelectors: this.opts.allowExtendSelectors,
|
|
96
|
+
collapseNesting: this.collapseNesting,
|
|
97
|
+
leakyScope: this.leakyScope,
|
|
98
|
+
bubbleRootAtRules: this.bubbleRootAtRules
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
_registerFunctions(tree) {
|
|
102
|
+
const registeredNames = [];
|
|
103
|
+
for (const [key, value] of Object.entries(_jesscss_fns)) {
|
|
104
|
+
if (typeof value !== "function") continue;
|
|
105
|
+
const runtimeName = value.name || key;
|
|
106
|
+
tree.setFunctionBinding(runtimeName, new _jesscss_core.JsFunction({
|
|
107
|
+
name: runtimeName,
|
|
108
|
+
fn: value
|
|
109
|
+
}));
|
|
110
|
+
registeredNames.push(runtimeName);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
expandImport(importPath, currentDir) {
|
|
114
|
+
return (0, _jesscss_style_resolver.expandLessImportCandidates)(importPath);
|
|
115
|
+
}
|
|
116
|
+
resolve(filePath, currentDir, searchPaths) {
|
|
117
|
+
const mapped = (Array.isArray(filePath) ? filePath : [filePath]).map((candidate) => {
|
|
118
|
+
if (candidate.startsWith("@less/test-import-module/")) {
|
|
119
|
+
const after = candidate.slice(25);
|
|
120
|
+
const marker = `${node_path.default.sep}packages${node_path.default.sep}test-data${node_path.default.sep}`;
|
|
121
|
+
const idx = currentDir.indexOf(marker);
|
|
122
|
+
if (idx !== -1) {
|
|
123
|
+
const packagesRoot = currentDir.slice(0, idx + `${node_path.default.sep}packages`.length);
|
|
124
|
+
return node_path.default.join(packagesRoot, "test-import-module", after);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const m = candidate.match(/^https?:\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
|
|
128
|
+
if (m?.[1]) return m[1];
|
|
129
|
+
const mProtocolRelative = candidate.match(/^\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
|
|
130
|
+
if (mProtocolRelative?.[1]) return mProtocolRelative[1];
|
|
131
|
+
return candidate;
|
|
132
|
+
});
|
|
133
|
+
const out = [...super.resolve(mapped, currentDir, searchPaths)];
|
|
134
|
+
const bases = [
|
|
135
|
+
currentDir,
|
|
136
|
+
...searchPaths,
|
|
137
|
+
process.cwd()
|
|
138
|
+
];
|
|
139
|
+
const looksBareSpecifier = (p) => !node_path.default.isAbsolute(p) && !p.startsWith("./") && !p.startsWith("../") && !p.startsWith("/") && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(p);
|
|
140
|
+
for (const candidate of mapped) {
|
|
141
|
+
if (!looksBareSpecifier(candidate)) continue;
|
|
142
|
+
for (const base of bases) {
|
|
143
|
+
const baseDir = node_path.default.isAbsolute(base) ? base : node_path.default.resolve(currentDir, base);
|
|
144
|
+
try {
|
|
145
|
+
const resolvedModule = (0, node_module.createRequire)(node_path.default.join(baseDir, "__jess_resolve__.js")).resolve(candidate);
|
|
146
|
+
if (!out.includes(resolvedModule)) out.push(resolvedModule);
|
|
147
|
+
break;
|
|
148
|
+
} catch {
|
|
149
|
+
try {
|
|
150
|
+
const resolvedModuleLess = (0, node_module.createRequire)(node_path.default.join(baseDir, "__jess_resolve__.js")).resolve(`${candidate}.less`);
|
|
151
|
+
if (!out.includes(resolvedModuleLess)) out.push(resolvedModuleLess);
|
|
152
|
+
break;
|
|
153
|
+
} catch {}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
safeParse(filePath, source, _parseOptions) {
|
|
160
|
+
const context = this.createTreeContext(filePath, source);
|
|
161
|
+
const errors = [];
|
|
162
|
+
const warnings = [];
|
|
163
|
+
let tree;
|
|
164
|
+
try {
|
|
165
|
+
const parseResult = this.parser.parse(source, "Stylesheet", { context });
|
|
166
|
+
tree = parseResult.tree;
|
|
167
|
+
const parsedContext = parseResult.context ?? context;
|
|
168
|
+
if (tree) tree._treeContext = parsedContext;
|
|
169
|
+
context.opts.trivia = parseResult.trivia;
|
|
170
|
+
context.opts.liftedCommentRanges = parseResult.liftedCommentRanges;
|
|
171
|
+
if ("warnings" in parseResult && parseResult.warnings) for (const warning of parseResult.warnings) {
|
|
172
|
+
const line = warning.token?.startLine ?? 1;
|
|
173
|
+
const column = warning.token?.startColumn ?? 1;
|
|
174
|
+
warnings.push({
|
|
175
|
+
code: "parse/deprecated",
|
|
176
|
+
phase: "parse",
|
|
177
|
+
message: warning.message,
|
|
178
|
+
reason: warning.message,
|
|
179
|
+
fix: "Update your code to use the recommended syntax.",
|
|
180
|
+
file: context.file,
|
|
181
|
+
filePath,
|
|
182
|
+
line,
|
|
183
|
+
column,
|
|
184
|
+
lines: (0, _jesscss_core.extractRelevantLines)(source, line)
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (parseResult.errors.length) for (const error of parseResult.errors) {
|
|
188
|
+
const line = error.token?.startLine ?? 1;
|
|
189
|
+
const diagnostic = (0, _jesscss_core.toDiagnostic)((0, _jesscss_core.getErrorFromParser)([error], void 0, filePath, source, { file: context.file }));
|
|
190
|
+
if (!diagnostic.lines) diagnostic.lines = (0, _jesscss_core.extractRelevantLines)(source, line);
|
|
191
|
+
if ("errors" in diagnostic) errors.push(diagnostic);
|
|
192
|
+
else warnings.push(diagnostic);
|
|
193
|
+
}
|
|
194
|
+
} catch (error) {
|
|
195
|
+
if (error instanceof _jesscss_core.JessError) {
|
|
196
|
+
const diagnostic = (0, _jesscss_core.toDiagnostic)(error);
|
|
197
|
+
if ("errors" in diagnostic) errors.push(diagnostic);
|
|
198
|
+
else warnings.push(diagnostic);
|
|
199
|
+
} else {
|
|
200
|
+
const message = error instanceof Error ? error.message : "Unknown parsing error";
|
|
201
|
+
errors.push({
|
|
202
|
+
code: "internal/unknown",
|
|
203
|
+
phase: "parse",
|
|
204
|
+
message,
|
|
205
|
+
reason: message || "An unexpected error occurred during parsing.",
|
|
206
|
+
fix: "Check the file syntax and ensure it is valid.",
|
|
207
|
+
file: context.file,
|
|
208
|
+
filePath,
|
|
209
|
+
line: 1,
|
|
210
|
+
column: 1,
|
|
211
|
+
lines: (0, _jesscss_core.extractRelevantLines)(source, 1)
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
errors,
|
|
216
|
+
warnings
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (tree && errors.length === 0) this._registerFunctions(tree);
|
|
220
|
+
return {
|
|
221
|
+
tree,
|
|
222
|
+
errors,
|
|
223
|
+
warnings
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
const lessPlugin = ((opts) => {
|
|
228
|
+
return new LessPlugin(opts);
|
|
229
|
+
});
|
|
230
|
+
//#endregion
|
|
231
|
+
exports.LessPlugin = LessPlugin;
|
|
232
|
+
exports.default = lessPlugin;
|
|
233
|
+
exports.lessPluginDefaults = lessPluginDefaults;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
import { AbstractPlugin, type ISafeParseResult } from '@jesscss/core';
|
|
1
|
+
import { AbstractPlugin, type ISafeParseResult, type SafeParseOptions } from '@jesscss/core';
|
|
2
2
|
import type { EqualityMode, MathMode, UnitMode, LessOptions } from 'styles-config';
|
|
3
|
-
import { Parser } from '@jesscss/less-parser';
|
|
3
|
+
import { Parser } from '@jesscss/less-parser/jess';
|
|
4
|
+
export type LessPluginOptions = LessOptions;
|
|
5
|
+
/**
|
|
6
|
+
* The Less plugin's default option values — the single source of truth for the
|
|
7
|
+
* v5 defaults. The `LessPlugin` constructor fills any unset option from here,
|
|
8
|
+
* and the `lessc` CLI imports the same object so its defaults can never drift
|
|
9
|
+
* from the engine's. Note `collapseNesting: false` — v5 preserves nesting by
|
|
10
|
+
* default (Less 4.x flattened; that is now an explicit opt-in).
|
|
11
|
+
*/
|
|
12
|
+
export declare const lessPluginDefaults: {
|
|
13
|
+
readonly mathMode: MathMode;
|
|
14
|
+
readonly unitMode: UnitMode;
|
|
15
|
+
readonly equalityMode: EqualityMode;
|
|
16
|
+
readonly leakyScope: true;
|
|
17
|
+
readonly bubbleRootAtRules: true;
|
|
18
|
+
readonly collapseNesting: false;
|
|
19
|
+
};
|
|
4
20
|
export declare class LessPlugin extends AbstractPlugin {
|
|
5
|
-
opts:
|
|
21
|
+
opts: LessPluginOptions;
|
|
6
22
|
name: string;
|
|
7
23
|
supportedExtensions: string[];
|
|
8
24
|
parser: Parser;
|
|
9
25
|
mathMode: MathMode;
|
|
10
26
|
unitMode: UnitMode;
|
|
11
27
|
equalityMode: EqualityMode;
|
|
12
|
-
|
|
28
|
+
leakyScope: boolean;
|
|
13
29
|
bubbleRootAtRules: boolean;
|
|
14
30
|
collapseNesting: boolean;
|
|
15
|
-
constructor(opts?:
|
|
31
|
+
constructor(opts?: LessPluginOptions);
|
|
32
|
+
private createTreeContext;
|
|
16
33
|
private _registerFunctions;
|
|
17
34
|
expandImport(importPath: string, currentDir: string): string[];
|
|
18
35
|
resolve(filePath: string | string[], currentDir: string, searchPaths: string[]): string[];
|
|
19
|
-
safeParse(filePath: string, source: string): ISafeParseResult;
|
|
36
|
+
safeParse(filePath: string, source: string, _parseOptions?: SafeParseOptions): ISafeParseResult;
|
|
20
37
|
}
|
|
21
38
|
export type { LessOptions } from 'styles-config';
|
|
22
|
-
declare const lessPlugin: (opts?:
|
|
39
|
+
declare const lessPlugin: (opts?: LessPluginOptions) => LessPlugin;
|
|
23
40
|
export default lessPlugin;
|
package/lib/index.js
CHANGED
|
@@ -1,264 +1,203 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { expandLessImportCandidates } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
// Convert lexer errors
|
|
202
|
-
if (parseResult.lexerResult?.errors) {
|
|
203
|
-
for (const lexError of parseResult.lexerResult.errors) {
|
|
204
|
-
const line = lexError.line ?? 1;
|
|
205
|
-
const jessError = getErrorFromParser([], [lexError], filePath, source, { file: context.file });
|
|
206
|
-
const diagnostic = toDiagnostic(jessError);
|
|
207
|
-
// Ensure lines are extracted
|
|
208
|
-
if (!diagnostic.lines) {
|
|
209
|
-
diagnostic.lines = extractRelevantLines(source, line);
|
|
210
|
-
}
|
|
211
|
-
if ('errors' in diagnostic) {
|
|
212
|
-
errors.push(diagnostic);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
warnings.push(diagnostic);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
// Convert caught error to diagnostic
|
|
223
|
-
if (error && typeof error === 'object' && 'severity' in error) {
|
|
224
|
-
const diagnostic = toDiagnostic(error);
|
|
225
|
-
if ('errors' in diagnostic) {
|
|
226
|
-
errors.push(diagnostic);
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
warnings.push(diagnostic);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
errors.push({
|
|
234
|
-
code: 'internal/unknown',
|
|
235
|
-
phase: 'parse',
|
|
236
|
-
message: error?.message || 'Unknown parsing error',
|
|
237
|
-
reason: error?.message || 'An unexpected error occurred during parsing.',
|
|
238
|
-
fix: 'Check the file syntax and ensure it is valid.',
|
|
239
|
-
file: context.file,
|
|
240
|
-
filePath: filePath,
|
|
241
|
-
line: 1,
|
|
242
|
-
column: 1,
|
|
243
|
-
lines: extractRelevantLines(source, 1)
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
// Return with errors/warnings only (no tree)
|
|
247
|
-
return { errors, warnings };
|
|
248
|
-
}
|
|
249
|
-
// Only register functions if parsing succeeded without errors
|
|
250
|
-
if (tree && errors.length === 0) {
|
|
251
|
-
this._registerFunctions(tree);
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
tree,
|
|
255
|
-
errors,
|
|
256
|
-
warnings
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
}
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { AbstractPlugin, JessError, JsFunction, TreeContext, extractRelevantLines, getErrorFromParser, toDiagnostic } from "@jesscss/core";
|
|
3
|
+
import * as lessFunctions from "@jesscss/fns";
|
|
4
|
+
import { Parser } from "@jesscss/less-parser/jess";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { expandLessImportCandidates } from "@jesscss/style-resolver";
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* The Less plugin's default option values — the single source of truth for the
|
|
10
|
+
* v5 defaults. The `LessPlugin` constructor fills any unset option from here,
|
|
11
|
+
* and the `lessc` CLI imports the same object so its defaults can never drift
|
|
12
|
+
* from the engine's. Note `collapseNesting: false` — v5 preserves nesting by
|
|
13
|
+
* default (Less 4.x flattened; that is now an explicit opt-in).
|
|
14
|
+
*/
|
|
15
|
+
const lessPluginDefaults = {
|
|
16
|
+
mathMode: "parens-division",
|
|
17
|
+
unitMode: "preserve",
|
|
18
|
+
equalityMode: "less",
|
|
19
|
+
leakyScope: true,
|
|
20
|
+
bubbleRootAtRules: true,
|
|
21
|
+
collapseNesting: false
|
|
22
|
+
};
|
|
23
|
+
var LessPlugin = class extends AbstractPlugin {
|
|
24
|
+
name = "less";
|
|
25
|
+
supportedExtensions = [".less"];
|
|
26
|
+
parser;
|
|
27
|
+
mathMode;
|
|
28
|
+
unitMode;
|
|
29
|
+
equalityMode;
|
|
30
|
+
leakyScope;
|
|
31
|
+
bubbleRootAtRules;
|
|
32
|
+
collapseNesting;
|
|
33
|
+
constructor(opts = {}) {
|
|
34
|
+
super();
|
|
35
|
+
this.opts = opts;
|
|
36
|
+
let mathMode;
|
|
37
|
+
if (opts.mathMode !== void 0) mathMode = opts.mathMode;
|
|
38
|
+
else if (opts.math !== void 0) if (opts.math === 0 || opts.math === "always") mathMode = "always";
|
|
39
|
+
else if (opts.math === 1 || opts.math === "parens-division") mathMode = "parens-division";
|
|
40
|
+
else if (opts.math === 2 || opts.math === "parens" || opts.math === "strict") mathMode = "parens";
|
|
41
|
+
else mathMode = "parens";
|
|
42
|
+
else mathMode = lessPluginDefaults.mathMode;
|
|
43
|
+
this.mathMode = mathMode;
|
|
44
|
+
let unitMode;
|
|
45
|
+
if (opts.unitMode !== void 0) unitMode = opts.unitMode;
|
|
46
|
+
else if (opts.strictUnits === true) unitMode = "strict";
|
|
47
|
+
else unitMode = lessPluginDefaults.unitMode;
|
|
48
|
+
this.unitMode = unitMode;
|
|
49
|
+
this.equalityMode = opts.equalityMode ?? lessPluginDefaults.equalityMode;
|
|
50
|
+
this.leakyScope = opts.leakyScope ?? lessPluginDefaults.leakyScope;
|
|
51
|
+
this.bubbleRootAtRules = opts.bubbleRootAtRules ?? lessPluginDefaults.bubbleRootAtRules;
|
|
52
|
+
this.collapseNesting = opts.collapseNesting ?? lessPluginDefaults.collapseNesting;
|
|
53
|
+
this.parser = new Parser();
|
|
54
|
+
}
|
|
55
|
+
createTreeContext(filePath, source) {
|
|
56
|
+
return new TreeContext({
|
|
57
|
+
file: {
|
|
58
|
+
name: path.basename(filePath),
|
|
59
|
+
path: path.dirname(filePath),
|
|
60
|
+
fullPath: filePath,
|
|
61
|
+
source
|
|
62
|
+
},
|
|
63
|
+
mathMode: this.mathMode,
|
|
64
|
+
unitMode: this.unitMode,
|
|
65
|
+
equalityMode: this.equalityMode,
|
|
66
|
+
plugin: this,
|
|
67
|
+
allowExtendSelectors: this.opts.allowExtendSelectors,
|
|
68
|
+
collapseNesting: this.collapseNesting,
|
|
69
|
+
leakyScope: this.leakyScope,
|
|
70
|
+
bubbleRootAtRules: this.bubbleRootAtRules
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
_registerFunctions(tree) {
|
|
74
|
+
const registeredNames = [];
|
|
75
|
+
for (const [key, value] of Object.entries(lessFunctions)) {
|
|
76
|
+
if (typeof value !== "function") continue;
|
|
77
|
+
const runtimeName = value.name || key;
|
|
78
|
+
tree.setFunctionBinding(runtimeName, new JsFunction({
|
|
79
|
+
name: runtimeName,
|
|
80
|
+
fn: value
|
|
81
|
+
}));
|
|
82
|
+
registeredNames.push(runtimeName);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
expandImport(importPath, currentDir) {
|
|
86
|
+
return expandLessImportCandidates(importPath);
|
|
87
|
+
}
|
|
88
|
+
resolve(filePath, currentDir, searchPaths) {
|
|
89
|
+
const mapped = (Array.isArray(filePath) ? filePath : [filePath]).map((candidate) => {
|
|
90
|
+
if (candidate.startsWith("@less/test-import-module/")) {
|
|
91
|
+
const after = candidate.slice(25);
|
|
92
|
+
const marker = `${path.sep}packages${path.sep}test-data${path.sep}`;
|
|
93
|
+
const idx = currentDir.indexOf(marker);
|
|
94
|
+
if (idx !== -1) {
|
|
95
|
+
const packagesRoot = currentDir.slice(0, idx + `${path.sep}packages`.length);
|
|
96
|
+
return path.join(packagesRoot, "test-import-module", after);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const m = candidate.match(/^https?:\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
|
|
100
|
+
if (m?.[1]) return m[1];
|
|
101
|
+
const mProtocolRelative = candidate.match(/^\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
|
|
102
|
+
if (mProtocolRelative?.[1]) return mProtocolRelative[1];
|
|
103
|
+
return candidate;
|
|
104
|
+
});
|
|
105
|
+
const out = [...super.resolve(mapped, currentDir, searchPaths)];
|
|
106
|
+
const bases = [
|
|
107
|
+
currentDir,
|
|
108
|
+
...searchPaths,
|
|
109
|
+
process.cwd()
|
|
110
|
+
];
|
|
111
|
+
const looksBareSpecifier = (p) => !path.isAbsolute(p) && !p.startsWith("./") && !p.startsWith("../") && !p.startsWith("/") && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(p);
|
|
112
|
+
for (const candidate of mapped) {
|
|
113
|
+
if (!looksBareSpecifier(candidate)) continue;
|
|
114
|
+
for (const base of bases) {
|
|
115
|
+
const baseDir = path.isAbsolute(base) ? base : path.resolve(currentDir, base);
|
|
116
|
+
try {
|
|
117
|
+
const resolvedModule = createRequire(path.join(baseDir, "__jess_resolve__.js")).resolve(candidate);
|
|
118
|
+
if (!out.includes(resolvedModule)) out.push(resolvedModule);
|
|
119
|
+
break;
|
|
120
|
+
} catch {
|
|
121
|
+
try {
|
|
122
|
+
const resolvedModuleLess = createRequire(path.join(baseDir, "__jess_resolve__.js")).resolve(`${candidate}.less`);
|
|
123
|
+
if (!out.includes(resolvedModuleLess)) out.push(resolvedModuleLess);
|
|
124
|
+
break;
|
|
125
|
+
} catch {}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
safeParse(filePath, source, _parseOptions) {
|
|
132
|
+
const context = this.createTreeContext(filePath, source);
|
|
133
|
+
const errors = [];
|
|
134
|
+
const warnings = [];
|
|
135
|
+
let tree;
|
|
136
|
+
try {
|
|
137
|
+
const parseResult = this.parser.parse(source, "Stylesheet", { context });
|
|
138
|
+
tree = parseResult.tree;
|
|
139
|
+
const parsedContext = parseResult.context ?? context;
|
|
140
|
+
if (tree) tree._treeContext = parsedContext;
|
|
141
|
+
context.opts.trivia = parseResult.trivia;
|
|
142
|
+
context.opts.liftedCommentRanges = parseResult.liftedCommentRanges;
|
|
143
|
+
if ("warnings" in parseResult && parseResult.warnings) for (const warning of parseResult.warnings) {
|
|
144
|
+
const line = warning.token?.startLine ?? 1;
|
|
145
|
+
const column = warning.token?.startColumn ?? 1;
|
|
146
|
+
warnings.push({
|
|
147
|
+
code: "parse/deprecated",
|
|
148
|
+
phase: "parse",
|
|
149
|
+
message: warning.message,
|
|
150
|
+
reason: warning.message,
|
|
151
|
+
fix: "Update your code to use the recommended syntax.",
|
|
152
|
+
file: context.file,
|
|
153
|
+
filePath,
|
|
154
|
+
line,
|
|
155
|
+
column,
|
|
156
|
+
lines: extractRelevantLines(source, line)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (parseResult.errors.length) for (const error of parseResult.errors) {
|
|
160
|
+
const line = error.token?.startLine ?? 1;
|
|
161
|
+
const diagnostic = toDiagnostic(getErrorFromParser([error], void 0, filePath, source, { file: context.file }));
|
|
162
|
+
if (!diagnostic.lines) diagnostic.lines = extractRelevantLines(source, line);
|
|
163
|
+
if ("errors" in diagnostic) errors.push(diagnostic);
|
|
164
|
+
else warnings.push(diagnostic);
|
|
165
|
+
}
|
|
166
|
+
} catch (error) {
|
|
167
|
+
if (error instanceof JessError) {
|
|
168
|
+
const diagnostic = toDiagnostic(error);
|
|
169
|
+
if ("errors" in diagnostic) errors.push(diagnostic);
|
|
170
|
+
else warnings.push(diagnostic);
|
|
171
|
+
} else {
|
|
172
|
+
const message = error instanceof Error ? error.message : "Unknown parsing error";
|
|
173
|
+
errors.push({
|
|
174
|
+
code: "internal/unknown",
|
|
175
|
+
phase: "parse",
|
|
176
|
+
message,
|
|
177
|
+
reason: message || "An unexpected error occurred during parsing.",
|
|
178
|
+
fix: "Check the file syntax and ensure it is valid.",
|
|
179
|
+
file: context.file,
|
|
180
|
+
filePath,
|
|
181
|
+
line: 1,
|
|
182
|
+
column: 1,
|
|
183
|
+
lines: extractRelevantLines(source, 1)
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
errors,
|
|
188
|
+
warnings
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
if (tree && errors.length === 0) this._registerFunctions(tree);
|
|
192
|
+
return {
|
|
193
|
+
tree,
|
|
194
|
+
errors,
|
|
195
|
+
warnings
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
};
|
|
260
199
|
const lessPlugin = ((opts) => {
|
|
261
|
-
|
|
200
|
+
return new LessPlugin(opts);
|
|
262
201
|
});
|
|
263
|
-
|
|
264
|
-
|
|
202
|
+
//#endregion
|
|
203
|
+
export { LessPlugin, lessPlugin as default, lessPluginDefaults };
|
package/package.json
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jesscss/plugin-less",
|
|
3
|
+
"type": "module",
|
|
3
4
|
"publishConfig": {
|
|
4
5
|
"access": "public"
|
|
5
6
|
},
|
|
6
7
|
"description": "A Less stylesheet engine for Jess",
|
|
7
|
-
"version": "2.0.0-alpha.
|
|
8
|
-
"main": "lib/index.
|
|
8
|
+
"version": "2.0.0-alpha.7",
|
|
9
|
+
"main": "lib/index.cjs",
|
|
9
10
|
"types": "lib/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
|
-
"import": "./lib/index.js",
|
|
13
13
|
"types": "./lib/index.d.ts",
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"./*": {
|
|
17
|
-
"types": "./lib/*.d.ts",
|
|
18
|
-
"import": "./lib/*.js",
|
|
19
|
-
"source": "./src/*.ts"
|
|
14
|
+
"import": "./lib/index.js",
|
|
15
|
+
"require": "./lib/index.cjs"
|
|
20
16
|
},
|
|
21
17
|
"./package.json": "./package.json"
|
|
22
18
|
},
|
|
@@ -24,11 +20,11 @@
|
|
|
24
20
|
"lib"
|
|
25
21
|
],
|
|
26
22
|
"dependencies": {
|
|
27
|
-
"@jesscss/core": "2.0.0-alpha.
|
|
28
|
-
"@jesscss/fns": "2.0.0-alpha.
|
|
29
|
-
"@jesscss/less-parser": "2.0.0-alpha.
|
|
30
|
-
"@jesscss/style-resolver": "2.0.0-alpha.
|
|
31
|
-
"styles-config": "2.0.0-alpha.
|
|
23
|
+
"@jesscss/core": "2.0.0-alpha.7",
|
|
24
|
+
"@jesscss/fns": "2.0.0-alpha.7",
|
|
25
|
+
"@jesscss/less-parser": "2.0.0-alpha.7",
|
|
26
|
+
"@jesscss/style-resolver": "2.0.0-alpha.7",
|
|
27
|
+
"styles-config": "2.0.0-alpha.7"
|
|
32
28
|
},
|
|
33
29
|
"devDependencies": {},
|
|
34
30
|
"author": "Matthew Dean <matthew-dean@users.noreply.github.com>",
|
|
@@ -37,10 +33,11 @@
|
|
|
37
33
|
"url": "https://github.com/jesscss/jess/issues"
|
|
38
34
|
},
|
|
39
35
|
"homepage": "https://github.com/jesscss/jess#readme",
|
|
36
|
+
"module": "lib/index.js",
|
|
40
37
|
"scripts": {
|
|
41
38
|
"ci": "pnpm build && pnpm test",
|
|
42
39
|
"build": "pnpm compile",
|
|
43
|
-
"compile": "tsc -
|
|
40
|
+
"compile": "tsdown --tsconfig tsconfig.build.json --no-dts && tsc -p tsconfig.build.json --emitDeclarationOnly --noCheck",
|
|
44
41
|
"test": "vitest --run --passWithNoTests",
|
|
45
42
|
"lint:fix": "eslint --fix '**/*.{js,ts}'",
|
|
46
43
|
"lint": "eslint '**/*.{js,ts}'"
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACd,WAAW,EAGX,UAAU,EAEV,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EAIrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,aAAa,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,OAAO,UAAW,SAAQ,cAAc;IAWzB;IAVnB,IAAI,GAAG,MAAM,CAAC;IACd,mBAAmB,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,CAAS;IACf,QAAQ,CAAW;IACnB,QAAQ,CAAW;IACnB,YAAY,CAAe;IAC3B,UAAU,CAAU;IACpB,iBAAiB,CAAU;IAC3B,eAAe,CAAU;IAEzB,YAAmB,OAAoB,EAAE;QACvC,KAAK,EAAE,CAAC;QADS,SAAI,GAAJ,IAAI,CAAkB;QAGvC,uDAAuD;QACvD,IAAI,QAAkB,CAAC;QACvB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC3B,CAAC;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACnC,6CAA6C;YAC7C,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC9C,QAAQ,GAAG,QAAQ,CAAC;YACt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AE,OAAO,CAAC,IAAI;oBAClB,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,CAAC;oBACP,MAAM,EAAE,CAAC;oBACT,KAAK,EAAE,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;iBACvC,CAAC,CAAC;YACL,CAAC;YACD,6CAA6C;YAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QAC9B,CAAC;QAED,8DAA8D;QAC9D,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,OAAO;YACL,IAAI;YACJ,MAAM;YACN,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AAID,MAAM,UAAU,GAAG,CAAC,CAAC,IAAkB,EAAE,EAAE;IACzC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAkB,CAAC;AAEpB,eAAe,UAAU,CAAC"}
|
package/lib/options.js
DELETED
package/lib/options.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":""}
|