@vizejs/vite-plugin 0.89.0 → 0.91.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.
package/dist/index.d.mts CHANGED
@@ -1,113 +1,93 @@
1
1
  import { defineConfig, loadConfig } from "vize";
2
2
  import { Plugin } from "vite";
3
3
 
4
- //#region ../vize/src/types/compiler.d.ts
4
+ //#region ../vize/src/types/generated.d.ts
5
5
  /**
6
- * Compiler configuration
6
+ * Configuration file for vize - High-performance Vue.js toolchain
7
+ */
8
+ interface VizeConfig {
9
+ compiler?: CompilerConfig;
10
+ vite?: VitePluginConfig;
11
+ linter?: LinterConfig;
12
+ typeChecker?: TypeCheckerConfig;
13
+ formatter?: FormatterConfig;
14
+ languageServer?: LanguageServerConfig;
15
+ lsp?: LanguageServerConfig;
16
+ musea?: MuseaConfig;
17
+ globalTypes?: GlobalTypesConfig;
18
+ }
19
+ /**
20
+ * Vue compiler options
7
21
  */
8
22
  interface CompilerConfig {
9
23
  /**
10
24
  * Compilation mode
11
- * @default 'module'
12
25
  */
13
26
  mode?: "module" | "function";
14
27
  /**
15
28
  * Enable Vapor mode compilation
16
- * @default false
17
29
  */
18
30
  vapor?: boolean;
19
- /**
20
- * Treat lowercase non-HTML tags as custom renderer elements instead of Vue components.
21
- * Useful for TresJS and other custom renderers.
22
- * @default false
23
- */
24
- customRenderer?: boolean;
25
31
  /**
26
32
  * Enable SSR mode
27
- * @default false
28
33
  */
29
34
  ssr?: boolean;
30
35
  /**
31
36
  * Enable source map generation
32
- * @default true in development, false in production
33
37
  */
34
38
  sourceMap?: boolean;
35
39
  /**
36
40
  * Prefix template identifiers with _ctx
37
- * @default false
38
41
  */
39
42
  prefixIdentifiers?: boolean;
40
43
  /**
41
44
  * Hoist static nodes
42
- * @default true
43
45
  */
44
46
  hoistStatic?: boolean;
45
47
  /**
46
48
  * Cache v-on handlers
47
- * @default true
48
49
  */
49
50
  cacheHandlers?: boolean;
50
51
  /**
51
52
  * Enable TypeScript parsing in <script> blocks
52
- * @default true
53
53
  */
54
54
  isTs?: boolean;
55
55
  /**
56
56
  * Script file extension for generated output
57
- * @default 'ts'
58
57
  */
59
58
  scriptExt?: "ts" | "js";
60
59
  /**
61
60
  * Module name for runtime imports
62
- * @default 'vue'
63
61
  */
64
62
  runtimeModuleName?: string;
65
63
  /**
66
64
  * Global variable name for runtime (IIFE builds)
67
- * @default 'Vue'
68
65
  */
69
66
  runtimeGlobalName?: string;
70
67
  }
71
68
  /**
72
- * Vite plugin configuration
69
+ * Vite plugin options
73
70
  */
74
71
  interface VitePluginConfig {
75
72
  /**
76
- * Files to include in compilation
77
- * @default /\.vue$/
73
+ * Files to include in compilation (glob patterns or strings)
78
74
  */
79
75
  include?: string | RegExp | (string | RegExp)[];
80
76
  /**
81
- * Files to exclude from compilation
82
- * @default /node_modules/
77
+ * Files to exclude from compilation (glob patterns or strings)
83
78
  */
84
79
  exclude?: string | RegExp | (string | RegExp)[];
85
80
  /**
86
81
  * Glob patterns to scan for .vue files during pre-compilation
87
- * @default ['**\/*.vue']
88
82
  */
89
83
  scanPatterns?: string[];
90
- /**
91
- * Maximum number of Vue files to compile in a single native batch during
92
- * pre-compilation. Lower values reduce peak V8 heap usage in large apps.
93
- * @default 128
94
- */
95
- precompileBatchSize?: number;
96
84
  /**
97
85
  * Glob patterns to ignore during pre-compilation
98
- * @default ['node_modules/**', 'dist/**', '.git/**', '.nuxt/**', '.output/**', '.nitro/**', 'coverage/**']
99
86
  */
100
87
  ignorePatterns?: string[];
101
88
  }
