@vizejs/vite-plugin 0.122.0 → 0.124.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 +92 -3
- package/dist/index.mjs +63 -11
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig, loadConfig } from "vize";
|
|
1
|
+
import { defineConfig, loadConfig, resolveConfigExport } from "vize";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region ../vize/src/types/generated.d.ts
|
|
@@ -6,6 +6,26 @@ import { Plugin } from "vite";
|
|
|
6
6
|
* Configuration file for vize - High-performance Vue.js toolchain
|
|
7
7
|
*/
|
|
8
8
|
interface VizeConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Human-readable entry name for inspect output and diagnostics
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Directory used as the base for scoped file patterns and relative paths
|
|
15
|
+
*/
|
|
16
|
+
basePath?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Glob patterns this config applies to
|
|
19
|
+
*/
|
|
20
|
+
files?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Glob patterns this config excludes
|
|
23
|
+
*/
|
|
24
|
+
ignores?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Base config files or presets to compose
|
|
27
|
+
*/
|
|
28
|
+
extends?: string | string[];
|
|
9
29
|
compiler?: CompilerConfig;
|
|
10
30
|
vite?: VitePluginConfig;
|
|
11
31
|
linter?: LinterConfig;
|
|
@@ -15,6 +35,10 @@ interface VizeConfig {
|
|
|
15
35
|
lsp?: LanguageServerConfig;
|
|
16
36
|
musea?: MuseaConfig;
|
|
17
37
|
globalTypes?: GlobalTypesConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Scoped config entries for monorepos and workspaces
|
|
40
|
+
*/
|
|
41
|
+
entries?: VizeConfigEntry[];
|
|
18
42
|
}
|
|
19
43
|
/**
|
|
20
44
|
* Vue compiler options
|
|
@@ -32,6 +56,10 @@ interface CompilerConfig {
|
|
|
32
56
|
* Enable SSR mode
|
|
33
57
|
*/
|
|
34
58
|
ssr?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Enable Vue parser quirk compatibility
|
|
61
|
+
*/
|
|
62
|
+
vueParserQuirks?: boolean;
|
|
35
63
|
/**
|
|
36
64
|
* Enable source map generation
|
|
37
65
|
*/
|
|
@@ -469,13 +497,64 @@ interface GlobalTypeDeclaration {
|
|
|
469
497
|
*/
|
|
470
498
|
defaultValue?: string;
|
|
471
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* Scoped Vize config entry for monorepos and workspaces
|
|
502
|
+
*/
|
|
503
|
+
interface VizeConfigEntry {
|
|
504
|
+
/**
|
|
505
|
+
* Human-readable entry name for inspect output and diagnostics
|
|
506
|
+
*/
|
|
507
|
+
name?: string;
|
|
508
|
+
/**
|
|
509
|
+
* Directory used as the base for scoped file patterns and relative paths
|
|
510
|
+
*/
|
|
511
|
+
basePath?: string;
|
|
512
|
+
/**
|
|
513
|
+
* Glob patterns this entry applies to
|
|
514
|
+
*/
|
|
515
|
+
files?: string[];
|
|
516
|
+
/**
|
|
517
|
+
* Glob patterns this entry excludes
|
|
518
|
+
*/
|
|
519
|
+
ignores?: string[];
|
|
520
|
+
/**
|
|
521
|
+
* Base config files or presets to compose
|
|
522
|
+
*/
|
|
523
|
+
extends?: string | string[];
|
|
524
|
+
compiler?: CompilerConfig;
|
|
525
|
+
vite?: VitePluginConfig;
|
|
526
|
+
linter?: LinterConfig;
|
|
527
|
+
typeChecker?: TypeCheckerConfig;
|
|
528
|
+
formatter?: FormatterConfig;
|
|
529
|
+
languageServer?: LanguageServerConfig;
|
|
530
|
+
lsp?: LanguageServerConfig;
|
|
531
|
+
musea?: MuseaConfig;
|
|
532
|
+
globalTypes?: GlobalTypesConfig;
|
|
533
|
+
}
|
|
472
534
|
//#endregion
|
|
473
535
|
//#region ../vize/src/types/runtime.d.ts
|
|
536
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
474
537
|
interface ConfigEnv {
|
|
475
538
|
mode: string;
|
|
476
539
|
command: "serve" | "build" | "check" | "lint" | "fmt";
|
|
477
540
|
isSsrBuild?: boolean;
|
|
478
541
|
}
|
|
542
|
+
type UserConfig = VizeConfig & {
|
|
543
|
+
/**
|
|
544
|
+
* Legacy alias for `languageServer`.
|
|
545
|
+
* Prefer `languageServer`.
|
|
546
|
+
*/
|
|
547
|
+
lsp?: LanguageServerConfig;
|
|
548
|
+
};
|
|
549
|
+
type UserConfigInput = UserConfig | VizeConfigEntry[];
|
|
550
|
+
type ResolvedVizeConfig = VizeConfig & {
|
|
551
|
+
/**
|
|
552
|
+
* Normalized flat entries. Plain object configs become one entry; array configs
|
|
553
|
+
* keep their order.
|
|
554
|
+
*/
|
|
555
|
+
entries: VizeConfigEntry[];
|
|
556
|
+
};
|
|
557
|
+
type UserConfigExport = UserConfigInput | ((env: ConfigEnv) => MaybePromise<UserConfigInput>);
|
|
479
558
|
interface LoadConfigOptions {
|
|
480
559
|
/**
|
|
481
560
|
* Config file search mode
|
|
@@ -506,6 +585,11 @@ interface MacroArtifact {
|
|
|
506
585
|
end: number;
|
|
507
586
|
}
|
|
508
587
|
interface VizeOptions {
|
|
588
|
+
/**
|
|
589
|
+
* Inline shared Vize config for Vite Plus-first projects.
|
|
590
|
+
* Direct plugin options still take precedence over these values.
|
|
591
|
+
*/
|
|
592
|
+
config?: UserConfigExport;
|
|
509
593
|
/**
|
|
510
594
|
* Override the public base used for dev-time asset URLs such as /@fs paths.
|
|
511
595
|
* Useful for frameworks like Nuxt that serve Vite from a subpath (e.g. /_nuxt/).
|
|
@@ -547,6 +631,11 @@ interface VizeOptions {
|
|
|
547
631
|
* @default false
|
|
548
632
|
*/
|
|
549
633
|
customRenderer?: boolean;
|
|
634
|
+
/**
|
|
635
|
+
* Enable compatibility for known Vue compiler parser quirks.
|
|
636
|
+
* @default false
|
|
637
|
+
*/
|
|
638
|
+
vueParserQuirks?: boolean;
|
|
550
639
|
/**
|
|
551
640
|
* Root directory to scan for .vue files
|
|
552
641
|
* @default Vite's root
|
|
@@ -646,11 +735,11 @@ declare function vize(options?: VizeOptions): Plugin[];
|
|
|
646
735
|
* Key = project root, Value = resolved VizeConfig.
|
|
647
736
|
* Used by musea() and other plugins to access the unified config.
|
|
648
737
|
*/
|
|
649
|
-
declare const vizeConfigStore: Map<string,
|
|
738
|
+
declare const vizeConfigStore: Map<string, ResolvedVizeConfig>;
|
|
650
739
|
//#endregion
|
|
651
740
|
//#region src/index.d.ts
|
|
652
741
|
declare const __internal: {
|
|
653
742
|
rewriteStaticAssetUrls: typeof rewriteStaticAssetUrls;
|
|
654
743
|
};
|
|
655
744
|
//#endregion
|
|
656
|
-
export { type CompiledModule, type LoadConfigOptions, type MacroArtifact, type VizeConfig, type VizeOptions, __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, vize as default, vize, defineConfig, loadConfig, vizeConfigStore };
|
|
745
|
+
export { type CompiledModule, type LoadConfigOptions, type MacroArtifact, type ResolvedVizeConfig, type UserConfigExport, type VizeConfig, type VizeOptions, __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, vize as default, vize, defineConfig, loadConfig, resolveConfigExport, vizeConfigStore };
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import * as native from "@vizejs/native";
|
|
4
4
|
import { applyViteDefineReplacements, chunkVitePrecompileFiles, classifyVitePluginRequest, createViteBareImportBases, createViteBareImportCandidates, createViteVirtualId, detectViteHmrUpdateType, diffVitePrecompileFiles, generateViteHmrCode, hasViteHmrChanges, isViteBareSpecifier, normalizeViteCssModuleFilename, normalizeViteDevMiddlewareUrl, normalizeVitePrecompileBatchSize, normalizeViteRequireBase, normalizeViteResolvedVuePath, resolveViteAliasRequest, resolveViteCssImports, resolveViteRelativeImport, resolveViteVuePath, rewriteViteDynamicTemplateImports, rewriteViteStaticAssetUrls, scopeViteCssForPipeline, shouldApplyViteDefineInVirtualModule, splitViteIdQuery, toViteBrowserImportPrefix, transformViteCssVarsForPipeline } from "@vizejs/native";
|
|
5
|
-
import { CONFIG_FILE_NAMES, defineConfig, loadConfig } from "vize";
|
|
5
|
+
import { CONFIG_FILE_NAMES, defineConfig, loadConfig, resolveConfigExport } from "vize";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import { glob } from "tinyglobby";
|
|
8
8
|
import path from "node:path";
|
|
@@ -256,6 +256,7 @@ function buildCompileFileOptions(filePath, options) {
|
|
|
256
256
|
ssr: options.ssr,
|
|
257
257
|
vapor: options.vapor,
|
|
258
258
|
customRenderer: options.customRenderer ?? false,
|
|
259
|
+
vueParserQuirks: options.vueParserQuirks ?? false,
|
|
259
260
|
scopeId: `data-v-${generateScopeId(filePath)}`
|
|
260
261
|
};
|
|
261
262
|
}
|
|
@@ -263,7 +264,8 @@ function buildCompileBatchOptions(options) {
|
|
|
263
264
|
return {
|
|
264
265
|
ssr: options.ssr,
|
|
265
266
|
vapor: options.vapor,
|
|
266
|
-
customRenderer: options.customRenderer ?? false
|
|
267
|
+
customRenderer: options.customRenderer ?? false,
|
|
268
|
+
vueParserQuirks: options.vueParserQuirks ?? false
|
|
267
269
|
};
|
|
268
270
|
}
|
|
269
271
|
//#endregion
|
|
@@ -381,7 +383,8 @@ function getCompileOptionsForRequest(state, ssr) {
|
|
|
381
383
|
sourceMap: state.mergedOptions?.sourceMap ?? !state.isProduction,
|
|
382
384
|
ssr,
|
|
383
385
|
vapor: !ssr && (state.mergedOptions?.vapor ?? false),
|
|
384
|
-
customRenderer: state.mergedOptions?.customRenderer ?? false
|
|
386
|
+
customRenderer: state.mergedOptions?.customRenderer ?? false,
|
|
387
|
+
vueParserQuirks: state.mergedOptions?.vueParserQuirks ?? false
|
|
385
388
|
};
|
|
386
389
|
}
|
|
387
390
|
function syncCollectedCssForFile(state, filePath, compiled) {
|
|
@@ -460,7 +463,8 @@ async function compileAll(state) {
|
|
|
460
463
|
const result = compileBatch(fileContents, state.cache, {
|
|
461
464
|
ssr: false,
|
|
462
465
|
vapor: state.mergedOptions.vapor ?? false,
|
|
463
|
-
customRenderer: state.mergedOptions.customRenderer ?? false
|
|
466
|
+
customRenderer: state.mergedOptions.customRenderer ?? false,
|
|
467
|
+
vueParserQuirks: state.mergedOptions.vueParserQuirks ?? false
|
|
464
468
|
});
|
|
465
469
|
const chunkFailedCount = result.results.filter((fileResult) => fileResult.errors.length > 0).length;
|
|
466
470
|
failedCount += chunkFailedCount;
|
|
@@ -1244,6 +1248,47 @@ function installVirtualAssetMiddleware(devServer, state) {
|
|
|
1244
1248
|
function aliasSortKey(find) {
|
|
1245
1249
|
return typeof find === "string" ? find.length : find.source.length;
|
|
1246
1250
|
}
|
|
1251
|
+
function mergeSharedConfig(baseConfig, overrideConfig) {
|
|
1252
|
+
if (!baseConfig) return overrideConfig;
|
|
1253
|
+
if (!overrideConfig) return baseConfig;
|
|
1254
|
+
return {
|
|
1255
|
+
...baseConfig,
|
|
1256
|
+
...overrideConfig,
|
|
1257
|
+
compiler: {
|
|
1258
|
+
...baseConfig.compiler,
|
|
1259
|
+
...overrideConfig.compiler
|
|
1260
|
+
},
|
|
1261
|
+
vite: {
|
|
1262
|
+
...baseConfig.vite,
|
|
1263
|
+
...overrideConfig.vite
|
|
1264
|
+
},
|
|
1265
|
+
linter: {
|
|
1266
|
+
...baseConfig.linter,
|
|
1267
|
+
...overrideConfig.linter
|
|
1268
|
+
},
|
|
1269
|
+
typeChecker: {
|
|
1270
|
+
...baseConfig.typeChecker,
|
|
1271
|
+
...overrideConfig.typeChecker
|
|
1272
|
+
},
|
|
1273
|
+
formatter: {
|
|
1274
|
+
...baseConfig.formatter,
|
|
1275
|
+
...overrideConfig.formatter
|
|
1276
|
+
},
|
|
1277
|
+
languageServer: {
|
|
1278
|
+
...baseConfig.languageServer,
|
|
1279
|
+
...overrideConfig.languageServer
|
|
1280
|
+
},
|
|
1281
|
+
musea: {
|
|
1282
|
+
...baseConfig.musea,
|
|
1283
|
+
...overrideConfig.musea
|
|
1284
|
+
},
|
|
1285
|
+
globalTypes: {
|
|
1286
|
+
...baseConfig.globalTypes,
|
|
1287
|
+
...overrideConfig.globalTypes
|
|
1288
|
+
},
|
|
1289
|
+
entries: [...baseConfig.entries, ...overrideConfig.entries]
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1247
1292
|
function vize(options = {}) {
|
|
1248
1293
|
const state = {
|
|
1249
1294
|
cache: /* @__PURE__ */ new Map(),
|
|
@@ -1315,21 +1360,28 @@ function vize(options = {}) {
|
|
|
1315
1360
|
configFile: options.configFile,
|
|
1316
1361
|
env: configEnv
|
|
1317
1362
|
});
|
|
1318
|
-
if (fileConfig)
|
|
1319
|
-
state.logger.log("Loaded config from vize.config file");
|
|
1320
|
-
vizeConfigStore.set(state.root, fileConfig);
|
|
1321
|
-
}
|
|
1363
|
+
if (fileConfig) state.logger.log("Loaded config from vize.config file");
|
|
1322
1364
|
} catch (error) {
|
|
1323
1365
|
state.logger.warn(`Failed to load vize config from ${options.configFile ?? state.root}:`, error);
|
|
1324
1366
|
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1367
|
+
let inlineConfig = null;
|
|
1368
|
+
if (options.config) try {
|
|
1369
|
+
inlineConfig = await resolveConfigExport(options.config, configEnv);
|
|
1370
|
+
state.logger.log("Loaded inline vize config from plugin options");
|
|
1371
|
+
} catch (error) {
|
|
1372
|
+
state.logger.warn("Failed to resolve inline vize config:", error);
|
|
1373
|
+
}
|
|
1374
|
+
const sharedConfig = mergeSharedConfig(fileConfig, inlineConfig);
|
|
1375
|
+
if (sharedConfig) vizeConfigStore.set(state.root, sharedConfig);
|
|
1376
|
+
const viteConfig = sharedConfig?.vite ?? {};
|
|
1377
|
+
const compilerConfig = sharedConfig?.compiler ?? {};
|
|
1327
1378
|
state.mergedOptions = {
|
|
1328
1379
|
...options,
|
|
1329
1380
|
ssr: options.ssr ?? compilerConfig.ssr ?? false,
|
|
1330
1381
|
sourceMap: options.sourceMap ?? compilerConfig.sourceMap,
|
|
1331
1382
|
vapor: options.vapor ?? compilerConfig.vapor ?? false,
|
|
1332
1383
|
customRenderer: options.customRenderer ?? compilerConfig.customRenderer ?? false,
|
|
1384
|
+
vueParserQuirks: options.vueParserQuirks ?? compilerConfig.vueParserQuirks ?? false,
|
|
1333
1385
|
include: options.include ?? viteConfig.include,
|
|
1334
1386
|
exclude: options.exclude ?? viteConfig.exclude,
|
|
1335
1387
|
scanPatterns: options.scanPatterns ?? viteConfig.scanPatterns,
|
|
@@ -1401,4 +1453,4 @@ function vize(options = {}) {
|
|
|
1401
1453
|
const __internal = { rewriteStaticAssetUrls };
|
|
1402
1454
|
var src_default = vize;
|
|
1403
1455
|
//#endregion
|
|
1404
|
-
export { __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, src_default as default, defineConfig, loadConfig, vize, vizeConfigStore };
|
|
1456
|
+
export { __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, src_default as default, defineConfig, loadConfig, resolveConfigExport, vize, vizeConfigStore };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.124.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@vizejs/native": "0.
|
|
40
|
+
"@vizejs/native": "0.124.0",
|
|
41
41
|
"tinyglobby": "0.2.16",
|
|
42
|
-
"vize": "0.
|
|
42
|
+
"vize": "0.124.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "25.7.0",
|