@vizejs/vite-plugin 0.123.0 → 0.125.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 +83 -3
- package/dist/index.mjs +55 -8
- 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
|
|
@@ -473,13 +497,64 @@ interface GlobalTypeDeclaration {
|
|
|
473
497
|
*/
|
|
474
498
|
defaultValue?: string;
|
|
475
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
|
+
}
|
|
476
534
|
//#endregion
|
|
477
535
|
//#region ../vize/src/types/runtime.d.ts
|
|
536
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
478
537
|
interface ConfigEnv {
|
|
479
538
|
mode: string;
|
|
480
539
|
command: "serve" | "build" | "check" | "lint" | "fmt";
|
|
481
540
|
isSsrBuild?: boolean;
|
|
482
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>);
|
|
483
558
|
interface LoadConfigOptions {
|
|
484
559
|
/**
|
|
485
560
|
* Config file search mode
|
|
@@ -510,6 +585,11 @@ interface MacroArtifact {
|
|
|
510
585
|
end: number;
|
|
511
586
|
}
|
|
512
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;
|
|
513
593
|
/**
|
|
514
594
|
* Override the public base used for dev-time asset URLs such as /@fs paths.
|
|
515
595
|
* Useful for frameworks like Nuxt that serve Vite from a subpath (e.g. /_nuxt/).
|
|
@@ -655,11 +735,11 @@ declare function vize(options?: VizeOptions): Plugin[];
|
|
|
655
735
|
* Key = project root, Value = resolved VizeConfig.
|
|
656
736
|
* Used by musea() and other plugins to access the unified config.
|
|
657
737
|
*/
|
|
658
|
-
declare const vizeConfigStore: Map<string,
|
|
738
|
+
declare const vizeConfigStore: Map<string, ResolvedVizeConfig>;
|
|
659
739
|
//#endregion
|
|
660
740
|
//#region src/index.d.ts
|
|
661
741
|
declare const __internal: {
|
|
662
742
|
rewriteStaticAssetUrls: typeof rewriteStaticAssetUrls;
|
|
663
743
|
};
|
|
664
744
|
//#endregion
|
|
665
|
-
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";
|
|
@@ -1248,6 +1248,47 @@ function installVirtualAssetMiddleware(devServer, state) {
|
|
|
1248
1248
|
function aliasSortKey(find) {
|
|
1249
1249
|
return typeof find === "string" ? find.length : find.source.length;
|
|
1250
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
|
+
}
|
|
1251
1292
|
function vize(options = {}) {
|
|
1252
1293
|
const state = {
|
|
1253
1294
|
cache: /* @__PURE__ */ new Map(),
|
|
@@ -1319,15 +1360,21 @@ function vize(options = {}) {
|
|
|
1319
1360
|
configFile: options.configFile,
|
|
1320
1361
|
env: configEnv
|
|
1321
1362
|
});
|
|
1322
|
-
if (fileConfig)
|
|
1323
|
-
state.logger.log("Loaded config from vize.config file");
|
|
1324
|
-
vizeConfigStore.set(state.root, fileConfig);
|
|
1325
|
-
}
|
|
1363
|
+
if (fileConfig) state.logger.log("Loaded config from vize.config file");
|
|
1326
1364
|
} catch (error) {
|
|
1327
1365
|
state.logger.warn(`Failed to load vize config from ${options.configFile ?? state.root}:`, error);
|
|
1328
1366
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
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 ?? {};
|
|
1331
1378
|
state.mergedOptions = {
|
|
1332
1379
|
...options,
|
|
1333
1380
|
ssr: options.ssr ?? compilerConfig.ssr ?? false,
|
|
@@ -1406,4 +1453,4 @@ function vize(options = {}) {
|
|
|
1406
1453
|
const __internal = { rewriteStaticAssetUrls };
|
|
1407
1454
|
var src_default = vize;
|
|
1408
1455
|
//#endregion
|
|
1409
|
-
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.125.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.125.0",
|
|
41
41
|
"tinyglobby": "0.2.16",
|
|
42
|
-
"vize": "0.
|
|
42
|
+
"vize": "0.125.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "25.7.0",
|