@vizejs/vite-plugin 0.426.2 → 0.427.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 +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internal/config-bridge.d.mts +1 -1
- package/dist/internal/vite-plus-task.mjs +1 -1
- package/dist/plugin-BZN9h1bb.mjs +2 -0
- package/dist/{plugin-BSxbzkGl.mjs → plugin-CkmrBDhz.mjs} +34 -21
- package/dist/{runner-DvShtC55.mjs → runner-8x__0QxE.mjs} +4 -1
- package/dist/{types-CtulgM97.d.mts → types-BSmJ5UMW.d.mts} +44 -0
- package/dist/vite-plus.d.mts +18 -3
- package/dist/vite-plus.mjs +10 -6
- package/package.json +6 -5
- package/dist/plugin-CewswkDY.mjs +0 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, y as VizeConfig } from "./types-
|
|
1
|
+
import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, y as VizeConfig } from "./types-BSmJ5UMW.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/virtual.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as rewriteStaticAssetUrls, t as vize } from "./plugin-
|
|
1
|
+
import { n as rewriteStaticAssetUrls, t as vize } from "./plugin-CkmrBDhz.mjs";
|
|
2
2
|
import { a as vizeConfigStore, i as resolveConfigExport, n as defineConfig, r as loadConfig, t as VIZE_CONFIG_FILE_ENV } from "./config-PP6EAmWc.mjs";
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
const __internal = { rewriteStaticAssetUrls };
|
|
@@ -471,11 +471,10 @@ function supportsTemplateOnlyHmr(output) {
|
|
|
471
471
|
/**
|
|
472
472
|
* Prepend a runtime `<style>` injection for plain CSS to a module's output.
|
|
473
473
|
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
* #1533), whose content is already scope-rewritten by the compiler.
|
|
474
|
+
* A guarded `document.createElement('style')` keyed by a stable id makes the
|
|
475
|
+
* fallback injection idempotent. `styleKey` seeds the element id. SFCs with
|
|
476
|
+
* block metadata use Vite style imports; this remains for metadata-free SFCs
|
|
477
|
+
* and JSX `<style scoped>` CSS (#1495, #1533).
|
|
479
478
|
*/
|
|
480
479
|
function prependInlineStyleInjection(output, css, styleKey) {
|
|
481
480
|
return `
|
|
@@ -508,13 +507,13 @@ function generateScopeId(filename) {
|
|
|
508
507
|
/**
|
|
509
508
|
* Whether the SFC's `<style>` blocks are handed to Vite as virtual imports.
|
|
510
509
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
510
|
+
* Every client-side SFC style block goes through Vite's CSS pipeline. This is
|
|
511
|
+
* also necessary during development and tests: the user's CSS transformer and
|
|
512
|
+
* targets must run before the stylesheet reaches the browser or jsdom.
|
|
513
|
+
* `compiled.css` remains a fallback for callers without block metadata.
|
|
515
514
|
*/
|
|
516
515
|
function usesStyleImports(compiled, options) {
|
|
517
|
-
return !!options.filePath && !!compiled.styles?.length && (options.customElement || hasDelegatedStyles(compiled) || !options.ssr
|
|
516
|
+
return !!options.filePath && !!compiled.styles?.length && (options.customElement || hasDelegatedStyles(compiled) || !options.ssr);
|
|
518
517
|
}
|
|
519
518
|
/**
|
|
520
519
|
* Whether `generateOutput` will embed `compiled.css` in the module.
|
|
@@ -752,6 +751,8 @@ function booleanCompilerOption(value) {
|
|
|
752
751
|
function resolvePluginVueCompileOptions(options) {
|
|
753
752
|
const compilerOptions = options.template?.compilerOptions;
|
|
754
753
|
const resolved = { styleTrim: options.style?.trim ?? true };
|
|
754
|
+
const whitespace = compilerOptions?.whitespace ?? options.whitespace;
|
|
755
|
+
if (whitespace !== void 0) resolved.whitespace = whitespace;
|
|
755
756
|
const templateCacheHandlers = booleanCompilerOption(compilerOptions?.cacheHandlers);
|
|
756
757
|
const templateComments = booleanCompilerOption(compilerOptions?.comments);
|
|
757
758
|
const templateHoistStatic = booleanCompilerOption(compilerOptions?.hoistStatic);
|
|
@@ -827,6 +828,7 @@ function getCompileOptionsForRequest(state, ssr) {
|
|
|
827
828
|
vapor: !ssr && (state.mergedOptions?.vapor ?? false),
|
|
828
829
|
customRenderer: state.mergedOptions?.customRenderer ?? false,
|
|
829
830
|
templateSyntax: state.mergedOptions?.templateSyntax ?? "standard",
|
|
831
|
+
templateComments: !state.isProduction,
|
|
830
832
|
...resolvePluginVueCompileOptions(state.mergedOptions ?? {})
|
|
831
833
|
};
|
|
832
834
|
if (state.mergedOptions?.customElements !== void 0) options.customElements = state.mergedOptions.customElements;
|
|
@@ -967,6 +969,7 @@ function buildCompileFileOptions(filePath, options) {
|
|
|
967
969
|
sourceMap: options.sourceMap,
|
|
968
970
|
ssr: options.ssr,
|
|
969
971
|
vapor: options.vapor,
|
|
972
|
+
...options.whitespace === void 0 ? {} : { whitespace: options.whitespace },
|
|
970
973
|
customRenderer: options.customRenderer ?? false,
|
|
971
974
|
...options.customElements === void 0 ? {} : { customElements: options.customElements },
|
|
972
975
|
experimentalInTagComments: options.experimentalInTagComments ?? false,
|
|
@@ -991,6 +994,7 @@ function buildCompileBatchOptions(options) {
|
|
|
991
994
|
return {
|
|
992
995
|
ssr: options.ssr,
|
|
993
996
|
vapor: options.vapor,
|
|
997
|
+
...options.whitespace === void 0 ? {} : { whitespace: options.whitespace },
|
|
994
998
|
customRenderer: options.customRenderer ?? false,
|
|
995
999
|
...options.customElements === void 0 ? {} : { customElements: options.customElements },
|
|
996
1000
|
experimentalInTagComments: options.experimentalInTagComments ?? false,
|
|
@@ -1681,6 +1685,7 @@ function resolvePrecompileBatchOptions(state) {
|
|
|
1681
1685
|
runtimeModuleName: state.mergedOptions.runtimeModuleName,
|
|
1682
1686
|
runtimeGlobalName: state.mergedOptions.runtimeGlobalName,
|
|
1683
1687
|
vueVersion: state.mergedOptions.vueVersion,
|
|
1688
|
+
whitespace: requestOptions.whitespace,
|
|
1684
1689
|
styleTrim: requestOptions.styleTrim,
|
|
1685
1690
|
templateCacheHandlers: requestOptions.templateCacheHandlers,
|
|
1686
1691
|
templateComments: requestOptions.templateComments,
|
|
@@ -1979,7 +1984,7 @@ async function resolveRelativeVueSfcImport(ctx, state, id, cleanImporter, isSsrR
|
|
|
1979
1984
|
const resolvedPath = resolvedRequest.normalizedFsId ?? resolvedRequest.normalizedVuePath;
|
|
1980
1985
|
if (!resolvedPath || !resolvedPath.endsWith(".vue")) return resolved;
|
|
1981
1986
|
const effectiveQuery = resolvedRequest.querySuffix || querySuffix;
|
|
1982
|
-
return isDependencyScan ?
|
|
1987
|
+
return isDependencyScan ? resolvedPath : toPluginVisibleVirtualId(resolvedPath, isSsrRequest, effectiveQuery);
|
|
1983
1988
|
}
|
|
1984
1989
|
//#endregion
|
|
1985
1990
|
//#region src/plugin/resolve.ts
|
|
@@ -2352,10 +2357,16 @@ async function resolveAliasedVueImport(ctx, state, id, importer, isSsrRequest, h
|
|
|
2352
2357
|
}
|
|
2353
2358
|
if (state.cache.has(realPath) || fs.existsSync(realPath)) {
|
|
2354
2359
|
state.logger.log(`resolveId: resolved via Vite fallback ${id} to ${realPath}`);
|
|
2355
|
-
return preserveQueryAsPath ? `${realPath}${querySuffix}` : isDependencyScan ?
|
|
2360
|
+
return preserveQueryAsPath ? `${realPath}${querySuffix}` : isDependencyScan ? realPath : toPluginVisibleVirtualId(realPath, isSsrRequest, querySuffix);
|
|
2356
2361
|
}
|
|
2357
2362
|
return null;
|
|
2358
2363
|
}
|
|
2364
|
+
function resolvePackageVueModuleId(state, resolvedId, isSsrRequest, isDependencyScan) {
|
|
2365
|
+
const realPath = normalizeResolvedVuePath(resolvedId);
|
|
2366
|
+
if (!realPath || !state.cache.has(realPath) && !fs.existsSync(realPath)) return null;
|
|
2367
|
+
if (state.filter && !realPath.includes("node_modules") && !state.filter(realPath)) return null;
|
|
2368
|
+
return isDependencyScan ? realPath : toPluginVisibleVirtualId(realPath, isSsrRequest);
|
|
2369
|
+
}
|
|
2359
2370
|
async function resolveIdHook(ctx, state, id, importer, options) {
|
|
2360
2371
|
if (!isPotentialVizeResolveId(id) && !isPotentialVizeImporter(importer)) return null;
|
|
2361
2372
|
const importerRequest = classifyImporterRequest(importer);
|
|
@@ -2367,12 +2378,13 @@ async function resolveIdHook(ctx, state, id, importer, options) {
|
|
|
2367
2378
|
const projectVueRuntime = await resolveProjectVueRuntime(ctx, state, id, importer, isSsrRequest);
|
|
2368
2379
|
if (projectVueRuntime) return projectVueRuntime;
|
|
2369
2380
|
if (pluginVisibleVirtualPath) {
|
|
2370
|
-
if (isDependencyScan) return
|
|
2381
|
+
if (isDependencyScan) return pluginVisibleVirtualPath;
|
|
2371
2382
|
return isSsrRequest ? toPluginVisibleVirtualId(pluginVisibleVirtualPath, true, request.querySuffix) : id;
|
|
2372
2383
|
}
|
|
2373
2384
|
if (id.startsWith("\0")) {
|
|
2374
2385
|
if (request.isVizeVirtual) {
|
|
2375
|
-
if (isSsrRequest && !request.isVizeSsrVirtual && request.vizeVirtualPath) return isDependencyScan ?
|
|
2386
|
+
if (isSsrRequest && !request.isVizeSsrVirtual && request.vizeVirtualPath) return isDependencyScan ? request.vizeVirtualPath : toPluginVisibleVirtualId(request.vizeVirtualPath, true, request.querySuffix);
|
|
2387
|
+
if (isDependencyScan && request.vizeVirtualPath) return request.vizeVirtualPath;
|
|
2376
2388
|
return id;
|
|
2377
2389
|
}
|
|
2378
2390
|
if (id.startsWith("\0vize:")) {
|
|
@@ -2428,9 +2440,10 @@ async function resolveIdHook(ctx, state, id, importer, options) {
|
|
|
2428
2440
|
if (id.startsWith("#")) {
|
|
2429
2441
|
try {
|
|
2430
2442
|
const resolved = await resolveWithVite(ctx, state, id, cleanImporter, { skipSelf: true });
|
|
2431
|
-
if (resolved) return resolved;
|
|
2443
|
+
if (resolved) return !resolved.external && id.endsWith(".vue") ? resolvePackageVueModuleId(state, resolved.id, isSsrRequest, isDependencyScan) ?? resolved : resolved;
|
|
2432
2444
|
} catch {}
|
|
2433
|
-
|
|
2445
|
+
const fallback = resolvePackageJsonImportFromVizeImporter(state, id, cleanImporter);
|
|
2446
|
+
return fallback && id.endsWith(".vue") ? resolvePackageVueModuleId(state, fallback, isSsrRequest, isDependencyScan) ?? fallback : fallback;
|
|
2434
2447
|
}
|
|
2435
2448
|
if (!id.endsWith(".vue")) {
|
|
2436
2449
|
const ssrExternalVueRequest = isSsrRequest ? resolveSsrExternalVueRequest(id) : null;
|
|
@@ -2623,7 +2636,7 @@ async function resolveIdHook(ctx, state, id, importer, options) {
|
|
|
2623
2636
|
state.logger.log(`resolveId: id=${id}, resolved=${resolved}, hasCache=${hasCache}, fileExists=${fileExists}, importer=${importer ?? "none"}`);
|
|
2624
2637
|
if (hasCache || fileExists) {
|
|
2625
2638
|
if (preserveQueryAsPath) return `${resolved}${request.querySuffix}`;
|
|
2626
|
-
return isDependencyScan ?
|
|
2639
|
+
return isDependencyScan ? resolved : toPluginVisibleVirtualId(resolved, isSsrRequest, request.querySuffix);
|
|
2627
2640
|
}
|
|
2628
2641
|
}
|
|
2629
2642
|
return null;
|
|
@@ -2956,7 +2969,7 @@ function loadHook(state, id, loadOptions) {
|
|
|
2956
2969
|
const blockIndex = styleRequest.styleIndex ?? -1;
|
|
2957
2970
|
if (fallbackCompiled?.styles && blockIndex >= 0 && blockIndex < fallbackCompiled.styles.length) {
|
|
2958
2971
|
const block = fallbackCompiled.styles[blockIndex];
|
|
2959
|
-
let styleContent = block.content;
|
|
2972
|
+
let styleContent = state.mergedOptions.style?.trim === false ? block.content : block.content.trim();
|
|
2960
2973
|
if (scoped && block.scoped && (!lang || lang === "css")) styleContent = scopeCssForPipeline(styleContent, scoped);
|
|
2961
2974
|
styleContent = transformCssVarsForPipeline(styleContent, fallbackCompiled.scopeId);
|
|
2962
2975
|
return {
|
|
@@ -3195,7 +3208,6 @@ async function handleHotUpdateHook(state, ctx, options = {}) {
|
|
|
3195
3208
|
const updateType = detectHmrUpdateType(prevCompiled, newCompiled);
|
|
3196
3209
|
state.logger.log(`Re-compiled: ${path.relative(state.root, file)} (${updateType})`);
|
|
3197
3210
|
const modules = preferAcceptingClientModules(initialModules ?? await collectModulesByFile(server, getVueModuleFileCandidates(file)), options.requireAcceptingClientModule);
|
|
3198
|
-
const hasDelegated = hasDelegatedStyles(newCompiled);
|
|
3199
3211
|
if (isPluginVueCustomElement(state.mergedOptions, file) && updateType === "style-only") {
|
|
3200
3212
|
if (modules.size > 0) {
|
|
3201
3213
|
state.pendingHmrUpdateTypes.set(file, "full-reload");
|
|
@@ -3205,7 +3217,7 @@ async function handleHotUpdateHook(state, ctx, options = {}) {
|
|
|
3205
3217
|
state.pendingHmrUpdateTypes.delete(file);
|
|
3206
3218
|
return [];
|
|
3207
3219
|
}
|
|
3208
|
-
if (
|
|
3220
|
+
if (newCompiled.styles?.length && updateType === "style-only") {
|
|
3209
3221
|
const affectedModules = /* @__PURE__ */ new Set();
|
|
3210
3222
|
for (const block of newCompiled.styles ?? []) {
|
|
3211
3223
|
const params = new URLSearchParams();
|
|
@@ -3222,7 +3234,7 @@ async function handleHotUpdateHook(state, ctx, options = {}) {
|
|
|
3222
3234
|
if (modules.size > 0) return [...modules];
|
|
3223
3235
|
return [];
|
|
3224
3236
|
}
|
|
3225
|
-
if (updateType === "style-only" && newCompiled.css && !
|
|
3237
|
+
if (updateType === "style-only" && newCompiled.css && !hasDelegatedStyles(newCompiled)) {
|
|
3226
3238
|
state.pendingHmrUpdateTypes.delete(file);
|
|
3227
3239
|
server.ws.send({
|
|
3228
3240
|
type: "custom",
|
|
@@ -4010,6 +4022,7 @@ function vize(options = {}) {
|
|
|
4010
4022
|
customRenderer: options.customRenderer ?? compilerConfig.customRenderer ?? false,
|
|
4011
4023
|
customElements: options.customElements ?? compilerConfig.customElements,
|
|
4012
4024
|
templateSyntax,
|
|
4025
|
+
whitespace: options.whitespace ?? compilerConfig.whitespace,
|
|
4013
4026
|
compatibility,
|
|
4014
4027
|
vueVersion,
|
|
4015
4028
|
mode,
|
|
@@ -100,7 +100,8 @@ async function runTools(task, args, metadata, vp, native, execute) {
|
|
|
100
100
|
ignore: [
|
|
101
101
|
"**/node_modules/**",
|
|
102
102
|
"**/.git/**",
|
|
103
|
-
"**/.vize/**"
|
|
103
|
+
"**/.vize/**",
|
|
104
|
+
...metadata.fmtIgnorePatterns ?? []
|
|
104
105
|
]
|
|
105
106
|
})).filter((file) => file.endsWith(".vue"));
|
|
106
107
|
if (vue.length) await vize("fmt", [formatCheck ? "--check" : "--write", ...vue]);
|
|
@@ -187,11 +188,13 @@ async function runNative(command, argv, metadata, native = nativeBinary(), spawn
|
|
|
187
188
|
flag: "wx",
|
|
188
189
|
mode: 384
|
|
189
190
|
});
|
|
191
|
+
const lintOptions = command === "lint" ? [...metadata.lintLocale ? ["--locale", metadata.lintLocale] : [], ...metadata.lintHelpLevel ? ["--help-level", metadata.lintHelpLevel] : []] : [];
|
|
190
192
|
return await spawn(process.execPath, [
|
|
191
193
|
native,
|
|
192
194
|
command,
|
|
193
195
|
"--config",
|
|
194
196
|
file,
|
|
197
|
+
...lintOptions,
|
|
195
198
|
...argv
|
|
196
199
|
]);
|
|
197
200
|
} finally {
|
|
@@ -45,6 +45,7 @@ interface VizeConfig {
|
|
|
45
45
|
lsp?: LanguageServerConfig;
|
|
46
46
|
musea?: MuseaConfig;
|
|
47
47
|
globalTypes?: GlobalTypesConfig;
|
|
48
|
+
lib?: LibConfig;
|
|
48
49
|
/**
|
|
49
50
|
* Scoped config entries for monorepos and workspaces
|
|
50
51
|
*/
|
|
@@ -86,6 +87,10 @@ interface CompilerConfig {
|
|
|
86
87
|
* Template syntax compatibility mode
|
|
87
88
|
*/
|
|
88
89
|
templateSyntax?: "standard" | "strict" | "quirks";
|
|
90
|
+
/**
|
|
91
|
+
* Vue template whitespace strategy or opt-in Vue 2 line-break migration mode
|
|
92
|
+
*/
|
|
93
|
+
whitespace?: "condense" | "preserve" | "vue2-line-breaks";
|
|
89
94
|
/**
|
|
90
95
|
* Enable source map generation
|
|
91
96
|
*/
|
|
@@ -629,6 +634,42 @@ interface GlobalTypeDeclaration {
|
|
|
629
634
|
*/
|
|
630
635
|
defaultValue?: string;
|
|
631
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* vize lib source distribution options; paths are relative to the config file
|
|
639
|
+
*/
|
|
640
|
+
interface LibConfig {
|
|
641
|
+
/**
|
|
642
|
+
* Destination for every registry kind unless a kind-specific directory is set
|
|
643
|
+
*/
|
|
644
|
+
dir?: string;
|
|
645
|
+
/**
|
|
646
|
+
* Destination for @vizejs/ui items (default: src/components/vize)
|
|
647
|
+
*/
|
|
648
|
+
uiDir?: string;
|
|
649
|
+
/**
|
|
650
|
+
* Destination for @vizejs/composable items (default: src/composables/vize)
|
|
651
|
+
*/
|
|
652
|
+
composableDir?: string;
|
|
653
|
+
/**
|
|
654
|
+
* Lockfile path (default: vize-lib.lock.json)
|
|
655
|
+
*/
|
|
656
|
+
lockfile?: string;
|
|
657
|
+
/**
|
|
658
|
+
* Third-party registries by @namespace, pulled as @namespace/<item>
|
|
659
|
+
*/
|
|
660
|
+
registries?: {
|
|
661
|
+
[k: string]: string | {
|
|
662
|
+
/**
|
|
663
|
+
* Path to a registry, npm:<package>[@range], or an https:// URL of a registry.json
|
|
664
|
+
*/
|
|
665
|
+
source: string;
|
|
666
|
+
/**
|
|
667
|
+
* Destination directory for this namespace's items
|
|
668
|
+
*/
|
|
669
|
+
dir?: string;
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
}
|
|
632
673
|
/**
|
|
633
674
|
* Scoped Vize config entry for monorepos and workspaces
|
|
634
675
|
*/
|
|
@@ -876,6 +917,7 @@ interface VitePluginVueScriptOptions {
|
|
|
876
917
|
[key: string]: unknown;
|
|
877
918
|
}
|
|
878
919
|
interface VitePluginVueTemplateCompilerOptions {
|
|
920
|
+
whitespace?: "condense" | "preserve";
|
|
879
921
|
comments?: boolean;
|
|
880
922
|
hoistStatic?: boolean;
|
|
881
923
|
cacheHandlers?: boolean;
|
|
@@ -1114,6 +1156,8 @@ interface VizeOptions extends ExperimentalPluginOptions {
|
|
|
1114
1156
|
* @default "standard"
|
|
1115
1157
|
*/
|
|
1116
1158
|
templateSyntax?: "standard" | "strict" | "quirks";
|
|
1159
|
+
/** Vue whitespace strategy, or Vize's narrow Vue 2 line-break migration mode. @default "condense" */
|
|
1160
|
+
whitespace?: "condense" | "preserve" | "vue2-line-breaks";
|
|
1117
1161
|
/**
|
|
1118
1162
|
* Root directory to scan for .vue files
|
|
1119
1163
|
* @default Vite's root
|
package/dist/vite-plus.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as LinterConfig, g as FormatterConfig, h as CompilerConfig, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as TypeCheckerConfig } from "./types-
|
|
1
|
+
import { _ as LinterConfig, g as FormatterConfig, h as CompilerConfig, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as TypeCheckerConfig } from "./types-BSmJ5UMW.mjs";
|
|
2
2
|
import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
|
|
3
3
|
|
|
4
4
|
//#region src/vite-plus/types.d.ts
|
|
@@ -8,6 +8,10 @@ type VizeCompilerOptions = Omit<CompilerConfig, "compatibility"> & Omit<VizeOpti
|
|
|
8
8
|
interface VizeLintOptions extends LinterConfig {
|
|
9
9
|
/** Also run the native typechecker before linting. @default false */
|
|
10
10
|
typecheck?: boolean;
|
|
11
|
+
/** Language of native lint diagnostics. @default "en" */
|
|
12
|
+
locale?: "en" | "ja" | "zh";
|
|
13
|
+
/** Detail shown with native lint diagnostics. @default "full" */
|
|
14
|
+
helpLevel?: "full" | "short" | "none";
|
|
11
15
|
}
|
|
12
16
|
interface VizePackOptions {
|
|
13
17
|
/** Emit Vue and TypeScript declarations after the bundle succeeds. @default true */
|
|
@@ -24,6 +28,17 @@ interface VizePackOptions {
|
|
|
24
28
|
type WithPack<T> = T extends (infer Item)[] ? WithPack<Item>[] : T & {
|
|
25
29
|
vize?: VizePackOptions | false;
|
|
26
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Vite and Vite+ both accept a named plugin (including nested async options),
|
|
33
|
+
* but their full Plugin hook types can come from different Vite installations.
|
|
34
|
+
* Comparing those two recursive hook types makes TypeScript 5.9/6 crash.
|
|
35
|
+
*/
|
|
36
|
+
type CompatiblePluginOption = {
|
|
37
|
+
name: string;
|
|
38
|
+
} | false | null | undefined | CompatiblePluginOption[] | Promise<CompatiblePluginOption>;
|
|
39
|
+
type WithCompatiblePlugins<T> = Omit<T, "plugins"> & {
|
|
40
|
+
plugins?: CompatiblePluginOption[];
|
|
41
|
+
};
|
|
27
42
|
type VizeSharedConfig = UserConfig$1 & {
|
|
28
43
|
/** Alias of lint.vize; lint.vize takes precedence when both are provided. */lint?: VizeLintOptions | boolean;
|
|
29
44
|
};
|
|
@@ -41,9 +56,9 @@ interface VueIntegrationConfig {
|
|
|
41
56
|
/** Shared native settings, including scopes, globals and editor settings. */
|
|
42
57
|
vize?: VizeSharedConfig | UserConfigExport;
|
|
43
58
|
}
|
|
44
|
-
type WithVize<T> = T extends ((...args: infer Args) => infer Result) ? (...args: Args) => WithVize<Result> : T extends Promise<infer Result> ? Promise<WithVize<Result>> : Omit<T
|
|
59
|
+
type WithVize<T> = T extends ((...args: infer Args) => infer Result) ? (...args: Args) => WithVize<Result> : T extends Promise<infer Result> ? Promise<WithVize<Result>> : Omit<WithCompatiblePlugins<T>, "lint" | "fmt" | "pack"> & VueIntegrationConfig;
|
|
45
60
|
type VueConfig = WithVize<VitePlusConfig>;
|
|
46
|
-
type VueConfigObject = Omit<UserConfig
|
|
61
|
+
type VueConfigObject = Omit<WithCompatiblePlugins<UserConfig>, "lint" | "fmt" | "pack"> & VueIntegrationConfig;
|
|
47
62
|
type VizeTask = "editor:setup" | "check" | "typecheck" | "lint" | "lint:fix" | "fmt" | "fmt:check" | "pack" | "build" | "dev" | "preview" | "test";
|
|
48
63
|
interface VizePlusOptions {
|
|
49
64
|
/** Compiler plugin options; prefer the compiler config section. */
|
package/dist/vite-plus.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as resolveConfigExport, r as loadConfig } from "./config-PP6EAmWc.mjs";
|
|
2
2
|
import { t as mergeSharedConfig } from "./shared-config-dMxrrTkb.mjs";
|
|
3
|
-
import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-
|
|
3
|
+
import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-8x__0QxE.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
@@ -166,18 +166,22 @@ function normalizeConfig(source, integration) {
|
|
|
166
166
|
return mergeSharedConfig(base === void 0 ? await loadConfig(process.cwd(), { env }) : await resolveConfigExport(base, env), await resolveConfigExport({
|
|
167
167
|
...compiler === false ? {} : { compiler: nativeCompiler(compiler) },
|
|
168
168
|
...typeof typecheck === "object" ? { typeChecker: typecheck } : {},
|
|
169
|
-
...typeof lintConfig === "object" ? { linter:
|
|
169
|
+
...typeof lintConfig === "object" ? { linter: withoutTaskLintOptions(lintConfig) } : {},
|
|
170
170
|
...typeof nativeFmt === "object" ? { formatter: nativeFmt } : {}
|
|
171
171
|
}, env)) ?? {};
|
|
172
172
|
};
|
|
173
173
|
const metadata = {
|
|
174
174
|
config,
|
|
175
175
|
options,
|
|
176
|
-
lintTypecheck: typeof lintConfig === "object" && lintConfig.typecheck === true
|
|
176
|
+
lintTypecheck: typeof lintConfig === "object" && lintConfig.typecheck === true,
|
|
177
|
+
lintLocale: typeof lintConfig === "object" ? lintConfig.locale : void 0,
|
|
178
|
+
lintHelpLevel: typeof lintConfig === "object" ? lintConfig.helpLevel : void 0,
|
|
179
|
+
fmtIgnorePatterns: oxfmt.ignorePatterns
|
|
177
180
|
};
|
|
178
181
|
return {
|
|
179
182
|
vp: {
|
|
180
183
|
...rest,
|
|
184
|
+
plugins: rest.plugins,
|
|
181
185
|
lint: lint ? oxlint : void 0,
|
|
182
186
|
fmt: fmt ? oxfmt : void 0
|
|
183
187
|
},
|
|
@@ -185,8 +189,8 @@ function normalizeConfig(source, integration) {
|
|
|
185
189
|
compiler
|
|
186
190
|
};
|
|
187
191
|
}
|
|
188
|
-
function
|
|
189
|
-
const { typecheck: _typecheck, ...native } = config;
|
|
192
|
+
function withoutTaskLintOptions(config) {
|
|
193
|
+
const { typecheck: _typecheck, locale: _locale, helpLevel: _helpLevel, ...native } = config;
|
|
190
194
|
return native;
|
|
191
195
|
}
|
|
192
196
|
function nativeCompiler(options) {
|
|
@@ -317,7 +321,7 @@ function defineConfig(config = {}, integration = {}) {
|
|
|
317
321
|
const { options } = metadata;
|
|
318
322
|
const plugins = compiler === false ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
|
|
319
323
|
if (compiler !== false) {
|
|
320
|
-
const { vize } = await import("./plugin-
|
|
324
|
+
const { vize } = await import("./plugin-BZN9h1bb.mjs");
|
|
321
325
|
plugins.unshift(vize({
|
|
322
326
|
...compiler,
|
|
323
327
|
configMode: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.427.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vizejs/native": "0.
|
|
55
|
-
"@vizejs/unplugin": "0.
|
|
54
|
+
"@vizejs/native": "0.427.0",
|
|
55
|
+
"@vizejs/unplugin": "0.427.0",
|
|
56
56
|
"jsonc-parser": "^3.3.1",
|
|
57
57
|
"oxc-parser": "0.144.0",
|
|
58
58
|
"tinyglobby": "0.2.17",
|
|
59
|
-
"vize": "0.
|
|
59
|
+
"vize": "0.427.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "25.9.2",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"check": "vp check src vite.config.ts",
|
|
89
89
|
"check:fix": "vp check --fix src vite.config.ts",
|
|
90
90
|
"fmt": "vp fmt --write src vite.config.ts",
|
|
91
|
-
"test": "pnpm --dir ../../native build:debug && node src/test.ts && node --test src/vite-plus/*.test.ts"
|
|
91
|
+
"test": "pnpm --dir ../../native build:debug && node src/test.ts && node --test src/vite-plus/*.test.ts",
|
|
92
|
+
"test:types:real-vite": "vp exec node type-tests/plugin-vue/check.mjs"
|
|
92
93
|
}
|
|
93
94
|
}
|
package/dist/plugin-CewswkDY.mjs
DELETED