102
- //#endregion
103
- //#region ../vize/src/types/rules.d.ts
104
- declare const LINT_RULE_NAMES: readonly ["a11y/alt-text", "a11y/anchor-has-content", "a11y/anchor-is-valid", "a11y/aria-props", "a11y/aria-role", "a11y/aria-unsupported-elements", "a11y/click-events-have-key-events", "a11y/form-control-has-label", "a11y/heading-has-content", "a11y/heading-levels", "a11y/iframe-has-title", "a11y/img-alt", "a11y/interactive-supports-focus", "a11y/label-has-for", "a11y/landmark-roles", "a11y/media-has-caption", "a11y/mouse-events-have-key-events", "a11y/no-access-key", "a11y/no-aria-hidden-on-focusable", "a11y/no-autofocus", "a11y/no-distracting-elements", "a11y/no-i-for-icon", "a11y/no-redundant-roles", "a11y/no-refer-to-non-existent-id", "a11y/no-role-presentation-on-focusable", "a11y/no-static-element-interactions", "a11y/placeholder-label-option", "a11y/role-has-required-aria-props", "a11y/tabindex-no-positive", "a11y/use-list", "html/deprecated-attr", "html/deprecated-element", "html/id-duplication", "html/no-consecutive-br", "html/no-duplicate-dt", "html/no-empty-palpable-content", "html/require-datetime", "script/no-get-current-instance", "script/no-next-tick", "script/no-options-api", "ssr/no-browser-globals-in-ssr", "ssr/no-hydration-mismatch", "type/no-floating-promises", "type/no-reactivity-loss", "type/no-unsafe-template-binding", "type/require-typed-emits", "type/require-typed-props", "vapor/no-inline-template", "vapor/no-vue-lifecycle-events", "vapor/prefer-static-class", "vapor/require-vapor-attribute", "vue/attribute-hyphenation", "vue/attribute-order", "vue/component-definition-name-casing", "vue/component-name-in-template-casing", "vue/html-quotes", "vue/html-self-closing", "vue/multi-word-component-names", "vue/mustache-interpolation-spacing", "vue/no-boolean-attr-value", "vue/no-child-content", "vue/no-dupe-v-else-if", "vue/no-duplicate-attributes", "vue/no-inline-style", "vue/no-lone-template", "vue/no-multi-spaces", "vue/no-mutating-props", "vue/no-preprocessor-lang", "vue/no-reserved-component-names", "vue/no-script-non-standard-lang", "vue/no-src-attribute", "vue/no-template-key", "vue/no-template-lang", "vue/no-template-shadow", "vue/no-textarea-mustache", "vue/no-unsafe-url", "vue/no-unused-components", "vue/no-unused-properties", "vue/no-unused-vars", "vue/no-use-v-if-with-v-for", "vue/no-useless-template-attributes", "vue/no-v-html", "vue/no-v-text-v-html-on-component", "vue/permitted-contents", "vue/prefer-props-shorthand", "vue/prop-name-casing", "vue/require-component-is", "vue/require-component-registration", "vue/require-scoped-style", "vue/require-v-for-key", "vue/scoped-event-names", "vue/sfc-element-order", "vue/single-style-block", "vue/use-unique-element-ids", "vue/use-v-on-exact", "vue/v-bind-style", "vue/v-on-style", "vue/v-slot-style", "vue/valid-attribute-name", "vue/valid-v-bind", "vue/valid-v-else", "vue/valid-v-for", "vue/valid-v-if", "vue/valid-v-memo", "vue/valid-v-model", "vue/valid-v-on", "vue/valid-v-show", "vue/valid-v-slot", "vue/warn-custom-block", "vue/warn-custom-directive"];
105
- type LintRuleName = (typeof LINT_RULE_NAMES)[number];
106
- type LintRulesConfig = Partial<Record<LintRuleName, RuleSeverity>>;
107
- //#endregion
108
- //#region ../vize/src/types/tools.d.ts
109
89
  /**
110
- * Linter configuration
90
+ * Linter options
111
91
  */
