@vizejs/vite-plugin 0.443.0 → 0.457.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/config-CniehWXB.mjs +259 -0
- package/dist/index.d.mts +7 -3
- package/dist/index.mjs +4 -3
- package/dist/internal/config-bridge.d.mts +1 -1
- package/dist/internal/vite-plus-task.mjs +1 -1
- package/dist/{plugin-BtoQBp_k.mjs → plugin-CHZJDKpS.mjs} +96 -130
- package/dist/plugin-VmflBZfL.mjs +2 -0
- package/dist/{runner-BewZHurL.mjs → runner-Eg2DQhNT.mjs} +1 -1
- package/dist/shared-config-BGZnoNvi.mjs +177 -0
- package/dist/{types-FAVNKGwf.d.mts → types-Di46SPcH.d.mts} +24 -4
- package/dist/vite-plus.d.mts +6 -2
- package/dist/vite-plus.mjs +66 -17
- package/package.json +4 -4
- package/dist/config-PP6EAmWc.mjs +0 -39
- package/dist/plugin-vVIKbM_1.mjs +0 -2
- package/dist/shared-config-dMxrrTkb.mjs +0 -69
package/dist/vite-plus.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as CompilerConfig, b as TypeCheckerConfig, g as VueOptionsEntry, h as VueOptions, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as FormatterConfig, y as LinterConfig } from "./types-Di46SPcH.mjs";
|
|
2
2
|
import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
|
|
3
3
|
|
|
4
4
|
//#region src/vite-plus/types.d.ts
|
|
@@ -43,6 +43,8 @@ type VizeSharedConfig = UserConfig$1 & {
|
|
|
43
43
|
/** Alias of lint.vize; lint.vize takes precedence when both are provided. */lint?: VizeLintOptions | boolean;
|
|
44
44
|
};
|
|
45
45
|
interface VueIntegrationConfig {
|
|
46
|
+
/** Shared native Vue policy. */
|
|
47
|
+
vue?: VueOptions;
|
|
46
48
|
extends?: VueConfig | VueConfig[];
|
|
47
49
|
compiler?: VizeCompilerOptions | false;
|
|
48
50
|
typecheck?: TypeCheckerConfig | boolean;
|
|
@@ -76,5 +78,7 @@ type VizePlusConfigFactory = (env: ConfigEnv) => Promise<UserConfig>;
|
|
|
76
78
|
//#region src/vite-plus.d.ts
|
|
77
79
|
/** Extend the installed Vite+ configuration with the native Vue toolchain. */
|
|
78
80
|
declare function defineConfig(config?: VueConfig, integration?: VizePlusOptions): VizePlusConfigFactory;
|
|
81
|
+
/** Add Vue settings to an existing Vite+ export without another Vite+ injection. */
|
|
82
|
+
declare function withVue(vue: VueOptions, vpConfig?: VitePlusConfig, integration?: VizePlusOptions): VizePlusConfigFactory;
|
|
79
83
|
//#endregion
|
|
80
|
-
export { type VitePlusConfig, type VizeCompilerOptions, type VizeLintOptions, type VizePackOptions, type VizePlusConfigFactory, type VizePlusOptions, type VizeTask, type VueConfig, type VueConfigObject, defineConfig, defineConfig as withVize,
|
|
84
|
+
export { type VitePlusConfig, type VizeCompilerOptions, type VizeLintOptions, type VizePackOptions, type VizePlusConfigFactory, type VizePlusOptions, type VizeTask, type VueConfig, type VueConfigObject, type VueOptions, type VueOptionsEntry, defineConfig, defineConfig as withVize, withVue };
|
package/dist/vite-plus.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
3
|
-
import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-
|
|
1
|
+
import { i as isLegacyVueCompatibilityMode, t as mergeSharedConfig } from "./shared-config-BGZnoNvi.mjs";
|
|
2
|
+
import { c as projectViteConfigSource, i as resolveConfigExport, l as vueConfigOptions, r as loadConfig, s as mergeVueConfigOptions } from "./config-CniehWXB.mjs";
|
|
3
|
+
import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-Eg2DQhNT.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
@@ -132,14 +132,24 @@ async function resolveConfig(config, env, parents = /* @__PURE__ */ new Set()) {
|
|
|
132
132
|
if (!bases) return own;
|
|
133
133
|
let result = {};
|
|
134
134
|
const { mergeConfig } = resolveVitePlus().require("vite-plus");
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
const compose = (base, selected) => {
|
|
136
|
+
const merged = mergeConfig(base, selected);
|
|
137
|
+
const vue = mergeVueConfigOptions(base.vue, selected.vue);
|
|
138
|
+
return vue === void 0 ? merged : {
|
|
139
|
+
...merged,
|
|
140
|
+
vue
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
for (const base of Array.isArray(bases) ? bases : bases ? [bases] : []) result = compose(result, await resolveConfig(base, env, parents));
|
|
144
|
+
return compose(result, own);
|
|
137
145
|
} finally {
|
|
138
146
|
parents.delete(config);
|
|
139
147
|
}
|
|
140
148
|
}
|
|
141
149
|
function normalizeConfig(source, integration) {
|
|
142
|
-
const { compiler: compilerOption, typecheck, vize, lint, fmt, extends: _bases, ...rest } = source;
|
|
150
|
+
const { compiler: compilerOption, typecheck, vize, lint, fmt, vue: _vue, extends: _bases, ...rest } = source;
|
|
151
|
+
const vue = vueConfigOptions(source);
|
|
152
|
+
const configDirectory = process.cwd();
|
|
143
153
|
const { vize: nativeLint, ...oxlint } = lint ?? {};
|
|
144
154
|
const { vize: nativeFmt, ...oxfmt } = fmt ?? {};
|
|
145
155
|
const formatter = {
|
|
@@ -155,28 +165,33 @@ function normalizeConfig(source, integration) {
|
|
|
155
165
|
...nativeLint.rules
|
|
156
166
|
}
|
|
157
167
|
} : nativeLint === void 0 ? alias : nativeLint;
|
|
158
|
-
const compiler = compilerOption ?? integration.plugin ?? {};
|
|
168
|
+
const compiler = vueCompiler(compilerOption ?? integration.plugin ?? {}, vue);
|
|
159
169
|
const options = {
|
|
160
170
|
...integration,
|
|
161
|
-
check: typecheck === false ? false : typeof typecheck === "object" ? typecheck.enabled !== false : typecheck ?? integration.check,
|
|
162
|
-
lint: lintConfig === void 0 ? integration.lint : lintConfig !== false,
|
|
163
|
-
fmt: nativeFmt === void 0 ? integration.fmt : nativeFmt !== false
|
|
171
|
+
check: vue?.typeChecker?.enabled !== void 0 ? vue.typeChecker.enabled : typecheck === false ? false : typeof typecheck === "object" ? typecheck.enabled !== false : typecheck ?? integration.check,
|
|
172
|
+
lint: vue?.linter?.enabled !== void 0 ? vue.linter.enabled : lintConfig === void 0 ? integration.lint : lintConfig !== false,
|
|
173
|
+
fmt: vue?.formatter !== void 0 ? true : nativeFmt === void 0 ? integration.fmt : nativeFmt !== false
|
|
164
174
|
};
|
|
165
|
-
const
|
|
175
|
+
const legacyConfig = async (env) => {
|
|
166
176
|
let base = vize;
|
|
167
177
|
if (vize && typeof vize === "object" && !Array.isArray(vize)) {
|
|
168
178
|
const { lint: _alias, ...shared } = vize;
|
|
169
179
|
base = shared;
|
|
170
180
|
}
|
|
171
|
-
|
|
181
|
+
const inherited = base === void 0 ? await loadConfig(process.cwd(), {
|
|
182
|
+
env,
|
|
183
|
+
viteConfig: false
|
|
184
|
+
}) : await resolveConfigExport(base, env);
|
|
185
|
+
const overrides = await resolveConfigExport({
|
|
172
186
|
...compiler === false ? {} : { compiler: nativeCompiler(compiler) },
|
|
173
187
|
...typeof typecheck === "object" ? { typeChecker: typecheck } : {},
|
|
174
188
|
...typeof lintConfig === "object" ? { linter: withoutTaskLintOptions(lintConfig) } : {},
|
|
175
189
|
...Object.keys(formatter).length ? { formatter } : {}
|
|
176
|
-
}, env)
|
|
190
|
+
}, env);
|
|
191
|
+
return mergeSharedConfig(mergeSharedConfig(env.command === "check" && (base !== void 0 || inherited === null) ? await resolveConfigExport({ typeChecker: { jsxTypecheck: true } }, env) : null, inherited), overrides) ?? {};
|
|
177
192
|
};
|
|
178
193
|
const metadata = {
|
|
179
|
-
config,
|
|
194
|
+
config: vue === void 0 ? legacyConfig : async (env) => await projectViteConfigSource(source, env, configDirectory),
|
|
180
195
|
options,
|
|
181
196
|
lintTypecheck: typeof lintConfig === "object" && lintConfig.typecheck === true,
|
|
182
197
|
lintLocale: typeof lintConfig === "object" ? lintConfig.locale : void 0,
|
|
@@ -202,6 +217,7 @@ function nativeCompiler(options) {
|
|
|
202
217
|
const { compatibility, ...compiler } = options;
|
|
203
218
|
const version = options.vueVersion ?? compatibility?.vueVersion;
|
|
204
219
|
const versions = {
|
|
220
|
+
.1: "0.10",
|
|
205
221
|
.11: "0.11",
|
|
206
222
|
1: "1",
|
|
207
223
|
2: "2",
|
|
@@ -217,6 +233,32 @@ function nativeCompiler(options) {
|
|
|
217
233
|
}
|
|
218
234
|
};
|
|
219
235
|
}
|
|
236
|
+
/** Keep plugin-only fields while native canonical leaves choose their own values. */
|
|
237
|
+
function vueCompiler(legacy, vue) {
|
|
238
|
+
if (vue?.compiler === void 0 && vue?.version === void 0) return legacy;
|
|
239
|
+
if (legacy === false && vue.compiler === void 0) return false;
|
|
240
|
+
const { compatibility, ...native } = vue.compiler ?? {};
|
|
241
|
+
const version = vue.version ?? compatibility?.vueVersion;
|
|
242
|
+
const versions = {
|
|
243
|
+
"0.10": .1,
|
|
244
|
+
"0.11": .11,
|
|
245
|
+
"1": 1,
|
|
246
|
+
"2": 2,
|
|
247
|
+
"2.7": "2.7",
|
|
248
|
+
"3": 3
|
|
249
|
+
};
|
|
250
|
+
const previous = legacy === false ? {} : legacy;
|
|
251
|
+
return {
|
|
252
|
+
...previous,
|
|
253
|
+
...native,
|
|
254
|
+
compatibility: {
|
|
255
|
+
...previous.compatibility,
|
|
256
|
+
...compatibility,
|
|
257
|
+
...version === void 0 ? {} : { vueVersion: versions[version] }
|
|
258
|
+
},
|
|
259
|
+
...version === void 0 ? {} : { vueVersion: versions[version] }
|
|
260
|
+
};
|
|
261
|
+
}
|
|
220
262
|
//#endregion
|
|
221
263
|
//#region src/vite-plus/declarations.ts
|
|
222
264
|
/** Keep authored tsconfigs untouched, including maps and project references. */
|
|
@@ -324,9 +366,9 @@ function defineConfig(config = {}, integration = {}) {
|
|
|
324
366
|
const source = await resolveConfig(config, env);
|
|
325
367
|
const { vp, metadata, compiler } = normalizeConfig(source, integration);
|
|
326
368
|
const { options } = metadata;
|
|
327
|
-
const plugins = compiler === false ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
|
|
369
|
+
const plugins = compiler === false || isLegacyVueCompatibilityMode(compiler) ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
|
|
328
370
|
if (compiler !== false) {
|
|
329
|
-
const { vize } = await import("./plugin-
|
|
371
|
+
const { vize } = await import("./plugin-VmflBZfL.mjs");
|
|
330
372
|
plugins.push(vize({
|
|
331
373
|
...compiler,
|
|
332
374
|
configMode: false,
|
|
@@ -357,5 +399,12 @@ async function withoutVueCompiler(plugins) {
|
|
|
357
399
|
}
|
|
358
400
|
return result;
|
|
359
401
|
}
|
|
402
|
+
/** Add Vue settings to an existing Vite+ export without another Vite+ injection. */
|
|
403
|
+
function withVue(vue, vpConfig = {}, integration = {}) {
|
|
404
|
+
return defineConfig({
|
|
405
|
+
extends: vpConfig,
|
|
406
|
+
vue
|
|
407
|
+
}, integration);
|
|
408
|
+
}
|
|
360
409
|
//#endregion
|
|
361
|
-
export { defineConfig, defineConfig as withVize,
|
|
410
|
+
export { defineConfig, defineConfig as withVize, withVue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.457.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vizejs/native": "0.
|
|
55
|
-
"@vizejs/unplugin": "0.
|
|
54
|
+
"@vizejs/native": "0.457.0",
|
|
55
|
+
"@vizejs/unplugin": "0.457.0",
|
|
56
56
|
"jsonc-parser": "^3.3.1",
|
|
57
57
|
"oxc-parser": "0.144.0",
|
|
58
58
|
"picomatch": "4.0.5",
|
|
59
59
|
"tinyglobby": "0.2.17",
|
|
60
|
-
"vize": "0.
|
|
60
|
+
"vize": "0.457.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "25.9.2",
|
package/dist/config-PP6EAmWc.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
//#region src/config.ts
|
|
3
|
-
const require = createRequire(import.meta.url);
|
|
4
|
-
const CONFIG_FILE_NAMES = [
|
|
5
|
-
"vize.config.pkl",
|
|
6
|
-
"vize.config.ts",
|
|
7
|
-
"vize.config.js",
|
|
8
|
-
"vize.config.mjs",
|
|
9
|
-
"vize.config.json"
|
|
10
|
-
];
|
|
11
|
-
let vizeConfigModulePromise = null;
|
|
12
|
-
function loadVizeConfigModule() {
|
|
13
|
-
vizeConfigModulePromise ??= import("vize/config");
|
|
14
|
-
return vizeConfigModulePromise;
|
|
15
|
-
}
|
|
16
|
-
function defineConfig(config) {
|
|
17
|
-
return config;
|
|
18
|
-
}
|
|
19
|
-
async function loadConfig(root, options) {
|
|
20
|
-
return (await loadVizeConfigModule()).loadConfig(root, options);
|
|
21
|
-
}
|
|
22
|
-
async function resolveConfigExport(exported, env) {
|
|
23
|
-
return (await loadVizeConfigModule()).resolveConfigExport(exported, env);
|
|
24
|
-
}
|
|
25
|
-
require.resolve("vize/schemas/vize.config.schema.json");
|
|
26
|
-
require.resolve("vize/pkl/vize.pkl");
|
|
27
|
-
[...CONFIG_FILE_NAMES];
|
|
28
|
-
const VIZE_CONFIG_FILE_ENV = "VIZE_CONFIG_FILE";
|
|
29
|
-
/**
|
|
30
|
-
* Shared config store for inter-plugin communication.
|
|
31
|
-
* Key = project root, Value = resolved VizeConfig.
|
|
32
|
-
*
|
|
33
|
-
* @deprecated Root identity cannot isolate parallel Vite client/SSR instances
|
|
34
|
-
* or servers. This export remains temporarily for compatibility; internal Vize
|
|
35
|
-
* integrations use an exact `ResolvedConfig`-scoped bridge instead.
|
|
36
|
-
*/
|
|
37
|
-
const vizeConfigStore = /* @__PURE__ */ new Map();
|
|
38
|
-
//#endregion
|
|
39
|
-
export { vizeConfigStore as a, resolveConfigExport as i, defineConfig as n, loadConfig as r, VIZE_CONFIG_FILE_ENV as t };
|
package/dist/plugin-vVIKbM_1.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { i as resolveConfigExport, r as loadConfig } from "./config-PP6EAmWc.mjs";
|
|
2
|
-
//#region src/plugin/shared-config.ts
|
|
3
|
-
function mergeSharedConfig(baseConfig, overrideConfig) {
|
|
4
|
-
if (!baseConfig) return overrideConfig;
|
|
5
|
-
if (!overrideConfig) return baseConfig;
|
|
6
|
-
return {
|
|
7
|
-
...baseConfig,
|
|
8
|
-
...overrideConfig,
|
|
9
|
-
compiler: {
|
|
10
|
-
...baseConfig.compiler,
|
|
11
|
-
...overrideConfig.compiler
|
|
12
|
-
},
|
|
13
|
-
vite: {
|
|
14
|
-
...baseConfig.vite,
|
|
15
|
-
...overrideConfig.vite
|
|
16
|
-
},
|
|
17
|
-
linter: {
|
|
18
|
-
...baseConfig.linter,
|
|
19
|
-
...overrideConfig.linter
|
|
20
|
-
},
|
|
21
|
-
typeChecker: {
|
|
22
|
-
...baseConfig.typeChecker,
|
|
23
|
-
...overrideConfig.typeChecker
|
|
24
|
-
},
|
|
25
|
-
formatter: {
|
|
26
|
-
...baseConfig.formatter,
|
|
27
|
-
...overrideConfig.formatter
|
|
28
|
-
},
|
|
29
|
-
languageServer: {
|
|
30
|
-
...baseConfig.languageServer,
|
|
31
|
-
...overrideConfig.languageServer
|
|
32
|
-
},
|
|
33
|
-
musea: {
|
|
34
|
-
...baseConfig.musea,
|
|
35
|
-
...overrideConfig.musea
|
|
36
|
-
},
|
|
37
|
-
globalTypes: {
|
|
38
|
-
...baseConfig.globalTypes,
|
|
39
|
-
...overrideConfig.globalTypes
|
|
40
|
-
},
|
|
41
|
-
entries: [...baseConfig.entries, ...overrideConfig.entries]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
async function resolveSharedConfig(options, root, env, logger) {
|
|
45
|
-
let fileConfig = null;
|
|
46
|
-
if (options.configMode !== false) {
|
|
47
|
-
const configFile = options.configFile ?? process.env["VIZE_CONFIG_FILE"];
|
|
48
|
-
try {
|
|
49
|
-
fileConfig = await loadConfig(root, {
|
|
50
|
-
mode: options.configMode ?? "root",
|
|
51
|
-
configFile,
|
|
52
|
-
env
|
|
53
|
-
});
|
|
54
|
-
if (fileConfig) logger.log("Loaded config from vize.config file");
|
|
55
|
-
} catch (error) {
|
|
56
|
-
logger.warn(`Failed to load vize config from ${configFile ?? root}:`, error);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
let inlineConfig = null;
|
|
60
|
-
if (options.config) try {
|
|
61
|
-
inlineConfig = await resolveConfigExport(options.config, env);
|
|
62
|
-
logger.log("Loaded inline vize config from plugin options");
|
|
63
|
-
} catch (error) {
|
|
64
|
-
logger.warn("Failed to resolve inline vize config:", error);
|
|
65
|
-
}
|
|
66
|
-
return mergeSharedConfig(fileConfig, inlineConfig);
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
export { resolveSharedConfig as n, mergeSharedConfig as t };
|