@vizejs/vite-plugin 0.0.1-alpha.9 → 0.0.1-alpha.98
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/README.md +5 -5
- package/dist/index.d.ts +498 -5
- package/dist/index.js +534 -138
- package/package.json +23 -11
- package/dist/compiler.d.ts +0 -6
- package/dist/compiler.js +0 -46
- package/dist/types.d.ts +0 -66
- package/dist/types.js +0 -1
- package/dist/utils.d.ts +0 -4
- package/dist/utils.js +0 -71
package/README.md
CHANGED
|
@@ -30,11 +30,11 @@ yarn add @vizejs/vite-plugin
|
|
|
30
30
|
```ts
|
|
31
31
|
// vite.config.ts
|
|
32
32
|
import { defineConfig } from 'vite'
|
|
33
|
-
import
|
|
33
|
+
import vize from '@vizejs/vite-plugin'
|
|
34
34
|
|
|
35
35
|
export default defineConfig({
|
|
36
36
|
plugins: [
|
|
37
|
-
|
|
37
|
+
vize({
|
|
38
38
|
// options
|
|
39
39
|
})
|
|
40
40
|
]
|
|
@@ -47,12 +47,12 @@ For Nuxt 3, add the plugin to your `nuxt.config.ts`:
|
|
|
47
47
|
|
|
48
48
|
```ts
|
|
49
49
|
// nuxt.config.ts
|
|
50
|
-
import
|
|
50
|
+
import vize from '@vizejs/vite-plugin'
|
|
51
51
|
|
|
52
52
|
export default defineNuxtConfig({
|
|
53
53
|
vite: {
|
|
54
54
|
plugins: [
|
|
55
|
-
|
|
55
|
+
vize({
|
|
56
56
|
// Exclude Nuxt's internal .vue files if needed
|
|
57
57
|
exclude: [/node_modules/, /#/, /\.nuxt/]
|
|
58
58
|
})
|
|
@@ -81,7 +81,7 @@ export default defineNuxtConfig({
|
|
|
81
81
|
},
|
|
82
82
|
vite: {
|
|
83
83
|
plugins: [
|
|
84
|
-
|
|
84
|
+
vize()
|
|
85
85
|
]
|
|
86
86
|
}
|
|
87
87
|
})
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,498 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
|
|
3
|
+
//#region ../vize/src/types.d.ts
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
interface ConfigEnv {
|
|
6
|
+
mode: string;
|
|
7
|
+
command: "serve" | "build" | "check" | "lint" | "fmt";
|
|
8
|
+
isSsrBuild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type UserConfigExport = VizeConfig | ((env: ConfigEnv) => MaybePromise<VizeConfig>);
|
|
11
|
+
type RuleSeverity = "off" | "warn" | "error";
|
|
12
|
+
type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "security";
|
|
13
|
+
/**
|
|
14
|
+
* Vize configuration options
|
|
15
|
+
*/
|
|
16
|
+
interface VizeConfig {
|
|
17
|
+
/**
|
|
18
|
+
* Vue compiler options
|
|
19
|
+
*/
|
|
20
|
+
compiler?: CompilerConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Vite plugin options
|
|
23
|
+
*/
|
|
24
|
+
vite?: VitePluginConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Linter options
|
|
27
|
+
*/
|
|
28
|
+
linter?: LinterConfig;
|
|
29
|
+
/**
|
|
30
|
+
* Type checker options
|
|
31
|
+
*/
|
|
32
|
+
typeChecker?: TypeCheckerConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Formatter options
|
|
35
|
+
*/
|
|
36
|
+
formatter?: FormatterConfig;
|
|
37
|
+
/**
|
|
38
|
+
* LSP options
|
|
39
|
+
*/
|
|
40
|
+
lsp?: LspConfig;
|
|
41
|
+
/**
|
|
42
|
+
* Musea component gallery options
|
|
43
|
+
*/
|
|
44
|
+
musea?: MuseaConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Global type declarations
|
|
47
|
+
*/
|
|
48
|
+
globalTypes?: GlobalTypesConfig;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Compiler configuration
|
|
52
|
+
*/
|
|
53
|
+
interface CompilerConfig {
|
|
54
|
+
/**
|
|
55
|
+
* Compilation mode
|
|
56
|
+
* @default 'module'
|
|
57
|
+
*/
|
|
58
|
+
mode?: "module" | "function";
|
|
59
|
+
/**
|
|
60
|
+
* Enable Vapor mode compilation
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
vapor?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Enable SSR mode
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
ssr?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Enable source map generation
|
|
71
|
+
* @default true in development, false in production
|
|
72
|
+
*/
|
|
73
|
+
sourceMap?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Prefix template identifiers with _ctx
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
prefixIdentifiers?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Hoist static nodes
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
hoistStatic?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Cache v-on handlers
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
cacheHandlers?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Enable TypeScript parsing in <script> blocks
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
isTs?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Script file extension for generated output
|
|
96
|
+
* @default 'ts'
|
|
97
|
+
*/
|
|
98
|
+
scriptExt?: "ts" | "js";
|
|
99
|
+
/**
|
|
100
|
+
* Module name for runtime imports
|
|
101
|
+
* @default 'vue'
|
|
102
|
+
*/
|
|
103
|
+
runtimeModuleName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Global variable name for runtime (IIFE builds)
|
|
106
|
+
* @default 'Vue'
|
|
107
|
+
*/
|
|
108
|
+
runtimeGlobalName?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Vite plugin configuration
|
|
112
|
+
*/
|
|
113
|
+
interface VitePluginConfig {
|
|
114
|
+
/**
|
|
115
|
+
* Files to include in compilation
|
|
116
|
+
* @default /\.vue$/
|
|
117
|
+
*/
|
|
118
|
+
include?: string | RegExp | (string | RegExp)[];
|
|
119
|
+
/**
|
|
120
|
+
* Files to exclude from compilation
|
|
121
|
+
* @default /node_modules/
|
|
122
|
+
*/
|
|
123
|
+
exclude?: string | RegExp | (string | RegExp)[];
|
|
124
|
+
/**
|
|
125
|
+
* Glob patterns to scan for .vue files during pre-compilation
|
|
126
|
+
* @default ['**\/*.vue']
|
|
127
|
+
*/
|
|
128
|
+
scanPatterns?: string[];
|
|
129
|
+
/**
|
|
130
|
+
* Glob patterns to ignore during pre-compilation
|
|
131
|
+
* @default ['node_modules/**', 'dist/**', '.git/**']
|
|
132
|
+
*/
|
|
133
|
+
ignorePatterns?: string[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Linter configuration
|
|
137
|
+
*/
|
|
138
|
+
interface LinterConfig {
|
|
139
|
+
/**
|
|
140
|
+
* Enable linting
|
|
141
|
+
*/
|
|
142
|
+
enabled?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Rules to enable/disable
|
|
145
|
+
*/
|
|
146
|
+
rules?: Record<string, RuleSeverity>;
|
|
147
|
+
/**
|
|
148
|
+
* Category-level severity overrides
|
|
149
|
+
*/
|
|
150
|
+
categories?: Partial<Record<RuleCategory, RuleSeverity>>;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Type checker configuration
|
|
154
|
+
*/
|
|
155
|
+
interface TypeCheckerConfig {
|
|
156
|
+
/**
|
|
157
|
+
* Enable type checking
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
enabled?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Enable strict mode
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
strict?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Check component props
|
|
168
|
+
* @default true
|
|
169
|
+
*/
|
|
170
|
+
checkProps?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Check component emits
|
|
173
|
+
* @default true
|
|
174
|
+
*/
|
|
175
|
+
checkEmits?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Check template bindings
|
|
178
|
+
* @default true
|
|
179
|
+
*/
|
|
180
|
+
checkTemplateBindings?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Path to tsconfig.json
|
|
183
|
+
* @default auto-detected
|
|
184
|
+
*/
|
|
185
|
+
tsconfig?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Path to tsgo binary
|
|
188
|
+
*/
|
|
189
|
+
tsgoPath?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Formatter configuration
|
|
193
|
+
*/
|
|
194
|
+
interface FormatterConfig {
|
|
195
|
+
/**
|
|
196
|
+
* Max line width
|
|
197
|
+
* @default 80
|
|
198
|
+
*/
|
|
199
|
+
printWidth?: number;
|
|
200
|
+
/**
|
|
201
|
+
* Indentation width
|
|
202
|
+
* @default 2
|
|
203
|
+
*/
|
|
204
|
+
tabWidth?: number;
|
|
205
|
+
/**
|
|
206
|
+
* Use tabs for indentation
|
|
207
|
+
* @default false
|
|
208
|
+
*/
|
|
209
|
+
useTabs?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Print semicolons
|
|
212
|
+
* @default true
|
|
213
|
+
*/
|
|
214
|
+
semi?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Use single quotes
|
|
217
|
+
* @default false
|
|
218
|
+
*/
|
|
219
|
+
singleQuote?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Trailing commas
|
|
222
|
+
* @default 'all'
|
|
223
|
+
*/
|
|
224
|
+
trailingComma?: "all" | "none" | "es5";
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* LSP configuration
|
|
228
|
+
*/
|
|
229
|
+
interface LspConfig {
|
|
230
|
+
/**
|
|
231
|
+
* Enable LSP
|
|
232
|
+
* @default true
|
|
233
|
+
*/
|
|
234
|
+
enabled?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Enable diagnostics
|
|
237
|
+
* @default true
|
|
238
|
+
*/
|
|
239
|
+
diagnostics?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Enable completions
|
|
242
|
+
* @default true
|
|
243
|
+
*/
|
|
244
|
+
completion?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Enable hover information
|
|
247
|
+
* @default true
|
|
248
|
+
*/
|
|
249
|
+
hover?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Enable go-to-definition
|
|
252
|
+
* @default true
|
|
253
|
+
*/
|
|
254
|
+
definition?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Enable formatting via LSP
|
|
257
|
+
* @default true
|
|
258
|
+
*/
|
|
259
|
+
formatting?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Enable code actions
|
|
262
|
+
* @default true
|
|
263
|
+
*/
|
|
264
|
+
codeActions?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Use tsgo for type checking in LSP
|
|
267
|
+
* @default false
|
|
268
|
+
*/
|
|
269
|
+
tsgo?: boolean;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* VRT (Visual Regression Testing) configuration for Musea
|
|
273
|
+
*/
|
|
274
|
+
interface MuseaVrtConfig {
|
|
275
|
+
/**
|
|
276
|
+
* Threshold for pixel comparison (0-1)
|
|
277
|
+
* @default 0.1
|
|
278
|
+
*/
|
|
279
|
+
threshold?: number;
|
|
280
|
+
/**
|
|
281
|
+
* Output directory for screenshots
|
|
282
|
+
* @default '__musea_snapshots__'
|
|
283
|
+
*/
|
|
284
|
+
outDir?: string;
|
|
285
|
+
/**
|
|
286
|
+
* Viewport sizes
|
|
287
|
+
*/
|
|
288
|
+
viewports?: Array<{
|
|
289
|
+
width: number;
|
|
290
|
+
height: number;
|
|
291
|
+
name?: string;
|
|
292
|
+
}>;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* A11y configuration for Musea
|
|
296
|
+
*/
|
|
297
|
+
interface MuseaA11yConfig {
|
|
298
|
+
/**
|
|
299
|
+
* Enable a11y checking
|
|
300
|
+
* @default false
|
|
301
|
+
*/
|
|
302
|
+
enabled?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Axe-core rules to enable/disable
|
|
305
|
+
*/
|
|
306
|
+
rules?: Record<string, boolean>;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Autogen configuration for Musea
|
|
310
|
+
*/
|
|
311
|
+
interface MuseaAutogenConfig {
|
|
312
|
+
/**
|
|
313
|
+
* Enable auto-generation of variants
|
|
314
|
+
* @default false
|
|
315
|
+
*/
|
|
316
|
+
enabled?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Max variants to generate per component
|
|
319
|
+
* @default 10
|
|
320
|
+
*/
|
|
321
|
+
maxVariants?: number;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Musea component gallery configuration
|
|
325
|
+
*/
|
|
326
|
+
interface MuseaConfig {
|
|
327
|
+
/**
|
|
328
|
+
* Glob patterns for art files
|
|
329
|
+
* @default ['**\/*.art.vue']
|
|
330
|
+
*/
|
|
331
|
+
include?: string[];
|
|
332
|
+
/**
|
|
333
|
+
* Glob patterns to exclude
|
|
334
|
+
* @default ['node_modules/**', 'dist/**']
|
|
335
|
+
*/
|
|
336
|
+
exclude?: string[];
|
|
337
|
+
/**
|
|
338
|
+
* Base path for gallery
|
|
339
|
+
* @default '/__musea__'
|
|
340
|
+
*/
|
|
341
|
+
basePath?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Enable Storybook compatibility
|
|
344
|
+
* @default false
|
|
345
|
+
*/
|
|
346
|
+
storybookCompat?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Enable inline art detection in .vue files
|
|
349
|
+
* @default false
|
|
350
|
+
*/
|
|
351
|
+
inlineArt?: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* VRT configuration
|
|
354
|
+
*/
|
|
355
|
+
vrt?: MuseaVrtConfig;
|
|
356
|
+
/**
|
|
357
|
+
* A11y configuration
|
|
358
|
+
*/
|
|
359
|
+
a11y?: MuseaA11yConfig;
|
|
360
|
+
/**
|
|
361
|
+
* Autogen configuration
|
|
362
|
+
*/
|
|
363
|
+
autogen?: MuseaAutogenConfig;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Global type declaration
|
|
367
|
+
*/
|
|
368
|
+
interface GlobalTypeDeclaration {
|
|
369
|
+
/**
|
|
370
|
+
* TypeScript type string
|
|
371
|
+
*/
|
|
372
|
+
type: string;
|
|
373
|
+
/**
|
|
374
|
+
* Default value
|
|
375
|
+
*/
|
|
376
|
+
defaultValue?: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Global types configuration
|
|
380
|
+
*/
|
|
381
|
+
type GlobalTypesConfig = Record<string, GlobalTypeDeclaration | string>;
|
|
382
|
+
/**
|
|
383
|
+
* Options for loading vize.config file
|
|
384
|
+
*/
|
|
385
|
+
interface LoadConfigOptions {
|
|
386
|
+
/**
|
|
387
|
+
* Config file search mode
|
|
388
|
+
* - 'root': Search only in the specified root directory
|
|
389
|
+
* - 'auto': Search from cwd upward until finding a config file
|
|
390
|
+
* - 'none': Don't load config file
|
|
391
|
+
* @default 'root'
|
|
392
|
+
*/
|
|
393
|
+
mode?: "root" | "auto" | "none";
|
|
394
|
+
/**
|
|
395
|
+
* Custom config file path (overrides automatic search)
|
|
396
|
+
*/
|
|
397
|
+
configFile?: string;
|
|
398
|
+
/**
|
|
399
|
+
* Config environment for dynamic config resolution
|
|
400
|
+
*/
|
|
401
|
+
env?: ConfigEnv;
|
|
402
|
+
} //#endregion
|
|
403
|
+
//#region src/types.d.ts
|
|
404
|
+
interface VizeOptions {
|
|
405
|
+
/**
|
|
406
|
+
* Files to include in compilation
|
|
407
|
+
* @default /\.vue$/
|
|
408
|
+
*/
|
|
409
|
+
include?: string | RegExp | (string | RegExp)[];
|
|
410
|
+
/**
|
|
411
|
+
* Files to exclude from compilation
|
|
412
|
+
* @default /node_modules/
|
|
413
|
+
*/
|
|
414
|
+
exclude?: string | RegExp | (string | RegExp)[];
|
|
415
|
+
/**
|
|
416
|
+
* Force production mode
|
|
417
|
+
* @default auto-detected from Vite config
|
|
418
|
+
*/
|
|
419
|
+
isProduction?: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* Enable SSR mode
|
|
422
|
+
* @default false
|
|
423
|
+
*/
|
|
424
|
+
ssr?: boolean;
|
|
425
|
+
/**
|
|
426
|
+
* Enable source map generation
|
|
427
|
+
* @default true in development, false in production
|
|
428
|
+
*/
|
|
429
|
+
sourceMap?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Enable Vapor mode compilation
|
|
432
|
+
* @default false
|
|
433
|
+
*/
|
|
434
|
+
vapor?: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Root directory to scan for .vue files
|
|
437
|
+
* @default Vite's root
|
|
438
|
+
*/
|
|
439
|
+
root?: string;
|
|
440
|
+
/**
|
|
441
|
+
* Glob patterns to scan for .vue files during pre-compilation
|
|
442
|
+
* @default ['**\/*.vue']
|
|
443
|
+
*/
|
|
444
|
+
scanPatterns?: string[];
|
|
445
|
+
/**
|
|
446
|
+
* Glob patterns to ignore during pre-compilation
|
|
447
|
+
* @default ['node_modules/**', 'dist/**', '.git/**']
|
|
448
|
+
*/
|
|
449
|
+
ignorePatterns?: string[];
|
|
450
|
+
/**
|
|
451
|
+
* Config file search mode
|
|
452
|
+
* - 'root': Search only in the project root directory
|
|
453
|
+
* - 'auto': Search from cwd upward until finding a config file
|
|
454
|
+
* - false: Disable config file loading
|
|
455
|
+
* @default 'root'
|
|
456
|
+
*/
|
|
457
|
+
configMode?: "root" | "auto" | false;
|
|
458
|
+
/**
|
|
459
|
+
* Custom config file path (overrides automatic search)
|
|
460
|
+
*/
|
|
461
|
+
configFile?: string;
|
|
462
|
+
/**
|
|
463
|
+
* Enable debug logging
|
|
464
|
+
* @default false
|
|
465
|
+
*/
|
|
466
|
+
debug?: boolean;
|
|
467
|
+
}
|
|
468
|
+
interface CompiledModule {
|
|
469
|
+
code: string;
|
|
470
|
+
css?: string;
|
|
471
|
+
scopeId: string;
|
|
472
|
+
hasScoped: boolean;
|
|
473
|
+
templateHash?: string;
|
|
474
|
+
styleHash?: string;
|
|
475
|
+
scriptHash?: string;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/index.d.ts
|
|
480
|
+
/**
|
|
481
|
+
* Define a Vize configuration with type checking.
|
|
482
|
+
* Accepts a plain object or a function that receives ConfigEnv.
|
|
483
|
+
*/
|
|
484
|
+
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
485
|
+
/**
|
|
486
|
+
* Load Vize configuration from file
|
|
487
|
+
*/
|
|
488
|
+
declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<VizeConfig | null>;
|
|
489
|
+
/**
|
|
490
|
+
* Shared config store for inter-plugin communication.
|
|
491
|
+
* Key = project root, Value = resolved VizeConfig.
|
|
492
|
+
* Used by musea() and other plugins to access the unified config.
|
|
493
|
+
*/
|
|
494
|
+
declare const vizeConfigStore: Map<string, VizeConfig>;
|
|
495
|
+
declare function vize(options?: VizeOptions): Plugin;
|
|
496
|
+
|
|
497
|
+
//#endregion
|
|
498
|
+
export { CompiledModule, LoadConfigOptions, VizeConfig, VizeOptions, vize as default, defineConfig, loadConfig, vize, vizeConfigStore };
|