styles-config 2.0.0-alpha.6 → 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/types.d.ts ADDED
@@ -0,0 +1,385 @@
1
+ /**
2
+ * Math processing modes
3
+ */
4
+ export type MathMode = 'always' | 'parens-division' | 'parens' | 'strict';
5
+ /**
6
+ * Unit conversion modes
7
+ */
8
+ export type UnitMode = 'loose' | 'preserve' | 'strict';
9
+ /**
10
+ * Function-call resolution modes — mirrors {@link UnitMode}. Governs an optional
11
+ * (global) function call that matched a registered function but couldn't be
12
+ * evaluated: `preserve` renders it as-is (+ warning), `error` throws.
13
+ */
14
+ export type FunctionMode = 'preserve' | 'error';
15
+ /**
16
+ * Equality dialects for guard comparisons — named by dialect (Less 4.x and Sass
17
+ * diverge in opposite directions), not by strictness:
18
+ * - `less`: Less 4.x equality (numeric coercion; quoted vs unquoted distinct)
19
+ * - `sass`: Dart Sass equality (unit-strict; quote-insensitive strings)
20
+ * - `exact`: no coercion — operands must be the same node type
21
+ */
22
+ export type EqualityMode = 'less' | 'sass' | 'exact';
23
+ export type ExtendSelectorKind = 'simple' | 'basic' | 'pseudo' | 'complex' | 'compound';
24
+ /**
25
+ * Less compiler options
26
+ * Based on less.js default-options.js and bin/lessc
27
+ */
28
+ export interface LessOptions {
29
+ /**
30
+ * Restrict which selector shapes are allowed in extend targets.
31
+ * When set, any other selector kind is a parse error.
32
+ */
33
+ allowExtendSelectors?: ExtendSelectorKind[];
34
+ /**
35
+ * Inline Javascript - @plugin still allowed
36
+ * @default false
37
+ */
38
+ javascriptEnabled?: boolean;
39
+ /**
40
+ * @deprecated Use `disableScriptModules` instead.
41
+ */
42
+ disablePluginRule?: boolean;
43
+ /**
44
+ * Outputs a makefile import dependency list to stdout.
45
+ * @default false
46
+ */
47
+ depends?: boolean;
48
+ /**
49
+ * @deprecated Compress using less built-in compression.
50
+ * This does an okay job but does not utilise all the tricks of
51
+ * dedicated css compression.
52
+ * @default false
53
+ */
54
+ compress?: boolean;
55
+ /**
56
+ * Runs the less parser and just reports errors without any output.
57
+ * @default false
58
+ */
59
+ lint?: boolean;
60
+ /**
61
+ * Sets available include paths.
62
+ * If the file in an @import rule does not exist at that exact location,
63
+ * less will look for it at the location(s) passed to this option.
64
+ * @default []
65
+ */
66
+ paths?: string[];
67
+ /**
68
+ * Color output in the terminal
69
+ * @default true
70
+ */
71
+ color?: boolean;
72
+ /**
73
+ * @deprecated This option has confusing behavior and may be removed in a future version.
74
+ *
75
+ * Controls how @import statements for .less files are handled inside selector blocks (rulesets).
76
+ *
77
+ * Behavior:
78
+ * - @import at root level: Always processed
79
+ * - @import inside @-rules (@media, @supports, etc.): Processed (these are not selector blocks)
80
+ * - @import inside selector blocks (.class, #id, etc.): Behavior depends on this option
81
+ *
82
+ * Options:
83
+ * - `false` (default): All @import statements are processed regardless of context.
84
+ * - `true`: @import statements inside selector blocks are silently ignored and not output.
85
+ * - `'error'`: @import statements inside selector blocks will throw an error instead of being silently ignored.
86
+ *
87
+ * Note: Only affects .less file imports. CSS imports (url(...) or .css files) are
88
+ * always output as CSS @import statements regardless of this setting.
89
+ *
90
+ * @see https://github.com/less/less.js/issues/656
91
+ * @default false
92
+ */
93
+ strictImports?: boolean | 'error';
94
+ /**
95
+ * Allow Imports from Insecure HTTPS Hosts
96
+ * @default false
97
+ */
98
+ insecure?: boolean;
99
+ /**
100
+ * Allows you to add a path to every generated import and url in your css.
101
+ * This does not affect less import statements that are processed, just ones
102
+ * that are left in the output css.
103
+ * @default ''
104
+ */
105
+ rootpath?: string;
106
+ /**
107
+ * By default URLs are kept as-is, so if you import a file in a sub-directory
108
+ * that references an image, exactly the same URL will be output in the css.
109
+ * This option allows you to re-write URL's in imported files so that the
110
+ * URL is always relative to the base imported file
111
+ * @default false
112
+ */
113
+ rewriteUrls?: boolean | 'all' | 'local' | 'off';
114
+ /**
115
+ * How to process math operations
116
+ * - 'always': eagerly try to solve all operations
117
+ * - 'parens-division': require parens for division "/"
118
+ * - 'parens' or 'strict': require parens for all operations
119
+ * @default 'parens-division'
120
+ */
121
+ mathMode?: MathMode;
122
+ /**
123
+ * How to handle unit conversions in math operations
124
+ * - 'loose': Less's default 1.x-4.x behavior
125
+ * - 'preserve': Create calc() expressions for unit errors
126
+ * - 'strict': strict unit mode
127
+ * @default 'preserve'
128
+ */
129
+ unitMode?: UnitMode;
130
+ /**
131
+ * How to handle an optional/global function call that matched a registered
132
+ * function but couldn't be evaluated (no matching signature, or it threw) —
133
+ * e.g. `unit(80/16)`, `color("x")`. Mirrors {@link unitMode}.
134
+ * - 'preserve': render the call as-is (like an unknown CSS function) + warn
135
+ * - 'error': throw the underlying function error (Less 4.x behavior)
136
+ * Unknown function names always render as-is regardless.
137
+ * @default 'preserve'
138
+ */
139
+ functionMode?: FunctionMode;
140
+ /**
141
+ * How to handle equality/coercion in guards and comparisons.
142
+ * - 'loose': Less-compatible loose (coercive) equality (JS '==')
143
+ * - 'strict': type-strict behavior
144
+ * @default 'loose'
145
+ */
146
+ equalityMode?: EqualityMode;
147
+ /**
148
+ * @deprecated Use `mathMode` instead. This option maps to `mathMode` as follows:
149
+ * - 0 or 'always' → 'always'
150
+ * - 1 or 'parens-division' → 'parens-division'
151
+ * - 2 or 'parens' or 'strict' → 'parens'
152
+ * - 3 or 'strict-legacy' → 'parens' (removed, will default to 'strict)
153
+ * @default undefined (uses mathMode if provided, otherwise 'parens-division')
154
+ */
155
+ math?: 0 | 1 | 2 | 3 | MathMode | 'strict-legacy';
156
+ /**
157
+ * @deprecated Use `unitMode` instead. If `true`, sets `unitMode` to 'strict'.
158
+ * If `false`, sets the unitMode to 'loose.
159
+ * If undefined, uses the `unitMode` value (defaults to 'preserve').
160
+ * @default false
161
+ */
162
+ strictUnits?: boolean;
163
+ /**
164
+ * Effectively the declaration is put at the top of your base Less file,
165
+ * meaning it can be used but it also can be overridden if this variable
166
+ * is defined in the file.
167
+ * @default null
168
+ */
169
+ globalVars?: Record<string, string> | null;
170
+ /**
171
+ * As opposed to the global variable option, this puts the declaration at the
172
+ * end of your base file, meaning it will override anything defined in your Less file.
173
+ * @default null
174
+ */
175
+ modifyVars?: Record<string, string> | null;
176
+ /**
177
+ * This option allows you to specify a argument to go on to every URL.
178
+ * @default ''
179
+ */
180
+ urlArgs?: string;
181
+ /**
182
+ * @removed The dumpLineNumbers option is not useful nor supported in browsers. Use sourcemaps instead.
183
+ *
184
+ * @default undefined
185
+ */
186
+ dumpLineNumbers?: string;
187
+ /**
188
+ * Source map options
189
+ * @default undefined
190
+ */
191
+ sourceMap?: boolean | {
192
+ sourceMapFullFilename?: string;
193
+ sourceMapRootpath?: string;
194
+ sourceMapBasepath?: string;
195
+ sourceMapURL?: string;
196
+ sourceMapFileInline?: boolean;
197
+ outputSourceFiles?: boolean;
198
+ disableSourcemapAnnotation?: boolean;
199
+ sourceMapOutputFilename?: string;
200
+ sourceMapFilename?: string;
201
+ };
202
+ /**
203
+ * Verbose output
204
+ * @default false
205
+ */
206
+ verbose?: boolean;
207
+ /**
208
+ * Silent mode (suppress errors)
209
+ * @default false
210
+ */
211
+ silent?: boolean;
212
+ /**
213
+ * Quiet mode (suppress warnings)
214
+ * @default false
215
+ */
216
+ quiet?: boolean;
217
+ /**
218
+ * Convenience preset. When `true`, sets the strict bundle for any of the
219
+ * following left `undefined` (individual options always win):
220
+ * - `unitMode: 'strict'`
221
+ * - `equalityMode: 'exact'` (the no-coercion dialect)
222
+ * - `leakyScope: false`
223
+ * - `allowOverloadedImport: false`
224
+ *
225
+ * Modeled after `tsconfig` `strict`: it only *sets* semantic options, it is not
226
+ * itself a mode.
227
+ * @default false
228
+ */
229
+ strict?: boolean;
230
+ /**
231
+ * Whether re-importing a file/namespace may contribute *overloaded* (duplicated,
232
+ * additively-merged) definitions rather than being de-duplicated like Less's
233
+ * `@import (once)`. `strict` sets this to `false`.
234
+ * @default true
235
+ */
236
+ allowOverloadedImport?: boolean;
237
+ /**
238
+ * @deprecated This is legacy Less behavior.
239
+ *
240
+ * Controls whether mixins and detached rulesets "leak" their inner rules.
241
+ * When true:
242
+ * - Mixins: Mixin and VarDeclaration nodes are 'public' and 'optional' respectively
243
+ * - Detached rulesets: Mixin and VarDeclaration nodes are 'public' and 'private' respectively
244
+ * When false:
245
+ * - Both mixins and detached rulesets: Mixin and VarDeclaration nodes are 'private'
246
+ * @default true
247
+ */
248
+ leakyScope?: boolean;
249
+ /**
250
+ * Whether to collapse nested selectors (Less 1.x-4.x style flattening)
251
+ * When true, nested selectors like `.parent { .child { } }` are flattened to `.parent .child { }`
252
+ * @default false
253
+ */
254
+ collapseNesting?: boolean;
255
+ /**
256
+ * @deprecated This is legacy Less behavior.
257
+ *
258
+ * Whether to bubble root-only at-rules (@font-face, @keyframes, etc.) to the root
259
+ * when they are nested inside rulesets. Modern CSS supports nesting these at-rules.
260
+ * @default true
261
+ */
262
+ bubbleRootAtRules?: boolean;
263
+ }
264
+ export interface ScssOptions {
265
+ allowExtendSelectors?: ExtendSelectorKind[];
266
+ unitMode?: UnitMode;
267
+ equalityMode?: EqualityMode;
268
+ collapseNesting?: boolean;
269
+ [key: string]: any;
270
+ }
271
+ /**
272
+ * Base interface for file-matching options
273
+ */
274
+ export interface FileMatchOptions {
275
+ /**
276
+ * File path, relative path, or glob pattern for matching.
277
+ * If omitted, the options serve as defaults.
278
+ */
279
+ file?: string;
280
+ }
281
+ /**
282
+ * Input file options - can override compile and language settings per input file
283
+ */
284
+ export interface InputOptions extends FileMatchOptions {
285
+ mathMode?: MathMode;
286
+ unitMode?: UnitMode;
287
+ functionMode?: FunctionMode;
288
+ equalityMode?: EqualityMode;
289
+ strict?: boolean;
290
+ allowOverloadedImport?: boolean;
291
+ allowExtendSelectors?: ExtendSelectorKind[];
292
+ disableScriptModules?: boolean;
293
+ /**
294
+ * @deprecated Use `disableScriptModules` instead.
295
+ */
296
+ disablePluginRule?: boolean;
297
+ searchPaths?: string[];
298
+ javascriptEnabled?: boolean;
299
+ paths?: string[];
300
+ globalVars?: Record<string, string> | null;
301
+ modifyVars?: Record<string, string> | null;
302
+ strictImports?: boolean | 'error';
303
+ rewriteUrls?: boolean | 'all' | 'local' | 'off';
304
+ rootpath?: string;
305
+ leakyScope?: boolean;
306
+ collapseNesting?: boolean;
307
+ bubbleRootAtRules?: boolean;
308
+ /** Allow additional language-specific options */
309
+ [key: string]: any;
310
+ }
311
+ /**
312
+ * Output file options - can override output settings per output file
313
+ */
314
+ export interface OutputOptions extends FileMatchOptions {
315
+ collapseNesting?: boolean;
316
+ compress?: boolean;
317
+ sourceMap?: boolean | {
318
+ sourceMapFullFilename?: string;
319
+ sourceMapRootpath?: string;
320
+ sourceMapBasepath?: string;
321
+ sourceMapURL?: string;
322
+ sourceMapFileInline?: boolean;
323
+ outputSourceFiles?: boolean;
324
+ disableSourcemapAnnotation?: boolean;
325
+ sourceMapOutputFilename?: string;
326
+ sourceMapFilename?: string;
327
+ };
328
+ /** Allow additional options */
329
+ [key: string]: any;
330
+ }
331
+ export interface StylesConfig {
332
+ compile?: {
333
+ /**
334
+ * Plugins can be specified as:
335
+ * - Plugin instances (PluginInterface from @jesscss/core)
336
+ * - String keys (plugin names that get resolved elsewhere)
337
+ *
338
+ * @note - Using `any` here to avoid circular dependency with @jesscss/core.
339
+ * The actual type is PluginInterface from @jesscss/core.
340
+ */
341
+ plugins?: Array<any | string>;
342
+ searchPaths?: string[];
343
+ mathMode?: MathMode;
344
+ unitMode?: UnitMode;
345
+ functionMode?: FunctionMode;
346
+ equalityMode?: EqualityMode;
347
+ /** See {@link LessOptions.strict}. Expanded onto the other compile modes. */
348
+ strict?: boolean;
349
+ /** See {@link LessOptions.allowOverloadedImport}. */
350
+ allowOverloadedImport?: boolean;
351
+ /** See {@link LessOptions.leakyScope}. */
352
+ leakyScope?: boolean;
353
+ allowExtendSelectors?: ExtendSelectorKind[];
354
+ disableScriptModules?: boolean;
355
+ /**
356
+ * @deprecated Use `disableScriptModules` instead.
357
+ */
358
+ disablePluginRule?: boolean;
359
+ /**
360
+ * Filesystem root that Less `@plugin` / script-module scripts are allowed to
361
+ * be read from. When set, it overrides the default (the entry file's
362
+ * directory). Paths outside this root are rejected by @jesscss/plugin-js.
363
+ */
364
+ jsReadRoot?: string;
365
+ };
366
+ /**
367
+ * Input file options. Can be a single object for defaults, or an array
368
+ * where entries can have a `file` property (path or glob) to match specific inputs.
369
+ * Entries without a `file` property serve as defaults.
370
+ */
371
+ input?: InputOptions | InputOptions[];
372
+ /**
373
+ * Output file options. Can be a single object for defaults, or an array
374
+ * where entries can have a `file` property (path or glob) to match specific outputs.
375
+ * Entries without a `file` property serve as defaults.
376
+ */
377
+ output?: OutputOptions | OutputOptions[];
378
+ language?: {
379
+ less?: LessOptions;
380
+ scss?: ScssOptions;
381
+ css?: Record<string, any>;
382
+ jess?: Record<string, any>;
383
+ [key: string]: LessOptions | ScssOptions | Record<string, any> | undefined;
384
+ };
385
+ }
package/package.json CHANGED
@@ -4,14 +4,13 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0-alpha.6",
7
+ "version": "2.0.0-alpha.7",
8
8
  "description": "General-purpose configuration for styling frameworks (Jess, Less, Sass, Tailwind, etc.)",
9
9
  "main": "lib/index.cjs",
10
10
  "types": "lib/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./lib/index.d.ts",
14
- "source": "./src/index.ts",
15
14
  "import": "./lib/index.js",
16
15
  "require": "./lib/index.cjs"
17
16
  }
@@ -22,7 +21,7 @@
22
21
  "dependencies": {
23
22
  "cosmiconfig": "^9.0.0",
24
23
  "picomatch": "^4.0.2",
25
- "@jesscss/core": "2.0.0-alpha.6"
24
+ "@jesscss/core": "2.0.0-alpha.7"
26
25
  },
27
26
  "devDependencies": {
28
27
  "@types/node": "^22.10.2",
@@ -35,7 +34,7 @@
35
34
  "module": "lib/index.js",
36
35
  "scripts": {
37
36
  "build": "pnpm compile",
38
- "compile": "tsdown --tsconfig tsconfig.build.json && tsc -p tsconfig.build.json --emitDeclarationOnly",
37
+ "compile": "tsdown --tsconfig tsconfig.build.json --no-dts && tsc -p tsconfig.build.json --emitDeclarationOnly --noCheck",
39
38
  "test": "vitest"
40
39
  }
41
40
  }