112
92
  interface LinterConfig {
113
93
  /**
@@ -116,304 +96,358 @@ interface LinterConfig {
116
96
  enabled?: boolean;
117
97
  /**
118
98
  * Built-in lint preset
119
- * @default 'happy-path'
120
99
  */
121
- preset?: LintPreset;
100
+ preset?: "happy-path" | "opinionated" | "essential" | "incremental" | "nuxt";
122
101
  /**
123
102
  * Rules to enable/disable
124
103
  */
125
- rules?: LintRulesConfig;
104
+ rules?: {
105
+ [k: string]: "off" | "warn" | "error";
106
+ };
126
107
  /**
127
108
  * Category-level severity overrides
128
109
  */
129
- categories?: Partial<Record<RuleCategory, RuleSeverity>>;
110
+ categories?: {
111
+ correctness?: "off" | "warn" | "error";
112
+ suspicious?: "off" | "warn" | "error";
113
+ style?: "off" | "warn" | "error";
114
+ perf?: "off" | "warn" | "error";
115
+ a11y?: "off" | "warn" | "error";
116
+ security?: "off" | "warn" | "error";
117
+ };
130
118
  }
131
119
  /**
132
- * Type checker configuration
120
+ * Type checker options
133
121
  */
134
122
  interface TypeCheckerConfig {
135
123
  /**
136
124
  * Enable type checking
137
- * @default false
138
125
  */
139
126
  enabled?: boolean;
140
127
  /**
141
128
  * Enable strict mode
142
- * @default false
143
129
  */
144
130
  strict?: boolean;
145
131
  /**
146
132
  * Check component props
147
- * @default true
148
133
  */
149
134
  checkProps?: boolean;
150
135
  /**
151
136
  * Check component emits
152
- * @default true
153
137
  */
154
138
  checkEmits?: boolean;
155
139
  /**
156
140
  * Check template bindings
157
- * @default true
158
141
  */
159
142
  checkTemplateBindings?: boolean;
143
+ /**
144
+ * Check reactivity loss patterns
145
+ */
146
+ checkReactivity?: boolean;
147
+ /**
148
+ * Check setup context violations
149
+ */
150
+ checkSetupContext?: boolean;
151
+ /**
152
+ * Check invalid exports in <script setup>
153
+ */
154
+ checkInvalidExports?: boolean;
155
+ /**
156
+ * Check fallthrough attrs on multi-root templates
157
+ */
158
+ checkFallthroughAttrs?: boolean;
160
159
  /**
161
160
  * Path to tsconfig.json
162
- * @default auto-detected
163
161
  */
164
162
  tsconfig?: string;
165
163
  /**
166
- * Path to the Corsa binary
164
+ * Path to tsgo binary
165
+ */
166
+ tsgoPath?: string;
167
+ /**
168
+ * Path to a .d.ts file that declares template globals
167
169
  */
168
- corsaPath?: string;
170
+ globalsFile?: string;
171
+ /**
172
+ * Number of parallel Corsa servers to use
173
+ */
174
+ servers?: number;
169
175
  }
170
176
  /**
171
- * Formatter configuration
177
+ * Formatter options
172
178
  */
