@jesscss/plugin-less 2.0.0-alpha.4 → 2.0.0-alpha.6

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 ADDED
@@ -0,0 +1,219 @@
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 = require("@jesscss/less-parser");
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
+ var LessPlugin = class extends _jesscss_core.AbstractPlugin {
37
+ name = "less";
38
+ supportedExtensions = [".less"];
39
+ parser;
40
+ mathMode;
41
+ unitMode;
42
+ equalityMode;
43
+ leakyRules;
44
+ bubbleRootAtRules;
45
+ collapseNesting;
46
+ constructor(opts = {}) {
47
+ super();
48
+ this.opts = opts;
49
+ let mathMode;
50
+ if (opts.mathMode !== void 0) mathMode = opts.mathMode;
51
+ else if (opts.math !== void 0) if (opts.math === 0 || opts.math === "always") mathMode = "always";
52
+ else if (opts.math === 1 || opts.math === "parens-division") mathMode = "parens-division";
53
+ else if (opts.math === 2 || opts.math === "parens" || opts.math === "strict") mathMode = "parens";
54
+ else mathMode = "parens";
55
+ else mathMode = "parens-division";
56
+ this.mathMode = mathMode;
57
+ let unitMode;
58
+ if (opts.unitMode !== void 0) unitMode = opts.unitMode;
59
+ else if (opts.strictUnits === true) unitMode = "strict";
60
+ else unitMode = "preserve";
61
+ this.unitMode = unitMode;
62
+ this.equalityMode = opts.equalityMode ?? "coerce";
63
+ this.leakyRules = opts.leakyRules ?? true;
64
+ this.bubbleRootAtRules = opts.bubbleRootAtRules ?? true;
65
+ this.collapseNesting = opts.collapseNesting ?? false;
66
+ this.parser = new _jesscss_less_parser.Parser();
67
+ }
68
+ _registerFunctions(tree) {
69
+ const registeredNames = [];
70
+ for (const [key, value] of Object.entries(_jesscss_fns)) {
71
+ if (typeof value !== "function") continue;
72
+ const runtimeName = value.name || key;
73
+ tree.register("function", new _jesscss_core.JsFunction({
74
+ name: runtimeName,
75
+ fn: value
76
+ }));
77
+ registeredNames.push(runtimeName);
78
+ }
79
+ }
80
+ expandImport(importPath, currentDir) {
81
+ return (0, _jesscss_style_resolver.expandLessImportCandidates)(importPath);
82
+ }
83
+ resolve(filePath, currentDir, searchPaths) {
84
+ const mapped = (Array.isArray(filePath) ? filePath : [filePath]).map((candidate) => {
85
+ if (candidate.startsWith("@less/test-import-module/")) {
86
+ const after = candidate.slice(25);
87
+ const marker = `${node_path.default.sep}packages${node_path.default.sep}test-data${node_path.default.sep}`;
88
+ const idx = currentDir.indexOf(marker);
89
+ if (idx !== -1) {
90
+ const packagesRoot = currentDir.slice(0, idx + `${node_path.default.sep}packages`.length);
91
+ return node_path.default.join(packagesRoot, "test-import-module", after);
92
+ }
93
+ }
94
+ const m = candidate.match(/^https?:\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
95
+ if (m?.[1]) return m[1];
96
+ const mProtocolRelative = candidate.match(/^\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
97
+ if (mProtocolRelative?.[1]) return mProtocolRelative[1];
98
+ return candidate;
99
+ });
100
+ const out = [...super.resolve(mapped, currentDir, searchPaths)];
101
+ const bases = [
102
+ currentDir,
103
+ ...searchPaths,
104
+ process.cwd()
105
+ ];
106
+ const looksBareSpecifier = (p) => !node_path.default.isAbsolute(p) && !p.startsWith("./") && !p.startsWith("../") && !p.startsWith("/") && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(p);
107
+ for (const candidate of mapped) {
108
+ if (!looksBareSpecifier(candidate)) continue;
109
+ for (const base of bases) {
110
+ const baseDir = node_path.default.isAbsolute(base) ? base : node_path.default.resolve(currentDir, base);
111
+ try {
112
+ const resolvedModule = (0, node_module.createRequire)(node_path.default.join(baseDir, "__jess_resolve__.js")).resolve(candidate);
113
+ if (!out.includes(resolvedModule)) out.push(resolvedModule);
114
+ break;
115
+ } catch {
116
+ try {
117
+ const resolvedModuleLess = (0, node_module.createRequire)(node_path.default.join(baseDir, "__jess_resolve__.js")).resolve(`${candidate}.less`);
118
+ if (!out.includes(resolvedModuleLess)) out.push(resolvedModuleLess);
119
+ break;
120
+ } catch {}
121
+ }
122
+ }
123
+ }
124
+ return out;
125
+ }
126
+ safeParse(filePath, source, parseOptions) {
127
+ const context = new _jesscss_core.TreeContext({
128
+ file: {
129
+ name: node_path.default.basename(filePath),
130
+ path: node_path.default.dirname(filePath),
131
+ fullPath: filePath,
132
+ source
133
+ },
134
+ mathMode: this.mathMode,
135
+ unitMode: this.unitMode,
136
+ equalityMode: this.equalityMode,
137
+ plugin: this,
138
+ allowExtendSelectors: this.opts.allowExtendSelectors,
139
+ collapseNesting: this.collapseNesting,
140
+ leakyRules: this.leakyRules,
141
+ bubbleRootAtRules: this.bubbleRootAtRules
142
+ });
143
+ const errors = [];
144
+ const warnings = [];
145
+ let tree;
146
+ try {
147
+ const parseResult = this.parser.parse(source, "stylesheet", { context });
148
+ tree = parseResult.tree;
149
+ if ("warnings" in parseResult && parseResult.warnings) for (const warning of parseResult.warnings) {
150
+ const line = warning.token?.startLine ?? 1;
151
+ const column = warning.token?.startColumn ?? 1;
152
+ warnings.push({
153
+ code: "parse/deprecated",
154
+ phase: "parse",
155
+ message: warning.message,
156
+ reason: warning.message,
157
+ fix: "Update your code to use the recommended syntax.",
158
+ file: context.file,
159
+ filePath,
160
+ line,
161
+ column,
162
+ lines: (0, _jesscss_core.extractRelevantLines)(source, line)
163
+ });
164
+ }
165
+ if (parseResult.errors.length || parseResult.lexerResult?.errors?.length) {
166
+ for (const error of parseResult.errors) {
167
+ const line = error.token?.startLine ?? 1;
168
+ const diagnostic = (0, _jesscss_core.toDiagnostic)((0, _jesscss_core.getErrorFromParser)([error], void 0, filePath, source, { file: context.file }));
169
+ if (!diagnostic.lines) diagnostic.lines = (0, _jesscss_core.extractRelevantLines)(source, line);
170
+ if ("errors" in diagnostic) errors.push(diagnostic);
171
+ else warnings.push(diagnostic);
172
+ }
173
+ if (parseResult.lexerResult?.errors) for (const lexError of parseResult.lexerResult.errors) {
174
+ const line = typeof lexError.line === "number" ? lexError.line : 1;
175
+ const diagnostic = (0, _jesscss_core.toDiagnostic)((0, _jesscss_core.getErrorFromParser)([], [lexError], filePath, source, { file: context.file }));
176
+ if (!diagnostic.lines) diagnostic.lines = (0, _jesscss_core.extractRelevantLines)(source, line);
177
+ if ("errors" in diagnostic) errors.push(diagnostic);
178
+ else warnings.push(diagnostic);
179
+ }
180
+ }
181
+ } catch (error) {
182
+ if (error instanceof _jesscss_core.JessError) {
183
+ const diagnostic = (0, _jesscss_core.toDiagnostic)(error);
184
+ if ("errors" in diagnostic) errors.push(diagnostic);
185
+ else warnings.push(diagnostic);
186
+ } else {
187
+ const message = error instanceof Error ? error.message : "Unknown parsing error";
188
+ errors.push({
189
+ code: "internal/unknown",
190
+ phase: "parse",
191
+ message,
192
+ reason: message || "An unexpected error occurred during parsing.",
193
+ fix: "Check the file syntax and ensure it is valid.",
194
+ file: context.file,
195
+ filePath,
196
+ line: 1,
197
+ column: 1,
198
+ lines: (0, _jesscss_core.extractRelevantLines)(source, 1)
199
+ });
200
+ }
201
+ return {
202
+ errors,
203
+ warnings
204
+ };
205
+ }
206
+ if (tree && errors.length === 0) this._registerFunctions(tree);
207
+ return {
208
+ tree,
209
+ errors,
210
+ warnings
211
+ };
212
+ }
213
+ };
214
+ const lessPlugin = ((opts) => {
215
+ return new LessPlugin(opts);
216
+ });
217
+ //#endregion
218
+ exports.LessPlugin = LessPlugin;
219
+ exports.default = lessPlugin;
@@ -0,0 +1,27 @@
1
+ import { AbstractPlugin, ISafeParseResult } from "@jesscss/core";
2
+ import { EqualityMode, LessOptions, LessOptions as LessOptions$1, MathMode, UnitMode } from "styles-config";
3
+ import { Parser } from "@jesscss/less-parser";
4
+
5
+ //#region src/index.d.ts
6
+ declare class LessPlugin extends AbstractPlugin {
7
+ opts: LessOptions$1;
8
+ name: string;
9
+ supportedExtensions: string[];
10
+ parser: Parser;
11
+ mathMode: MathMode;
12
+ unitMode: UnitMode;
13
+ equalityMode: EqualityMode;
14
+ leakyRules: boolean;
15
+ bubbleRootAtRules: boolean;
16
+ collapseNesting: boolean;
17
+ constructor(opts?: LessOptions$1);
18
+ private _registerFunctions;
19
+ expandImport(importPath: string, currentDir: string): string[];
20
+ resolve(filePath: string | string[], currentDir: string, searchPaths: string[]): string[];
21
+ safeParse(filePath: string, source: string, parseOptions?: {
22
+ compilerOptions?: Record<string, any>;
23
+ }): ISafeParseResult;
24
+ }
25
+ declare const lessPlugin: (opts?: LessOptions$1) => LessPlugin;
26
+ //#endregion
27
+ export { type LessOptions, LessPlugin, lessPlugin as default };
package/lib/index.d.ts CHANGED
@@ -1,23 +1,27 @@
1
- import { AbstractPlugin, type ISafeParseResult } from '@jesscss/core';
2
- import type { EqualityMode, MathMode, UnitMode, LessOptions } from 'styles-config';
3
- import { Parser } from '@jesscss/less-parser';
4
- export declare class LessPlugin extends AbstractPlugin {
5
- opts: LessOptions;
6
- name: string;
7
- supportedExtensions: string[];
8
- parser: Parser;
9
- mathMode: MathMode;
10
- unitMode: UnitMode;
11
- equalityMode: EqualityMode;
12
- leakyRules: boolean;
13
- bubbleRootAtRules: boolean;
14
- collapseNesting: boolean;
15
- constructor(opts?: LessOptions);
16
- private _registerFunctions;
17
- expandImport(importPath: string, currentDir: string): string[];
18
- resolve(filePath: string | string[], currentDir: string, searchPaths: string[]): string[];
19
- safeParse(filePath: string, source: string): ISafeParseResult;
1
+ import { AbstractPlugin, ISafeParseResult } from "@jesscss/core";
2
+ import { Parser } from "@jesscss/less-parser";
3
+ import { EqualityMode, LessOptions, LessOptions as LessOptions$1, MathMode, UnitMode } from "styles-config";
4
+
5
+ //#region src/index.d.ts
6
+ declare class LessPlugin extends AbstractPlugin {
7
+ opts: LessOptions$1;
8
+ name: string;
9
+ supportedExtensions: string[];
10
+ parser: Parser;
11
+ mathMode: MathMode;
12
+ unitMode: UnitMode;
13
+ equalityMode: EqualityMode;
14
+ leakyRules: boolean;
15
+ bubbleRootAtRules: boolean;
16
+ collapseNesting: boolean;
17
+ constructor(opts?: LessOptions$1);
18
+ private _registerFunctions;
19
+ expandImport(importPath: string, currentDir: string): string[];
20
+ resolve(filePath: string | string[], currentDir: string, searchPaths: string[]): string[];
21
+ safeParse(filePath: string, source: string, parseOptions?: {
22
+ compilerOptions?: Record<string, any>;
23
+ }): ISafeParseResult;
20
24
  }
21
- export type { LessOptions } from 'styles-config';
22
- declare const lessPlugin: (opts?: LessOptions) => LessPlugin;
23
- export default lessPlugin;
25
+ declare const lessPlugin: (opts?: LessOptions$1) => LessPlugin;
26
+ //#endregion
27
+ export { type LessOptions, LessPlugin, lessPlugin as default };
package/lib/index.js CHANGED
@@ -1,264 +1,190 @@
1
- import { AbstractPlugin, TreeContext, JsFunction, getErrorFromParser, toDiagnostic, extractRelevantLines } from '@jesscss/core';
2
- import * as lessFunctions from '@jesscss/fns';
3
- import { Parser } from '@jesscss/less-parser';
4
- import path from 'node:path';
5
- import { createRequire } from 'node:module';
6
- import { expandLessImportCandidates } from '@jesscss/style-resolver';
7
- export class LessPlugin extends AbstractPlugin {
8
- opts;
9
- name = 'less';
10
- supportedExtensions = ['.less'];
11
- parser;
12
- mathMode;
13
- unitMode;
14
- equalityMode;
15
- leakyRules;
16
- bubbleRootAtRules;
17
- collapseNesting;
18
- constructor(opts = {}) {
19
- super();
20
- this.opts = opts;
21
- // Handle deprecated math option -> mathMode conversion
22
- let mathMode;
23
- if (opts.mathMode !== undefined) {
24
- mathMode = opts.mathMode;
25
- }
26
- else if (opts.math !== undefined) {
27
- // Convert deprecated math option to mathMode
28
- if (opts.math === 0 || opts.math === 'always') {
29
- mathMode = 'always';
30
- }
31
- else if (opts.math === 1 || opts.math === 'parens-division') {
32
- mathMode = 'parens-division';
33
- }
34
- else if (opts.math === 2 || opts.math === 'parens' || opts.math === 'strict') {
35
- mathMode = 'parens';
36
- }
37
- else {
38
- // 3 or 'strict-legacy' -> 'parens' (deprecated, use 'strict' instead)
39
- mathMode = 'parens';
40
- }
41
- }
42
- else {
43
- mathMode = 'parens-division';
44
- }
45
- this.mathMode = mathMode;
46
- // Handle deprecated strictUnits option -> unitMode conversion
47
- let unitMode;
48
- if (opts.unitMode !== undefined) {
49
- unitMode = opts.unitMode;
50
- }
51
- else if (opts.strictUnits === true) {
52
- unitMode = 'strict';
53
- }
54
- else {
55
- unitMode = 'preserve';
56
- }
57
- this.unitMode = unitMode;
58
- this.equalityMode = opts.equalityMode ?? 'coerce';
59
- this.leakyRules = opts.leakyRules ?? true;
60
- this.bubbleRootAtRules = opts.bubbleRootAtRules ?? true;
61
- this.collapseNesting = opts.collapseNesting ?? false;
62
- // Pass options to parser (including leakyRules, defaulting to true)
63
- this.parser = new Parser();
64
- }
65
- _registerFunctions(tree) {
66
- const registeredNames = [];
67
- for (const [key, value] of Object.entries(lessFunctions)) {
68
- if (typeof value !== 'function') {
69
- continue;
70
- }
71
- const runtimeName = value.name ?? key;
72
- tree.register('function', new JsFunction({ name: runtimeName, fn: value }));
73
- registeredNames.push(runtimeName);
74
- }
75
- }
76
- expandImport(importPath, currentDir) {
77
- void currentDir;
78
- // Keep import expansion in sync with the language service.
79
- return expandLessImportCandidates(importPath);
80
- }
81
- resolve(filePath, currentDir, searchPaths) {
82
- const paths = Array.isArray(filePath) ? filePath : [filePath];
83
- const mapped = paths.map((candidate) => {
84
- if (candidate.startsWith('@less/test-import-module/')) {
85
- const after = candidate.slice('@less/test-import-module/'.length);
86
- const marker = `${path.sep}packages${path.sep}test-data${path.sep}`;
87
- const idx = currentDir.indexOf(marker);
88
- if (idx !== -1) {
89
- const packagesRoot = currentDir.slice(0, idx + `${path.sep}packages`.length);
90
- return path.join(packagesRoot, 'test-import-module', after);
91
- }
92
- }
93
- const m = candidate.match(/^https?:\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
94
- if (m?.[1]) {
95
- return m[1];
96
- }
97
- const mProtocolRelative = candidate.match(/^\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
98
- if (mProtocolRelative?.[1]) {
99
- return mProtocolRelative[1];
100
- }
101
- return candidate;
102
- });
103
- const resolved = super.resolve(mapped, currentDir, searchPaths);
104
- const out = [...resolved];
105
- const bases = [currentDir, ...searchPaths, process.cwd()];
106
- const looksBareSpecifier = (p) => !path.isAbsolute(p)
107
- && !p.startsWith('./')
108
- && !p.startsWith('../')
109
- && !p.startsWith('/')
110
- && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(p);
111
- for (const candidate of mapped) {
112
- if (!looksBareSpecifier(candidate)) {
113
- continue;
114
- }
115
- for (const base of bases) {
116
- const baseDir = path.isAbsolute(base) ? base : path.resolve(currentDir, base);
117
- try {
118
- const req = createRequire(path.join(baseDir, '__jess_resolve__.js'));
119
- const resolvedModule = req.resolve(candidate);
120
- if (!out.includes(resolvedModule)) {
121
- out.push(resolvedModule);
122
- }
123
- break;
124
- }
125
- catch {
126
- try {
127
- const req = createRequire(path.join(baseDir, '__jess_resolve__.js'));
128
- const resolvedModuleLess = req.resolve(`${candidate}.less`);
129
- if (!out.includes(resolvedModuleLess)) {
130
- out.push(resolvedModuleLess);
131
- }
132
- break;
133
- }
134
- catch {
135
- // keep trying other base dirs
136
- }
137
- }
138
- }
139
- }
140
- return out;
141
- }
142
- safeParse(filePath, source) {
143
- const context = new TreeContext({
144
- file: {
145
- name: path.basename(filePath),
146
- path: path.dirname(filePath),
147
- fullPath: filePath,
148
- source: source
149
- },
150
- mathMode: this.mathMode,
151
- unitMode: this.unitMode,
152
- equalityMode: this.equalityMode,
153
- plugin: this,
154
- collapseNesting: this.collapseNesting,
155
- leakyRules: this.leakyRules,
156
- bubbleRootAtRules: this.bubbleRootAtRules
157
- });
158
- const errors = [];
159
- const warnings = [];
160
- let tree;
161
- try {
162
- const parseResult = this.parser.parse(source, 'stylesheet', { context });
163
- tree = parseResult.tree;
164
- // Convert parser deprecation warnings to diagnostics
165
- if ('warnings' in parseResult && parseResult.warnings) {
166
- for (const warning of parseResult.warnings) {
167
- const line = warning.token?.startLine ?? 1;
168
- const column = warning.token?.startColumn ?? 1;
169
- warnings.push({
170
- code: 'parse/deprecated',
171
- phase: 'parse',
172
- message: warning.message,
173
- reason: warning.message,
174
- fix: 'Update your code to use the recommended syntax.',
175
- file: context.file,
176
- filePath: filePath,
177
- line,
178
- column,
179
- lines: extractRelevantLines(source, line)
180
- });
181
- }
182
- }
183
- // Convert all parser/lexer errors to normalized diagnostics
184
- if (parseResult.errors.length || parseResult.lexerResult?.errors?.length) {
185
- // Convert each parser error to a diagnostic
186
- for (const error of parseResult.errors) {
187
- const line = error.token?.startLine ?? error.line ?? 1;
188
- const jessError = getErrorFromParser([error], undefined, filePath, source, { file: context.file });
189
- const diagnostic = toDiagnostic(jessError);
190
- // Ensure lines are extracted
191
- if (!diagnostic.lines) {
192
- diagnostic.lines = extractRelevantLines(source, line);
193
- }
194
- if ('errors' in diagnostic) {
195
- errors.push(diagnostic);
196
- }
197
- else {
198
- warnings.push(diagnostic);
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";
5
+ import path from "node:path";
6
+ import { expandLessImportCandidates } from "@jesscss/style-resolver";
7
+ //#region src/index.ts
8
+ var LessPlugin = class extends AbstractPlugin {
9
+ name = "less";
10
+ supportedExtensions = [".less"];
11
+ parser;
12
+ mathMode;
13
+ unitMode;
14
+ equalityMode;
15
+ leakyRules;
16
+ bubbleRootAtRules;
17
+ collapseNesting;
18
+ constructor(opts = {}) {
19
+ super();
20
+ this.opts = opts;
21
+ let mathMode;
22
+ if (opts.mathMode !== void 0) mathMode = opts.mathMode;
23
+ else if (opts.math !== void 0) if (opts.math === 0 || opts.math === "always") mathMode = "always";
24
+ else if (opts.math === 1 || opts.math === "parens-division") mathMode = "parens-division";
25
+ else if (opts.math === 2 || opts.math === "parens" || opts.math === "strict") mathMode = "parens";
26
+ else mathMode = "parens";
27
+ else mathMode = "parens-division";
28
+ this.mathMode = mathMode;
29
+ let unitMode;
30
+ if (opts.unitMode !== void 0) unitMode = opts.unitMode;
31
+ else if (opts.strictUnits === true) unitMode = "strict";
32
+ else unitMode = "preserve";
33
+ this.unitMode = unitMode;
34
+ this.equalityMode = opts.equalityMode ?? "coerce";
35
+ this.leakyRules = opts.leakyRules ?? true;
36
+ this.bubbleRootAtRules = opts.bubbleRootAtRules ?? true;
37
+ this.collapseNesting = opts.collapseNesting ?? false;
38
+ this.parser = new Parser();
39
+ }
40
+ _registerFunctions(tree) {
41
+ const registeredNames = [];
42
+ for (const [key, value] of Object.entries(lessFunctions)) {
43
+ if (typeof value !== "function") continue;
44
+ const runtimeName = value.name || key;
45
+ tree.register("function", new JsFunction({
46
+ name: runtimeName,
47
+ fn: value
48
+ }));
49
+ registeredNames.push(runtimeName);
50
+ }
51
+ }
52
+ expandImport(importPath, currentDir) {
53
+ return expandLessImportCandidates(importPath);
54
+ }
55
+ resolve(filePath, currentDir, searchPaths) {
56
+ const mapped = (Array.isArray(filePath) ? filePath : [filePath]).map((candidate) => {
57
+ if (candidate.startsWith("@less/test-import-module/")) {
58
+ const after = candidate.slice(25);
59
+ const marker = `${path.sep}packages${path.sep}test-data${path.sep}`;
60
+ const idx = currentDir.indexOf(marker);
61
+ if (idx !== -1) {
62
+ const packagesRoot = currentDir.slice(0, idx + `${path.sep}packages`.length);
63
+ return path.join(packagesRoot, "test-import-module", after);
64
+ }
65
+ }
66
+ const m = candidate.match(/^https?:\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
67
+ if (m?.[1]) return m[1];
68
+ const mProtocolRelative = candidate.match(/^\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
69
+ if (mProtocolRelative?.[1]) return mProtocolRelative[1];
70
+ return candidate;
71
+ });
72
+ const out = [...super.resolve(mapped, currentDir, searchPaths)];
73
+ const bases = [
74
+ currentDir,
75
+ ...searchPaths,
76
+ process.cwd()
77
+ ];
78
+ const looksBareSpecifier = (p) => !path.isAbsolute(p) && !p.startsWith("./") && !p.startsWith("../") && !p.startsWith("/") && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(p);
79
+ for (const candidate of mapped) {
80
+ if (!looksBareSpecifier(candidate)) continue;
81
+ for (const base of bases) {
82
+ const baseDir = path.isAbsolute(base) ? base : path.resolve(currentDir, base);
83
+ try {
84
+ const resolvedModule = createRequire(path.join(baseDir, "__jess_resolve__.js")).resolve(candidate);
85
+ if (!out.includes(resolvedModule)) out.push(resolvedModule);
86
+ break;
87
+ } catch {
88
+ try {
89
+ const resolvedModuleLess = createRequire(path.join(baseDir, "__jess_resolve__.js")).resolve(`${candidate}.less`);
90
+ if (!out.includes(resolvedModuleLess)) out.push(resolvedModuleLess);
91
+ break;
92
+ } catch {}
93
+ }
94
+ }
95
+ }
96
+ return out;
97
+ }
98
+ safeParse(filePath, source, parseOptions) {
99
+ const context = new TreeContext({
100
+ file: {
101
+ name: path.basename(filePath),
102
+ path: path.dirname(filePath),
103
+ fullPath: filePath,
104
+ source
105
+ },
106
+ mathMode: this.mathMode,
107
+ unitMode: this.unitMode,
108
+ equalityMode: this.equalityMode,
109
+ plugin: this,
110
+ allowExtendSelectors: this.opts.allowExtendSelectors,
111
+ collapseNesting: this.collapseNesting,
112
+ leakyRules: this.leakyRules,
113
+ bubbleRootAtRules: this.bubbleRootAtRules
114
+ });
115
+ const errors = [];
116
+ const warnings = [];
117
+ let tree;
118
+ try {
119
+ const parseResult = this.parser.parse(source, "stylesheet", { context });
120
+ tree = parseResult.tree;
121
+ if ("warnings" in parseResult && parseResult.warnings) for (const warning of parseResult.warnings) {
122
+ const line = warning.token?.startLine ?? 1;
123
+ const column = warning.token?.startColumn ?? 1;
124
+ warnings.push({
125
+ code: "parse/deprecated",
126
+ phase: "parse",
127
+ message: warning.message,
128
+ reason: warning.message,
129
+ fix: "Update your code to use the recommended syntax.",
130
+ file: context.file,
131
+ filePath,
132
+ line,
133
+ column,
134
+ lines: extractRelevantLines(source, line)
135
+ });
136
+ }
137
+ if (parseResult.errors.length || parseResult.lexerResult?.errors?.length) {
138
+ for (const error of parseResult.errors) {
139
+ const line = error.token?.startLine ?? 1;
140
+ const diagnostic = toDiagnostic(getErrorFromParser([error], void 0, filePath, source, { file: context.file }));
141
+ if (!diagnostic.lines) diagnostic.lines = extractRelevantLines(source, line);
142
+ if ("errors" in diagnostic) errors.push(diagnostic);
143
+ else warnings.push(diagnostic);
144
+ }
145
+ if (parseResult.lexerResult?.errors) for (const lexError of parseResult.lexerResult.errors) {
146
+ const line = typeof lexError.line === "number" ? lexError.line : 1;
147
+ const diagnostic = toDiagnostic(getErrorFromParser([], [lexError], filePath, source, { file: context.file }));
148
+ if (!diagnostic.lines) diagnostic.lines = extractRelevantLines(source, line);
149
+ if ("errors" in diagnostic) errors.push(diagnostic);
150
+ else warnings.push(diagnostic);
151
+ }
152
+ }
153
+ } catch (error) {
154
+ if (error instanceof JessError) {
155
+ const diagnostic = toDiagnostic(error);
156
+ if ("errors" in diagnostic) errors.push(diagnostic);
157
+ else warnings.push(diagnostic);
158
+ } else {
159
+ const message = error instanceof Error ? error.message : "Unknown parsing error";
160
+ errors.push({
161
+ code: "internal/unknown",
162
+ phase: "parse",
163
+ message,
164
+ reason: message || "An unexpected error occurred during parsing.",
165
+ fix: "Check the file syntax and ensure it is valid.",
166
+ file: context.file,
167
+ filePath,
168
+ line: 1,
169
+ column: 1,
170
+ lines: extractRelevantLines(source, 1)
171
+ });
172
+ }
173
+ return {
174
+ errors,
175
+ warnings
176
+ };
177
+ }
178
+ if (tree && errors.length === 0) this._registerFunctions(tree);
179
+ return {
180
+ tree,
181
+ errors,
182
+ warnings
183
+ };
184
+ }
185
+ };
260
186
  const lessPlugin = ((opts) => {
261
- return new LessPlugin(opts);
187
+ return new LessPlugin(opts);
262
188
  });
263
- export default lessPlugin;
264
- //# sourceMappingURL=index.js.map
189
+ //#endregion
190
+ export { LessPlugin, lessPlugin as default };
package/package.json CHANGED
@@ -1,22 +1,19 @@
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.4",
8
- "main": "lib/index.js",
8
+ "version": "2.0.0-alpha.6",
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
- "source": "./src/index.ts"
15
- },
16
- "./*": {
17
- "types": "./lib/*.d.ts",
18
- "import": "./lib/*.js",
19
- "source": "./src/*.ts"
14
+ "source": "./src/index.ts",
15
+ "import": "./lib/index.js",
16
+ "require": "./lib/index.cjs"
20
17
  },
21
18
  "./package.json": "./package.json"
22
19
  },
@@ -24,11 +21,11 @@
24
21
  "lib"
25
22
  ],
26
23
  "dependencies": {
27
- "@jesscss/fns": "2.0.0-alpha.4",
28
- "@jesscss/core": "2.0.0-alpha.4",
29
- "@jesscss/less-parser": "2.0.0-alpha.4",
30
- "styles-config": "2.0.0-alpha.4",
31
- "@jesscss/style-resolver": "2.0.0-alpha.4"
24
+ "@jesscss/core": "2.0.0-alpha.6",
25
+ "@jesscss/fns": "2.0.0-alpha.6",
26
+ "@jesscss/less-parser": "2.0.0-alpha.6",
27
+ "@jesscss/style-resolver": "2.0.0-alpha.6",
28
+ "styles-config": "2.0.0-alpha.6"
32
29
  },
33
30
  "devDependencies": {},
34
31
  "author": "Matthew Dean <matthew-dean@users.noreply.github.com>",
@@ -37,10 +34,11 @@
37
34
  "url": "https://github.com/jesscss/jess/issues"
38
35
  },
39
36
  "homepage": "https://github.com/jesscss/jess#readme",
37
+ "module": "lib/index.js",
40
38
  "scripts": {
41
39
  "ci": "pnpm build && pnpm test",
42
40
  "build": "pnpm compile",
43
- "compile": "tsc -b tsconfig.build.json",
41
+ "compile": "tsdown --tsconfig tsconfig.build.json",
44
42
  "test": "vitest --run --passWithNoTests",
45
43
  "lint:fix": "eslint --fix '**/*.{js,ts}'",
46
44
  "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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I,CAAC,CAAC;AAC9B,CAAC,CAAkB,CAAC;AAEpB,eAAe,UAAU,CAAC"}
package/lib/options.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * @deprecated Import LessOptions from 'styles-config' instead.
3
- * This type is kept for backward compatibility but will be removed in a future version.
4
- */
5
- export type { LessOptions } from 'styles-config';
package/lib/options.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":""}