@vizejs/vite-plugin 0.57.0 → 0.59.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.
@@ -0,0 +1,622 @@
1
+ import { defineConfig, loadConfig } from "vize";
2
+ import { Plugin } from "vite";
3
+
4
+ //#region ../vize/src/types/compiler.d.ts
5
+ /**
6
+ * Compiler configuration
7
+ */
8
+ interface CompilerConfig {
9
+ /**
10
+ * Compilation mode
11
+ * @default 'module'
12
+ */
13
+ mode?: "module" | "function";
14
+ /**
15
+ * Enable Vapor mode compilation
16
+ * @default false
17
+ */
18
+ vapor?: boolean;
19
+ /**
20
+ * Enable SSR mode
21
+ * @default false
22
+ */
23
+ ssr?: boolean;
24
+ /**
25
+ * Enable source map generation
26
+ * @default true in development, false in production
27
+ */
28
+ sourceMap?: boolean;
29
+ /**
30
+ * Prefix template identifiers with _ctx
31
+ * @default false
32
+ */
33
+ prefixIdentifiers?: boolean;
34
+ /**
35
+ * Hoist static nodes
36
+ * @default true
37
+ */
38
+ hoistStatic?: boolean;
39
+ /**
40
+ * Cache v-on handlers
41
+ * @default true
42
+ */
43
+ cacheHandlers?: boolean;
44
+ /**
45
+ * Enable TypeScript parsing in <script> blocks
46
+ * @default true
47
+ */
48
+ isTs?: boolean;
49
+ /**
50
+ * Script file extension for generated output
51
+ * @default 'ts'
52
+ */
53
+ scriptExt?: "ts" | "js";
54
+ /**
55
+ * Module name for runtime imports
56
+ * @default 'vue'
57
+ */
58
+ runtimeModuleName?: string;
59
+ /**
60
+ * Global variable name for runtime (IIFE builds)
61
+ * @default 'Vue'
62
+ */
63
+ runtimeGlobalName?: string;
64
+ }
65
+ /**
66
+ * Vite plugin configuration
67
+ */
68
+ interface VitePluginConfig {
69
+ /**
70
+ * Files to include in compilation
71
+ * @default /\.vue$/
72
+ */
73
+ include?: string | RegExp | (string | RegExp)[];
74
+ /**
75
+ * Files to exclude from compilation
76
+ * @default /node_modules/
77
+ */
78
+ exclude?: string | RegExp | (string | RegExp)[];
79
+ /**
80
+ * Glob patterns to scan for .vue files during pre-compilation
81
+ * @default ['**\/*.vue']
82
+ */
83
+ scanPatterns?: string[];
84
+ /**
85
+ * Glob patterns to ignore during pre-compilation
86
+ * @default ['node_modules/**', 'dist/**', '.git/**']
87
+ */
88
+ ignorePatterns?: string[];
89
+ }
90
+ //#endregion
91
+ //#region ../vize/src/types/rules.d.ts
92
+ 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-unsafe-template-binding", "type/require-typed-emits", "type/require-typed-props", "vapor/no-inline-template", "vapor/no-suspense", "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"];
93
+ type LintRuleName = (typeof LINT_RULE_NAMES)[number];
94
+ type LintRulesConfig = Partial<Record<LintRuleName, RuleSeverity>>;
95
+ //#endregion
96
+ //#region ../vize/src/types/tools.d.ts
97
+ /**
98
+ * Linter configuration
99
+ */
100
+ interface LinterConfig {
101
+ /**
102
+ * Enable linting
103
+ */
104
+ enabled?: boolean;
105
+ /**
106
+ * Built-in lint preset
107
+ * @default 'happy-path'
108
+ */
109
+ preset?: LintPreset;
110
+ /**
111
+ * Rules to enable/disable
112
+ */
113
+ rules?: LintRulesConfig;
114
+ /**
115
+ * Category-level severity overrides
116
+ */
117
+ categories?: Partial<Record<RuleCategory, RuleSeverity>>;
118
+ }
119
+ /**
120
+ * Type checker configuration
121
+ */
122
+ interface TypeCheckerConfig {
123
+ /**
124
+ * Enable type checking
125
+ * @default false
126
+ */
127
+ enabled?: boolean;
128
+ /**
129
+ * Enable strict mode
130
+ * @default false
131
+ */
132
+ strict?: boolean;
133
+ /**
134
+ * Check component props
135
+ * @default true
136
+ */
137
+ checkProps?: boolean;
138
+ /**
139
+ * Check component emits
140
+ * @default true
141
+ */
142
+ checkEmits?: boolean;
143
+ /**
144
+ * Check template bindings
145
+ * @default true
146
+ */
147
+ checkTemplateBindings?: boolean;
148
+ /**
149
+ * Path to tsconfig.json
150
+ * @default auto-detected
151
+ */
152
+ tsconfig?: string;
153
+ /**
154
+ * Path to the Corsa binary
155
+ */
156
+ corsaPath?: string;
157
+ }
158
+ /**
159
+ * Formatter configuration
160
+ */
161
+ interface FormatterConfig {
162
+ /**
163
+ * Max line width
164
+ * @default 80
165
+ */
166
+ printWidth?: number;
167
+ /**
168
+ * Indentation width
169
+ * @default 2
170
+ */
171
+ tabWidth?: number;
172
+ /**
173
+ * Use tabs for indentation
174
+ * @default false
175
+ */
176
+ useTabs?: boolean;
177
+ /**
178
+ * Print semicolons
179
+ * @default true
180
+ */
181
+ semi?: boolean;
182
+ /**
183
+ * Use single quotes
184
+ * @default false
185
+ */
186
+ singleQuote?: boolean;
187
+ /**
188
+ * Trailing commas
189
+ * @default 'all'
190
+ */
191
+ trailingComma?: "all" | "none" | "es5";
192
+ }
193
+ /**
194
+ * LSP configuration
195
+ */
196
+ interface LspConfig {
197
+ /**
198
+ * Enable LSP
199
+ * @default false
200
+ */
201
+ enabled?: boolean;
202
+ /**
203
+ * Enable linter diagnostics.
204
+ * Prefer this over `diagnostics` for new configs.
205
+ * @default false
206
+ */
207
+ lint?: boolean;
208
+ /**
209
+ * Enable linter diagnostics.
210
+ * @deprecated Use `lint` instead.
211
+ * @default false
212
+ */
213
+ diagnostics?: boolean;
214
+ /**
215
+ * Enable type checking diagnostics and type-aware LSP features.
216
+ * @default false
217
+ */
218
+ typecheck?: boolean;
219
+ /**
220
+ * Enable the editor assistance bundle: completion, hover, navigation,
221
+ * symbols, rename, code lens, semantic tokens, links, folding, inlay hints,
222
+ * and file rename handling. Formatting stays separately opt-in.
223
+ * @default false
224
+ */
225
+ editor?: boolean;
226
+ /**
227
+ * Enable completions.
228
+ * @default false
229
+ */
230
+ completion?: boolean;
231
+ /**
232
+ * Enable hover information
233
+ * @default false
234
+ */
235
+ hover?: boolean;
236
+ /**
237
+ * Enable go-to-definition
238
+ * @default false
239
+ */
240
+ definition?: boolean;
241
+ /**
242
+ * Enable find references
243
+ * @default false
244
+ */
245
+ references?: boolean;
246
+ /**
247
+ * Enable document symbols
248
+ * @default false
249
+ */
250
+ documentSymbols?: boolean;
251
+ /**
252
+ * Enable workspace symbols
253
+ * @default false
254
+ */
255
+ workspaceSymbols?: boolean;
256
+ /**
257
+ * Enable formatting via LSP
258
+ * @default false
259
+ */
260
+ formatting?: boolean;
261
+ /**
262
+ * Enable code actions
263
+ * @default false
264
+ */
265
+ codeActions?: boolean;
266
+ /**
267
+ * Enable rename
268
+ * @default false
269
+ */
270
+ rename?: boolean;
271
+ /**
272
+ * Enable code lens
273
+ * @default false
274
+ */
275
+ codeLens?: boolean;
276
+ /**
277
+ * Enable semantic tokens
278
+ * @default false
279
+ */
280
+ semanticTokens?: boolean;
281
+ /**
282
+ * Enable document links
283
+ * @default false
284
+ */
285
+ documentLinks?: boolean;
286
+ /**
287
+ * Enable folding ranges
288
+ * @default false
289
+ */
290
+ foldingRanges?: boolean;
291
+ /**
292
+ * Enable inlay hints
293
+ * @default false
294
+ */
295
+ inlayHints?: boolean;
296
+ /**
297
+ * Enable file rename edits
298
+ * @default false
299
+ */
300
+ fileRename?: boolean;
301
+ /**
302
+ * Use Corsa for type checking in LSP
303
+ * @default false
304
+ */
305
+ corsa?: boolean;
306
+ }
307
+ //#endregion
308
+ //#region ../vize/src/types/musea.d.ts
309
+ /**
310
+ * VRT (Visual Regression Testing) configuration for Musea
311
+ */
312
+ interface MuseaVrtConfig {
313
+ /**
314
+ * Threshold for pixel comparison (0-1)
315
+ * @default 0.1
316
+ */
317
+ threshold?: number;
318
+ /**
319
+ * Output directory for screenshots
320
+ * @default '__musea_snapshots__'
321
+ */
322
+ outDir?: string;
323
+ /**
324
+ * Viewport sizes
325
+ */
326
+ viewports?: Array<{
327
+ width: number;
328
+ height: number;
329
+ name?: string;
330
+ }>;
331
+ }
332
+ /**
333
+ * A11y configuration for Musea
334
+ */
335
+ interface MuseaA11yConfig {
336
+ /**
337
+ * Enable a11y checking
338
+ * @default false
339
+ */
340
+ enabled?: boolean;
341
+ /**
342
+ * Axe-core rules to enable/disable
343
+ */
344
+ rules?: Record<string, boolean>;
345
+ }
346
+ /**
347
+ * Autogen configuration for Musea
348
+ */
349
+ interface MuseaAutogenConfig {
350
+ /**
351
+ * Enable auto-generation of variants
352
+ * @default false
353
+ */
354
+ enabled?: boolean;
355
+ /**
356
+ * Max variants to generate per component
357
+ * @default 10
358
+ */
359
+ maxVariants?: number;
360
+ }
361
+ /**
362
+ * Musea component gallery configuration
363
+ */
364
+ interface MuseaConfig {
365
+ /**
366
+ * Glob patterns for art files
367
+ * @default ['**\/*.art.vue']
368
+ */
369
+ include?: string[];
370
+ /**
371
+ * Glob patterns to exclude
372
+ * @default ['node_modules/**', 'dist/**']
373
+ */
374
+ exclude?: string[];
375
+ /**
376
+ * Base path for gallery
377
+ * @default '/__musea__'
378
+ */
379
+ basePath?: string;
380
+ /**
381
+ * Enable Storybook compatibility
382
+ * @default false
383
+ */
384
+ storybookCompat?: boolean;
385
+ /**
386
+ * Enable inline art detection in .vue files
387
+ * @default false
388
+ */
389
+ inlineArt?: boolean;
390
+ /**
391
+ * VRT configuration
392
+ */
393
+ vrt?: MuseaVrtConfig;
394
+ /**
395
+ * A11y configuration
396
+ */
397
+ a11y?: MuseaA11yConfig;
398
+ /**
399
+ * Autogen configuration
400
+ */
401
+ autogen?: MuseaAutogenConfig;
402
+ }
403
+ //#endregion
404
+ //#region ../vize/src/types/loader.d.ts
405
+ /**
406
+ * Global type declaration
407
+ */
408
+ interface GlobalTypeDeclaration {
409
+ /**
410
+ * TypeScript type string
411
+ */
412
+ type: string;
413
+ /**
414
+ * Default value
415
+ */
416
+ defaultValue?: string;
417
+ }
418
+ /**
419
+ * Global types configuration
420
+ */
421
+ type GlobalTypesConfig = Record<string, GlobalTypeDeclaration | string>;
422
+ /**
423
+ * Options for loading vize.config file
424
+ */
425
+ interface LoadConfigOptions {
426
+ /**
427
+ * Config file search mode
428
+ * - 'root': Search only in the specified root directory
429
+ * - 'auto': Search from cwd upward until finding a config file
430
+ * - 'none': Don't load config file
431
+ * @default 'root'
432
+ */
433
+ mode?: "root" | "auto" | "none";
434
+ /**
435
+ * Custom config file path (overrides automatic search)
436
+ */
437
+ configFile?: string;
438
+ /**
439
+ * Config environment for dynamic config resolution
440
+ */
441
+ env?: ConfigEnv;
442
+ }
443
+ //#endregion
444
+ //#region ../vize/src/types/core.d.ts
445
+ interface ConfigEnv {
446
+ mode: string;
447
+ command: "serve" | "build" | "check" | "lint" | "fmt";
448
+ isSsrBuild?: boolean;
449
+ }
450
+ type RuleSeverity = "off" | "warn" | "error";
451
+ type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "security";
452
+ type LintPreset = "happy-path" | "opinionated" | "essential" | "nuxt";
453
+ /**
454
+ * Vize configuration options
455
+ */
456
+ interface VizeConfig {
457
+ /**
458
+ * JSON Schema reference for editor autocompletion.
459
+ */
460
+ $schema?: string;
461
+ /**
462
+ * Vue compiler options
463
+ */
464
+ compiler?: CompilerConfig;
465
+ /**
466
+ * Vite plugin options
467
+ */
468
+ vite?: VitePluginConfig;
469
+ /**
470
+ * Linter options
471
+ */
472
+ linter?: LinterConfig;
473
+ /**
474
+ * Type checker options
475
+ */
476
+ typeChecker?: TypeCheckerConfig;
477
+ /**
478
+ * Formatter options
479
+ */
480
+ formatter?: FormatterConfig;
481
+ /**
482
+ * LSP options
483
+ */
484
+ lsp?: LspConfig;
485
+ /**
486
+ * Musea component gallery options
487
+ */
488
+ musea?: MuseaConfig;
489
+ /**
490
+ * Global type declarations
491
+ */
492
+ globalTypes?: GlobalTypesConfig;
493
+ }
494
+ //#endregion
495
+ //#region src/types.d.ts
496
+ interface VizeOptions {
497
+ /**
498
+ * Override the public base used for dev-time asset URLs such as /@fs paths.
499
+ * Useful for frameworks like Nuxt that serve Vite from a subpath (e.g. /_nuxt/).
500
+ */
501
+ devUrlBase?: string;
502
+ /**
503
+ * Files to include in compilation
504
+ * @default /\.vue$/
505
+ */
506
+ include?: string | RegExp | (string | RegExp)[];
507
+ /**
508
+ * Files to exclude from compilation
509
+ * @default /node_modules/
510
+ */
511
+ exclude?: string | RegExp | (string | RegExp)[];
512
+ /**
513
+ * Force production mode
514
+ * @default auto-detected from Vite config
515
+ */
516
+ isProduction?: boolean;
517
+ /**
518
+ * Enable SSR mode
519
+ * @default false
520
+ */
521
+ ssr?: boolean;
522
+ /**
523
+ * Enable source map generation
524
+ * @default true in development, false in production
525
+ */
526
+ sourceMap?: boolean;
527
+ /**
528
+ * Enable Vapor mode compilation
529
+ * @default false
530
+ */
531
+ vapor?: boolean;
532
+ /**
533
+ * Root directory to scan for .vue files
534
+ * @default Vite's root
535
+ */
536
+ root?: string;
537
+ /**
538
+ * Glob patterns to scan for .vue files during pre-compilation
539
+ * @default ['**\/*.vue']
540
+ */
541
+ scanPatterns?: string[];
542
+ /**
543
+ * Glob patterns to ignore during pre-compilation
544
+ * @default ['node_modules/**', 'dist/**', '.git/**']
545
+ */
546
+ ignorePatterns?: string[];
547
+ /**
548
+ * Config file search mode
549
+ * - 'root': Search only in the project root directory
550
+ * - 'auto': Search from cwd upward until finding a config file
551
+ * - false: Disable config file loading
552
+ * @default 'root'
553
+ */
554
+ configMode?: "root" | "auto" | false;
555
+ /**
556
+ * Custom config file path (overrides automatic search)
557
+ */
558
+ configFile?: string;
559
+ /**
560
+ * Handle .vue files in node_modules (on-demand compilation).
561
+ * When true, vize will compile .vue files from node_modules that other plugins
562
+ * (like vite-plugin-vue-inspector) may import directly.
563
+ * Set to false if another Vue plugin (e.g. Nuxt) handles node_modules .vue files.
564
+ * @default true
565
+ */
566
+ handleNodeModulesVue?: boolean;
567
+ /**
568
+ * Enable debug logging
569
+ * @default false
570
+ */
571
+ debug?: boolean;
572
+ }
573
+ interface StyleBlockInfo {
574
+ /** Raw style content (uncompiled for preprocessor langs) */
575
+ content: string;
576
+ /** Language of the style block (e.g., "css", "scss", "less", "sass", "stylus") */
577
+ lang: string | null;
578
+ /** Whether the style block has the scoped attribute */
579
+ scoped: boolean;
580
+ /** CSS Modules: true for unnamed `module`, or the binding name for `module="name"` */
581
+ module: boolean | string;
582
+ /** Index of this style block in the SFC */
583
+ index: number;
584
+ }
585
+ interface CompiledModule {
586
+ code: string;
587
+ css?: string;
588
+ scopeId: string;
589
+ hasScoped: boolean;
590
+ templateHash?: string;
591
+ styleHash?: string;
592
+ scriptHash?: string;
593
+ /** Per-block style metadata extracted from the source SFC */
594
+ styles?: StyleBlockInfo[];
595
+ }
596
+ //#endregion
597
+ //#region src/virtual.d.ts
598
+ interface DynamicImportAliasRule {
599
+ fromPrefix: string;
600
+ toPrefix: string;
601
+ }
602
+ //#endregion
603
+ //#region src/transform.d.ts
604
+ declare function rewriteStaticAssetUrls(code: string, aliasRules: DynamicImportAliasRule[]): string;
605
+ //#endregion
606
+ //#region src/plugin/index.d.ts
607
+ declare function vize(options?: VizeOptions): Plugin[];
608
+ //#endregion
609
+ //#region src/config.d.ts
610
+ /**
611
+ * Shared config store for inter-plugin communication.
612
+ * Key = project root, Value = resolved VizeConfig.
613
+ * Used by musea() and other plugins to access the unified config.
614
+ */
615
+ declare const vizeConfigStore: Map<string, VizeConfig>;
616
+ //#endregion
617
+ //#region src/index.d.ts
618
+ declare const __internal: {
619
+ rewriteStaticAssetUrls: typeof rewriteStaticAssetUrls;
620
+ };
621
+ //#endregion
622
+ export { type CompiledModule, type LoadConfigOptions, type VizeConfig, type VizeOptions, __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, vize as default, vize, defineConfig, loadConfig, vizeConfigStore };