173
179
  interface FormatterConfig {
174
180
  /**
175
181
  * Max line width
176
- * @default 80
177
182
  */
178
183
  printWidth?: number;
179
184
  /**
180
185
  * Indentation width
181
- * @default 2
182
186
  */
183
187
  tabWidth?: number;
184
188
  /**
185
189
  * Use tabs for indentation
186
- * @default false
187
190
  */
188
191
  useTabs?: boolean;
189
192
  /**
190
193
  * Print semicolons
191
- * @default true
192
194
  */
193
195
  semi?: boolean;
194
196
  /**
195
197
  * Use single quotes
196
- * @default false
197
198
  */
198
199
  singleQuote?: boolean;
200
+ /**
201
+ * Use single quotes in JSX
202
+ */
203
+ jsxSingleQuote?: boolean;
199
204
  /**
200
205
  * Trailing commas
201
- * @default 'all'
202
206
  */
203
207
  trailingComma?: "all" | "none" | "es5";
208
+ /**
209
+ * Print spaces between brackets in object literals
210
+ */
211
+ bracketSpacing?: boolean;
212
+ /**
213
+ * Keep > on the last line of multiline tags
214
+ */
215
+ bracketSameLine?: boolean;
216
+ /**
217
+ * Arrow parens mode
218
+ */
219
+ arrowParens?: "always" | "avoid";
220
+ /**
221
+ * End-of-line mode
222
+ */
223
+ endOfLine?: "lf" | "crlf" | "cr" | "auto";
224
+ /**
225
+ * Object property quoting mode
226
+ */
227
+ quoteProps?: "as-needed" | "consistent" | "preserve";
228
+ /**
229
+ * Force one attribute per line
230
+ */
231
+ singleAttributePerLine?: boolean;
232
+ /**
233
+ * Indent script and style blocks
234
+ */
235
+ vueIndentScriptAndStyle?: boolean;
236
+ /**
237
+ * Sort attributes
238
+ */
239
+ sortAttributes?: boolean;
240
+ /**
241
+ * Attribute ordering strategy
242
+ */
243
+ attributeSortOrder?: "alphabetical" | "as-written";
244
+ /**
245
+ * Merge bind and non-bind attrs for sorting
246
+ */
247
+ mergeBindAndNonBindAttrs?: boolean;
248
+ /**
249
+ * Maximum attributes per line before wrapping
250
+ */
251
+ maxAttributesPerLine?: number;
252
+ /**
253
+ * Custom attribute groups
254
+ */
255
+ attributeGroups?: string[][];
256
+ /**
257
+ * Normalize directive shorthands
258
+ */
259
+ normalizeDirectiveShorthands?: boolean;
260
+ /**
261
+ * Sort SFC blocks in canonical order
262
+ */
263
+ sortBlocks?: boolean;
204
264
  }
205
265
  /**
206
- * LSP configuration
266
+ * Language server options
207
267
  */
208
- interface LspConfig {
268
+ interface LanguageServerConfig {
209
269
  /**
210
- * Enable LSP
211
- * @default false
270
+ * Enable the language server
212
271
  */
213
272
  enabled?: boolean;
214
273
  /**
215
- * Enable linter diagnostics.
216
- * Prefer this over `diagnostics` for new configs.
217
- * @default false
274
+ * Enable lint diagnostics
218
275
  */
219
276
  lint?: boolean;
220
277
  /**
221
- * Enable linter diagnostics.
222
- * @deprecated Use `lint` instead.
223
- * @default false
278
+ * Deprecated alias for lint
224
279
  */
225
280
  diagnostics?: boolean;
226
281
  /**
227
- * Enable type checking diagnostics and type-aware LSP features.
228
- * @default false
282
+ * Enable project type checking diagnostics
229
283
  */
230
284
  typecheck?: boolean;
231
285
  /**
232
- * Enable the editor assistance bundle: completion, hover, navigation,
233
- * symbols, rename, code lens, semantic tokens, links, folding, inlay hints,
234
- * and file rename handling. Formatting stays separately opt-in.
235
- * @default false
286
+ * Enable editor-oriented IDE features
236
287
  */
237
288
  editor?: boolean;
238
289
  /**
239
- * Enable completions.
240
- * @default false
290
+ * Enable completions
241
291
  */
242
292
  completion?: boolean;
243
293
  /**
244
294
  * Enable hover information
245
- * @default false
246
295
  */
247
296
  hover?: boolean;
248
297
  /**
249
298
  * Enable go-to-definition
250
- * @default false
251
299
  */
252
300
  definition?: boolean;
253
301
  /**
254
- * Enable find references
255
- * @default false
302
+ * Enable reference search
256
303
  */
257
304
  references?: boolean;
258
305
  /**
259
306
  * Enable document symbols
260
- * @default false
261
307
  */
262
308
  documentSymbols?: boolean;
263
309
  /**
264
310
  * Enable workspace symbols
265
- * @default false
266
311
  */
267
312
  workspaceSymbols?: boolean;
268
313
  /**
269
- * Enable formatting via LSP
270
- * @default false
314
+ * Enable formatting via the language server
271
315
  */
272
316
  formatting?: boolean;
273
317
  /**
274
318
  * Enable code actions
275
- * @default false
276
319
  */
277
320
  codeActions?: boolean;
278
321
  /**
279
- * Enable rename
280
- * @default false
322
+ * Enable rename support
281
323
  */
282
324
  rename?: boolean;
283
325
  /**
284
- * Enable code lens
285
- * @default false
326
+ * Enable code lenses
286
327
  */
287
328
  codeLens?: boolean;
288
329
  /**
289
330
  * Enable semantic tokens
290
- * @default false
291
331
  */
292
332
  semanticTokens?: boolean;
293
333
  /**
294
334
  * Enable document links
295
- * @default false
296
335
  */
297
336
  documentLinks?: boolean;
298
337
  /**
299
338
  * Enable folding ranges
300
- * @default false
301
339
  */
302
340
  foldingRanges?: boolean;
303
341
  /**
304
342
  * Enable inlay hints
305
- * @default false
306
343
  */
307
344
  inlayHints?: boolean;
308
345
  /**
309
346
  * Enable file rename edits
310
- * @default false
311
347
  */
312
348
  fileRename?: boolean;
313
349
  /**
314
- * Use Corsa for type checking in LSP
315
- * @default false
350
+ * Enable Corsa-backed IDE features
316
351
  */
317
352
  corsa?: boolean;
353
+ /**
354
+ * Deprecated alias for corsa
355
+ */
356
+ tsgo?: boolean;
357
+ }
358
+ /**
359
+ * Musea component gallery options
360
+ */
361
+ interface MuseaConfig {
362
+ /**
363
+ * Glob patterns for art files
364
+ */
365
+ include?: string[];
366
+ /**
367
+ * Glob patterns to exclude
368
+ */
369
+ exclude?: string[];
370
+ /**
371
+ * Base path for gallery
372
+ */
373
+ basePath?: string;
374
+ /**
375
+ * Enable Storybook compatibility
376
+ */
377
+ storybookCompat?: boolean;
378
+ /**
379
+ * Enable inline art detection in .vue files
380
+ */
381
+ inlineArt?: boolean;
382
+ vrt?: MuseaVrtConfig;
383
+ a11y?: MuseaA11yConfig;
384
+ autogen?: MuseaAutogenConfig;
318
385
  }
319
- //#endregion
320
- //#region ../vize/src/types/musea.d.ts
321
386
  /**
322
- * VRT (Visual Regression Testing) configuration for Musea
387
+ * VRT (Visual Regression Testing) configuration
323
388
  */
324
389
  interface MuseaVrtConfig {
325
390
  /**
326
391
  * Threshold for pixel comparison (0-1)
327
- * @default 0.1
328
392
  */
329
393
  threshold?: number;
330
394
  /**
331
395
  * Output directory for screenshots
332
- * @default '__musea_snapshots__'
333
396
  */
334
397
  outDir?: string;
335
398
  /**
336
399
  * Viewport sizes
337
400
  */
338
- viewports?: Array<{
339
- width: number;
340
- height: number;
341
- name?: string;
342
- }>;
401
+ viewports?: MuseaViewport[];
402
+ }
403
+ interface MuseaViewport {
404
+ /**
405
+ * Viewport width
406
+ */
407
+ width: number;
408
+ /**
409
+ * Viewport height
410
+ */
411
+ height: number;
412
+ /**
413
+ * Viewport name
414
+ */
415
+ name?: string;
343
416
  }
344
417
  /**
345
- * A11y configuration for Musea
418
+ * A11y configuration
346
419
  */
347
420
  interface MuseaA11yConfig {
348
421
  /**
349
422
  * Enable a11y checking
350
- * @default false
351
423
  */
352
424
  enabled?: boolean;
353
425
  /**
354
426
  * Axe-core rules to enable/disable
355
427
  */
356
- rules?: Record<string, boolean>;
428
+ rules?: {
429
+ [k: string]: boolean;
430
+ };
357
431
  }
358
432
  /**
359
- * Autogen configuration for Musea
433
+ * Autogen configuration
360
434
  */
361
435
  interface MuseaAutogenConfig {
362
436
  /**
363
437
  * Enable auto-generation of variants
364
- * @default false
365
438
  */
366
439
  enabled?: boolean;
367
440
  /**
368
441
  * Max variants to generate per component
369
- * @default 10
370
442
  */
371
443
  maxVariants?: number;
372
444
  }
373
445
  /**
374
- * Musea component gallery configuration
446
+ * Global type declarations
375
447
  */
376
- interface MuseaConfig {
377
- /**
378
- * Glob patterns for art files
379
- * @default ['**\/*.art.vue']
380
- */
381
- include?: string[];
382
- /**
383
- * Glob patterns to exclude
384
- * @default ['node_modules/**', 'dist/**']
385
- */
386
- exclude?: string[];
387
- /**
388
- * Base path for gallery
389
- * @default '/__musea__'
390
- */
391
- basePath?: string;
392
- /**
393
- * Enable Storybook compatibility
394
- * @default false
395
- */
396
- storybookCompat?: boolean;
397
- /**
398
- * Enable inline art detection in .vue files
399
- * @default false
400
- */
401
- inlineArt?: boolean;
402
- /**
403
- * VRT configuration
404
- */
405
- vrt?: MuseaVrtConfig;
406
- /**
407
- * A11y configuration
408
- */
409
- a11y?: MuseaA11yConfig;
410
- /**
411
- * Autogen configuration
412
- */
413
- autogen?: MuseaAutogenConfig;
448
+ interface GlobalTypesConfig {
449
+ [k: string]: string | GlobalTypeDeclaration;
414
450
  }
415
- //#endregion
416
- //#region ../vize/src/types/loader.d.ts
417
451
  /**
418
452
  * Global type declaration
419
453
  */
@@ -427,13 +461,13 @@ interface GlobalTypeDeclaration {
427
461
  */
428
462
  defaultValue?: string;
429
463
  }
430
- /**
431
- * Global types configuration
432
- */
433
- type GlobalTypesConfig = Record<string, GlobalTypeDeclaration | string>;
434
- /**
435
- * Options for loading vize.config file
436
- */
464
+ //#endregion
465
+ //#region ../vize/src/types/runtime.d.ts
466
+ interface ConfigEnv {
467
+ mode: string;
468
+ command: "serve" | "build" | "check" | "lint" | "fmt";
469
+ isSsrBuild?: boolean;
470
+ }
437
471
  interface LoadConfigOptions {
438
472
  /**
439
473
  * Config file search mode
@@ -453,57 +487,6 @@ interface LoadConfigOptions {
453
487
  env?: ConfigEnv;
454
488
  }
455
489
  //#endregion
456
- //#region ../vize/src/types/core.d.ts
457
- interface ConfigEnv {
458
- mode: string;
459
- command: "serve" | "build" | "check" | "lint" | "fmt";
460
- isSsrBuild?: boolean;
461
- }
462
- type RuleSeverity = "off" | "warn" | "error";
463
- type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "security";
464
- type LintPreset = "happy-path" | "opinionated" | "essential" | "nuxt";
465
- /**
466
- * Vize configuration options
467
- */
468
- interface VizeConfig {
469
- /**
470
- * JSON Schema reference for editor autocompletion.
471
- */
472
- $schema?: string;
473
- /**
474
- * Vue compiler options
475
- */
476
- compiler?: CompilerConfig;
477
- /**
478
- * Vite plugin options
479
- */
480
- vite?: VitePluginConfig;
481
- /**
482
- * Linter options
483
- */
484
- linter?: LinterConfig;
485
- /**
486
- * Type checker options
487
- */
488
- typeChecker?: TypeCheckerConfig;
489
- /**
490
- * Formatter options
491
- */
492
- formatter?: FormatterConfig;
493
- /**
494
- * LSP options
495
- */
496
- lsp?: LspConfig;
497
- /**
498
- * Musea component gallery options
499
- */
500
- musea?: MuseaConfig;
501
- /**
502
- * Global type declarations
503
- */
504
- globalTypes?: GlobalTypesConfig;
505
- }
506
- //#endregion
507
490
  //#region src/types.d.ts
508
491
  interface MacroArtifact {
509
492
  kind: string;
package/dist/index.mjs CHANGED
@@ -364,14 +364,14 @@ function resolveCssPath(importPath, importer, aliasRules) {
364
364
  }
365
365
  function resolveAliasPath(importPath, rule) {
366
366
  if (typeof rule.find !== "string") {
367
- const pattern = stableAliasPattern(rule.find);
367
+ const pattern = stableAliasPattern$1(rule.find);
368
368
  return pattern.test(importPath) ? importPath.replace(pattern, rule.replacement) : null;
369
369
  }
370
370
  const suffix = matchedAliasSuffix(importPath, rule.find);
371
371
  if (suffix !== null) return path.join(rule.replacement, suffix);
372
372
  return null;
373
373
  }
374
- function stableAliasPattern(pattern) {
374
+ function stableAliasPattern$1(pattern) {
375
375
  return new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, ""));
376
376
  }
377
377
  function matchedAliasSuffix(importPath, find) {
@@ -651,15 +651,14 @@ function createLogger(debug) {
651
651
  const vizeConfigStore = /* @__PURE__ */ new Map();
652
652
  //#endregion
653
653
  //#region src/compile-options.ts
654
- function buildCompileFileOptions(filePath, source, options) {
655
- const scopeId = /<style[^>]*\bscoped\b/.test(source) ? `data-v-${generateScopeId(filePath)}` : void 0;
654
+ function buildCompileFileOptions(filePath, options) {
656
655
  return {
657
656
  filename: filePath,
658
657
  sourceMap: options.sourceMap,
659
658
  ssr: options.ssr,
660
659
  vapor: options.vapor,
661
660
  customRenderer: options.customRenderer ?? false,
662
- scopeId
661
+ scopeId: `data-v-${generateScopeId(filePath)}`
663
662
  };
664
663
  }
665
664
  function buildCompileBatchOptions(options) {
@@ -672,38 +671,20 @@ function buildCompileBatchOptions(options) {
672
671
  //#endregion
673
672
  //#region src/compiler.ts
674
673
  const { compileSfc, compileSfcBatchWithResults } = native;
675
- /**
676
- * Extract style block metadata from a Vue SFC source string.
677
- * Parses `<style>` tags to determine lang, scoped, and module attributes.
678
- */
679
- function extractStyleBlocks(source) {
680
- const blocks = [];
681
- const styleRegex = /<style([^>]*)>([\s\S]*?)<\/style>/gi;
682
- let match;
683
- let index = 0;
684
- while ((match = styleRegex.exec(source)) !== null) {
685
- const attrs = match[1];
686
- const content = match[2];
687
- const lang = attrs.match(/\blang=["']([^"']+)["']/)?.[1] ?? null;
688
- const scoped = /\bscoped\b/.test(attrs);
689
- const moduleMatch = attrs.match(/\bmodule(?:=["']([^"']+)["'])?/);
690
- const isModule = moduleMatch ? moduleMatch[1] || true : false;
691
- blocks.push({
692
- content,
693
- lang,
694
- scoped,
695
- module: isModule,
696
- index
697
- });
698
- index++;
699
- }
700
- return blocks;
674
+ function normalizeStyleBlocks(styles) {
675
+ if (!styles) return [];
676
+ return styles.map((block) => ({
677
+ content: block.content,
678
+ lang: block.lang ?? null,
679
+ scoped: block.scoped,
680
+ module: block.module ? block.moduleName ?? true : false,
681
+ index: block.index
682
+ }));
701
683
  }
702
684
  function compileFile(filePath, cache, options, source) {
703
685
  const content = source ?? fs.readFileSync(filePath, "utf-8");
704
686
  const scopeId = generateScopeId(filePath);
705
- const hasScoped = /<style[^>]*\bscoped\b/.test(content);
706
- const result = compileSfc(content, buildCompileFileOptions(filePath, content, options));
687
+ const result = compileSfc(content, buildCompileFileOptions(filePath, options));
707
688
  if (result.errors.length > 0) {
708
689
  const errorMsg = result.errors.join("\n");
709
690
  console.error(`[vize] Compilation error in ${filePath}:\n${errorMsg}`);
@@ -711,17 +692,16 @@ function compileFile(filePath, cache, options, source) {
711
692
  if (result.warnings.length > 0) result.warnings.forEach((warning) => {
712
693
  console.warn(`[vize] Warning in ${filePath}: ${warning}`);
713
694
  });
714
- const styles = extractStyleBlocks(content);
715
695
  const compiled = {
716
696
  code: result.code,
717
697
  css: result.css,
718
698
  scopeId,
719
- hasScoped,
699
+ hasScoped: result.hasScoped,
720
700
  templateHash: result.templateHash,
721
701
  styleHash: result.styleHash,
722
702
  scriptHash: result.scriptHash,
723
703
  macroArtifacts: result.macroArtifacts ?? [],
724
- styles
704
+ styles: normalizeStyleBlocks(result.styles)
725
705
  };
726
706
  cache.set(filePath, compiled);
727
707
  return compiled;
@@ -735,24 +715,18 @@ function compileBatch(files, cache, options) {
735
715
  path: f.path,
736
716
  source: f.source
737
717
  })), buildCompileBatchOptions(options));
738
- const sourceMap = /* @__PURE__ */ new Map();
739
- for (const f of files) sourceMap.set(f.path, f.source);
740
718
  for (const fileResult of result.results) {
741
- if (fileResult.errors.length === 0) {
742
- const source = sourceMap.get(fileResult.path);
743
- const styles = source ? extractStyleBlocks(source) : void 0;
744
- cache.set(fileResult.path, {
745
- code: fileResult.code,
746
- css: fileResult.css,
747
- scopeId: fileResult.scopeId,
748
- hasScoped: fileResult.hasScoped,
749
- templateHash: fileResult.templateHash,
750
- styleHash: fileResult.styleHash,
751
- scriptHash: fileResult.scriptHash,
752
- macroArtifacts: fileResult.macroArtifacts ?? [],
753
- styles
754
- });
755
- }
719
+ if (fileResult.errors.length === 0) cache.set(fileResult.path, {
720
+ code: fileResult.code,
721
+ css: fileResult.css,
722
+ scopeId: fileResult.scopeId,
723
+ hasScoped: fileResult.hasScoped,
724
+ templateHash: fileResult.templateHash,
725
+ styleHash: fileResult.styleHash,
726
+ scriptHash: fileResult.scriptHash,
727
+ macroArtifacts: fileResult.macroArtifacts ?? [],
728
+ styles: normalizeStyleBlocks(fileResult.styles)
729
+ });
756
730
  if (fileResult.errors.length > 0) console.error(`[vize] Compilation error in ${fileResult.path}:\n${fileResult.errors.join("\n")}`);
757
731
  if (fileResult.warnings.length > 0) fileResult.warnings.forEach((warning) => {
758
732
  console.warn(`[vize] Warning in ${fileResult.path}: ${warning}`);
@@ -942,12 +916,20 @@ function isBareSpecifier(id) {
942
916
  function resolveAliasRequest(state, id) {
943
917
  const [request, querySuffix] = splitIdQuery(id);
944
918
  for (const rule of state.cssAliasRules) {
919
+ if (rule.find instanceof RegExp) {
920
+ const pattern = stableAliasPattern(rule.find);
921
+ if (pattern.test(request)) return request.replace(pattern, rule.replacement) + querySuffix;
922
+ continue;
923
+ }
945
924
  if (request === rule.find) return rule.replacement + querySuffix;
946
925
  const findPrefix = rule.find.endsWith("/") ? rule.find : rule.find + "/";
947
926
  if (request.startsWith(findPrefix)) return (rule.replacement.endsWith("/") ? rule.replacement : rule.replacement + "/") + request.slice(findPrefix.length) + querySuffix;
948
927
  }
949
928
  return null;
950
929
  }
930
+ function stableAliasPattern(pattern) {
931
+ return new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, ""));
932
+ }
951
933
  function pushPnpmHoistBases(candidates, start, isDirectory) {
952
934
  if (!start) return;
953
935
  let dir = isDirectory ? start : path.dirname(start);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.89.0",
3
+ "version": "0.91.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -33,9 +33,9 @@
33
33
  "access": "public"
34
34
  },
35
35
  "dependencies": {
36
- "@vizejs/native": "0.89.0",
36
+ "@vizejs/native": "0.91.0",
37
37
  "tinyglobby": "0.2.16",
38
- "vize": "0.89.0"
38
+ "vize": "0.91.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "25.7.0",