@vizejs/vite-plugin 0.682.0 → 0.683.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/plugin-CjXV_gJm.mjs +2 -0
- package/dist/{plugin-DeTv2aMw.mjs → plugin-D9-_kA6W.mjs} +69 -10
- package/dist/{types-CuBwh3up.d.mts → types-BYtdVAwW.d.mts} +8 -0
- package/dist/vite-plus.d.mts +1 -1
- package/dist/vite-plus.mjs +1 -1
- package/package.json +4 -4
- package/dist/plugin-B3_BaqVE.mjs +0 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as VizeInspectorLintPlanProvider, b as VizeConfig, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, h as VueOptionsEntry, i as VizeVueFeatures, l as VizeVueVersion, m as VueOptions, n as CompiledModule, o as VizeInspectorLintPlanRequest, p as UserConfigExport, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv } from "./types-
|
|
1
|
+
import { a as VizeInspectorLintPlanProvider, b as VizeConfig, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, h as VueOptionsEntry, i as VizeVueFeatures, l as VizeVueVersion, m as VueOptions, n as CompiledModule, o as VizeInspectorLintPlanRequest, p as UserConfigExport, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv } from "./types-BYtdVAwW.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/compiler-config.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as vize } from "./plugin-
|
|
1
|
+
import { t as vize } from "./plugin-D9-_kA6W.mjs";
|
|
2
2
|
import { u as rewriteStaticAssetUrls } from "./vue-version-B0qUneRk.mjs";
|
|
3
3
|
import { a as resolveViteConfigExport, i as resolveConfigExport, n as defineConfig, o as vizeConfigStore, r as loadConfig, t as VIZE_CONFIG_FILE_ENV } from "./config-LlMZcDZI.mjs";
|
|
4
4
|
//#region src/index.ts
|
|
@@ -992,6 +992,7 @@ function getCompileOptionsForRequest(state, ssr, file) {
|
|
|
992
992
|
templateComments: !state.isProduction,
|
|
993
993
|
...resolvePluginVueCompileOptions(mergedOptions ?? {})
|
|
994
994
|
};
|
|
995
|
+
if (mergedOptions?.typeResolutionFallbackTsconfig !== void 0) options.typeResolutionFallbackTsconfig = mergedOptions.typeResolutionFallbackTsconfig;
|
|
995
996
|
if (mergedOptions?.nuxtPageMeta !== void 0) options.nuxtPageMeta = mergedOptions.nuxtPageMeta;
|
|
996
997
|
if (mergedOptions?.customElements !== void 0) options.customElements = mergedOptions.customElements;
|
|
997
998
|
if (mergedOptions?.mode !== void 0) options.mode = mergedOptions.mode;
|
|
@@ -1326,6 +1327,7 @@ function buildCompileFileOptions(filePath, options, scopeId = generateScopeId(fi
|
|
|
1326
1327
|
ssr: options.ssr,
|
|
1327
1328
|
vapor: options.vapor,
|
|
1328
1329
|
...options.nuxtPageMeta === void 0 ? {} : { nuxtPageMeta: options.nuxtPageMeta },
|
|
1330
|
+
...options.typeResolutionFallbackTsconfig === void 0 ? {} : { typeResolutionFallbackTsconfig: options.typeResolutionFallbackTsconfig },
|
|
1329
1331
|
...options.whitespace === void 0 ? {} : { whitespace: options.whitespace },
|
|
1330
1332
|
customRenderer: options.customRenderer ?? false,
|
|
1331
1333
|
...options.customElements === void 0 ? {} : { customElements: options.customElements },
|
|
@@ -1354,6 +1356,7 @@ function buildCompileBatchOptions(options) {
|
|
|
1354
1356
|
ssr: options.ssr,
|
|
1355
1357
|
vapor: options.vapor,
|
|
1356
1358
|
...options.nuxtPageMeta === void 0 ? {} : { nuxtPageMeta: options.nuxtPageMeta },
|
|
1359
|
+
...options.typeResolutionFallbackTsconfig === void 0 ? {} : { typeResolutionFallbackTsconfig: options.typeResolutionFallbackTsconfig },
|
|
1357
1360
|
...options.whitespace === void 0 ? {} : { whitespace: options.whitespace },
|
|
1358
1361
|
customRenderer: options.customRenderer ?? false,
|
|
1359
1362
|
...options.customElements === void 0 ? {} : { customElements: options.customElements },
|
|
@@ -1420,6 +1423,7 @@ function compileFile(filePath, cache, options, source, diagnostics) {
|
|
|
1420
1423
|
console.warn(`[vize] Warning in ${filePath}: ${warning}`);
|
|
1421
1424
|
});
|
|
1422
1425
|
const compiled = {
|
|
1426
|
+
...result.typeProject ? { typeProject: result.typeProject } : {},
|
|
1423
1427
|
source: content,
|
|
1424
1428
|
code: result.code,
|
|
1425
1429
|
...result.map ? { map: result.map } : {},
|
|
@@ -1500,6 +1504,8 @@ function compileBatch(files, cache, options) {
|
|
|
1500
1504
|
if (fallback.css !== void 0) fileResult.css = fallback.css;
|
|
1501
1505
|
fileResult.scopeId = fallback.scopeId;
|
|
1502
1506
|
fileResult.hasScoped = fallback.hasScoped;
|
|
1507
|
+
delete fileResult.typeProject;
|
|
1508
|
+
if (fallback.typeProject !== void 0) fileResult.typeProject = fallback.typeProject;
|
|
1503
1509
|
delete fileResult.macroArtifacts;
|
|
1504
1510
|
if (fallback.macroArtifacts !== void 0) fileResult.macroArtifacts = fallback.macroArtifacts;
|
|
1505
1511
|
delete fileResult.moduleShape;
|
|
@@ -1512,6 +1518,7 @@ function compileBatch(files, cache, options) {
|
|
|
1512
1518
|
}
|
|
1513
1519
|
for (const fileResult of result.results) {
|
|
1514
1520
|
if (fileResult.errors.length === 0) cache.set(fileResult.path, {
|
|
1521
|
+
...fileResult.typeProject ? { typeProject: fileResult.typeProject } : {},
|
|
1515
1522
|
source: filesByPath.get(fileResult.path)?.source,
|
|
1516
1523
|
code: fileResult.code,
|
|
1517
1524
|
...fileResult.map ? { map: fileResult.map } : {},
|
|
@@ -1638,10 +1645,11 @@ const EMPTY = Buffer.alloc(0);
|
|
|
1638
1645
|
* Whether `module` may be persisted.
|
|
1639
1646
|
*
|
|
1640
1647
|
* Modules assembled from `src` imports depend on sibling files that this cache
|
|
1641
|
-
* does not hash
|
|
1648
|
+
* does not hash. Project revisions belong to a single native process and cannot
|
|
1649
|
+
* register watches after a restart. Both kinds recompile on every cold start.
|
|
1642
1650
|
*/
|
|
1643
1651
|
function isPersistablePrecompileModule(module) {
|
|
1644
|
-
return !module.dependencies || module.dependencies.length === 0;
|
|
1652
|
+
return module.typeProject === void 0 && (!module.dependencies || module.dependencies.length === 0);
|
|
1645
1653
|
}
|
|
1646
1654
|
function isCompiledModule(value) {
|
|
1647
1655
|
if (value === null || typeof value !== "object") return false;
|
|
@@ -2023,6 +2031,29 @@ async function prepareSfcSrcRequests(state, resolve, file, source) {
|
|
|
2023
2031
|
(state.srcResolutions ??= /* @__PURE__ */ new Map()).set(file, await resolveSfcSrcRequests(file, requests, resolve));
|
|
2024
2032
|
}
|
|
2025
2033
|
//#endregion
|
|
2034
|
+
//#region src/plugin/type-project-watches.ts
|
|
2035
|
+
const watched = /* @__PURE__ */ new WeakMap();
|
|
2036
|
+
function resetTypeProjectWatches(cache) {
|
|
2037
|
+
watched.delete(cache);
|
|
2038
|
+
}
|
|
2039
|
+
function watchTypeProject(cache, context, addWatchFile, api = native) {
|
|
2040
|
+
if (!context || !addWatchFile) return;
|
|
2041
|
+
let projects = watched.get(cache);
|
|
2042
|
+
const knownRevision = projects?.get(context.root);
|
|
2043
|
+
const inputs = api.typeProjectInputs(context.root, context.revision, knownRevision);
|
|
2044
|
+
if (!inputs) throw new Error("[vize] TypeScript project changed while compiling; reload the component.");
|
|
2045
|
+
if (knownRevision === context.revision) return;
|
|
2046
|
+
for (const input of inputs) addWatchFile(input);
|
|
2047
|
+
if (!projects) {
|
|
2048
|
+
projects = /* @__PURE__ */ new Map();
|
|
2049
|
+
watched.set(cache, projects);
|
|
2050
|
+
}
|
|
2051
|
+
projects.set(context.root, context.revision);
|
|
2052
|
+
}
|
|
2053
|
+
function typeProjectDependencyRoots(cache, file, api = native) {
|
|
2054
|
+
return watched.has(cache) ? api.typeProjectOwners(file) : [];
|
|
2055
|
+
}
|
|
2056
|
+
//#endregion
|
|
2026
2057
|
//#region src/plugin/precompile-run.ts
|
|
2027
2058
|
/**
|
|
2028
2059
|
* The pre-compilation pass.
|
|
@@ -2060,7 +2091,7 @@ function openCacheForRun(state, batchOptions) {
|
|
|
2060
2091
|
/**
|
|
2061
2092
|
* Pre-compile all Vue files matching scan patterns.
|
|
2062
2093
|
*/
|
|
2063
|
-
async function compileAll(state, owners = [], resolve) {
|
|
2094
|
+
async function compileAll(state, owners = [], resolve, addWatchFile) {
|
|
2064
2095
|
const startTime = performance.now();
|
|
2065
2096
|
const sfcFiles = (await glob(state.scanPatterns, {
|
|
2066
2097
|
cwd: state.root,
|
|
@@ -2177,6 +2208,7 @@ async function compileAll(state, owners = [], resolve) {
|
|
|
2177
2208
|
}
|
|
2178
2209
|
if (metadata) state.precompileMetadata.set(fileResult.path, metadata);
|
|
2179
2210
|
const compiled = state.cache.get(fileResult.path);
|
|
2211
|
+
watchTypeProject(state.cache, fileResult.typeProject, addWatchFile);
|
|
2180
2212
|
const sourceHash = sourceHashes.get(fileResult.path);
|
|
2181
2213
|
if (fileResult.warnings.length > 0) cache.delete(fileResult.path);
|
|
2182
2214
|
else if (compiled && sourceHash !== void 0) cache.set(fileResult.path, sourceHash, compiled);
|
|
@@ -3327,6 +3359,18 @@ function getVirtualStyleContent(block, options) {
|
|
|
3327
3359
|
return transformCssVarsForPipeline(styleContent, options.scopeId, options.productionFilename);
|
|
3328
3360
|
}
|
|
3329
3361
|
//#endregion
|
|
3362
|
+
//#region src/plugin/dependency-watches.ts
|
|
3363
|
+
/**
|
|
3364
|
+
* Vite records a transform's addWatchFile calls as module imports. Compiler
|
|
3365
|
+
* inputs include absent config candidates and type-only files, so watch them
|
|
3366
|
+
* through the dev server's filesystem watcher. Build hooks keep Rollup watches.
|
|
3367
|
+
*/
|
|
3368
|
+
function createDependencyWatch(server, addWatchFile) {
|
|
3369
|
+
return server ? (file) => {
|
|
3370
|
+
server.watcher.add(file);
|
|
3371
|
+
} : addWatchFile;
|
|
3372
|
+
}
|
|
3373
|
+
//#endregion
|
|
3330
3374
|
//#region src/plugin/sfc-module.ts
|
|
3331
3375
|
/**
|
|
3332
3376
|
* The SFC main module: `load` serves the SFC text and `transform` compiles the
|
|
@@ -3426,8 +3470,16 @@ async function transformSfcModule(state, code, sfc, options = {}) {
|
|
|
3426
3470
|
...state,
|
|
3427
3471
|
extractCss
|
|
3428
3472
|
}, realPath, compiled);
|
|
3473
|
+
const watchDependency = createDependencyWatch(state.server, options.addWatchFile);
|
|
3474
|
+
try {
|
|
3475
|
+
watchTypeProject(state.cache, compiled.typeProject, watchDependency);
|
|
3476
|
+
} catch (error) {
|
|
3477
|
+
evictCompiledModule(cache, realPath);
|
|
3478
|
+
throw error;
|
|
3479
|
+
}
|
|
3480
|
+
if (sfc.nullPrefixed) options.addWatchFile?.(realPath);
|
|
3429
3481
|
const dependencies = compiled.dependencies ?? [];
|
|
3430
|
-
for (const
|
|
3482
|
+
for (const dependency of new Set(dependencies)) watchDependency?.(dependency);
|
|
3431
3483
|
const hasDelegated = hasDelegatedStyles(compiled);
|
|
3432
3484
|
const outputOptions = {
|
|
3433
3485
|
isProduction: state.isProduction,
|
|
@@ -3686,15 +3738,21 @@ const VIZE_COMPONENTS_CSS_FILE = `assets/${VIZE_COMPONENTS_CSS_BASENAME}`;
|
|
|
3686
3738
|
* index that answers it in constant time. See `compiled-module-cache.ts`.
|
|
3687
3739
|
*/
|
|
3688
3740
|
function getVueFilesDependingOn(state, dependencyFile) {
|
|
3689
|
-
const
|
|
3741
|
+
const dependencies = [path.resolve(dependencyFile), ...typeProjectDependencyRoots(state.cache, dependencyFile)];
|
|
3690
3742
|
const owners = /* @__PURE__ */ new Set();
|
|
3691
|
-
|
|
3692
|
-
|
|
3743
|
+
const clientOwners = /* @__PURE__ */ new Set();
|
|
3744
|
+
for (const cache of [state.cache, state.ssrCache]) for (const dependency of dependencies) for (const vueFile of ownersOfDependency(cache, dependency)) {
|
|
3745
|
+
owners.add(vueFile);
|
|
3746
|
+
if (cache === state.cache) clientOwners.add(vueFile);
|
|
3747
|
+
}
|
|
3748
|
+
return {
|
|
3749
|
+
owners: [...owners],
|
|
3750
|
+
clientOwners
|
|
3751
|
+
};
|
|
3693
3752
|
}
|
|
3694
3753
|
async function handleHotUpdateHook(state, ctx, options = {}) {
|
|
3695
3754
|
const { file, server, read } = ctx;
|
|
3696
|
-
const clientDependencyOwners =
|
|
3697
|
-
const dependencyOwners = getVueFilesDependingOn(state, file);
|
|
3755
|
+
const { owners: dependencyOwners, clientOwners: clientDependencyOwners } = getVueFilesDependingOn(state, file);
|
|
3698
3756
|
if (dependencyOwners.length > 0) {
|
|
3699
3757
|
const affectedModules = /* @__PURE__ */ new Set();
|
|
3700
3758
|
for (const vueFile of dependencyOwners) {
|
|
@@ -4945,13 +5003,14 @@ function vize(options = {}, compilerDefaults = {}, hostContext) {
|
|
|
4945
5003
|
installDevMiddleware(devServer, state);
|
|
4946
5004
|
},
|
|
4947
5005
|
async buildStart() {
|
|
5006
|
+
resetTypeProjectWatches(state.cache);
|
|
4948
5007
|
state.viteResolveCache?.clear();
|
|
4949
5008
|
if (!state.scanPatterns || state.scanPatterns.length === 0) return;
|
|
4950
5009
|
try {
|
|
4951
5010
|
await compileAll({
|
|
4952
5011
|
...state,
|
|
4953
5012
|
extractCss: shouldExtractCssForBuild(state, this)
|
|
4954
|
-
}, precompileInputOwners(this, precompileConfig), (request, importer) => this.resolve(request, importer, { skipSelf: true }));
|
|
5013
|
+
}, precompileInputOwners(this, precompileConfig), (request, importer) => this.resolve(request, importer, { skipSelf: true }), this.addWatchFile.bind(this));
|
|
4955
5014
|
} catch (error) {
|
|
4956
5015
|
if (!(error instanceof PrecompileDiagnosticsError)) throw error;
|
|
4957
5016
|
state.logger.warn(`${error.message}\nStartup scan diagnostics are deferred until import.`);
|
|
@@ -1151,6 +1151,10 @@ type ModuleOutputInfo = {
|
|
|
1151
1151
|
};
|
|
1152
1152
|
//#endregion
|
|
1153
1153
|
//#region src/sfc-types.d.ts
|
|
1154
|
+
interface TypeProjectContext {
|
|
1155
|
+
root: string;
|
|
1156
|
+
revision: string;
|
|
1157
|
+
}
|
|
1154
1158
|
interface MacroArtifact {
|
|
1155
1159
|
kind: string;
|
|
1156
1160
|
name: string;
|
|
@@ -1175,6 +1179,8 @@ interface StyleBlockInfo {
|
|
|
1175
1179
|
index: number;
|
|
1176
1180
|
}
|
|
1177
1181
|
interface CompiledModule {
|
|
1182
|
+
/** Shared configuration authority; its watch inputs are registered once. */
|
|
1183
|
+
typeProject?: TypeProjectContext;
|
|
1178
1184
|
/**
|
|
1179
1185
|
* The SFC text this module was compiled from. A module answers only for this
|
|
1180
1186
|
* text; the pre-compile cache stores its hash instead.
|
|
@@ -1303,6 +1309,8 @@ interface VizeOptions extends ExperimentalPluginOptions {
|
|
|
1303
1309
|
vapor?: boolean;
|
|
1304
1310
|
/** Extract Nuxt page metadata; the Nuxt integration enables this explicitly. */
|
|
1305
1311
|
nuxtPageMeta?: boolean;
|
|
1312
|
+
/** Fallback tsconfig for imported macro types when no user project owns the file. */
|
|
1313
|
+
typeResolutionFallbackTsconfig?: string;
|
|
1306
1314
|
/**
|
|
1307
1315
|
* Default output mode for `.jsx`/`.tsx` components without a `"use vue:*"`
|
|
1308
1316
|
* directive. Distinct from `vapor` (which targets `.vue` SFCs): a project can
|
package/dist/vite-plus.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as FormatterConfig, g as CompilerConfig, h as VueOptionsEntry, m as VueOptions, p as UserConfigExport, t as VizeOptions, v as LinterConfig, y as TypeCheckerConfig } from "./types-
|
|
1
|
+
import { _ as FormatterConfig, g as CompilerConfig, h as VueOptionsEntry, m as VueOptions, p as UserConfigExport, t as VizeOptions, v as LinterConfig, y as TypeCheckerConfig } from "./types-BYtdVAwW.mjs";
|
|
2
2
|
import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
|
|
3
3
|
|
|
4
4
|
//#region src/vite-plus/types.d.ts
|
package/dist/vite-plus.mjs
CHANGED
|
@@ -400,7 +400,7 @@ function defineConfig(config = {}, integration = {}) {
|
|
|
400
400
|
const legacy = compiler !== false && (await import("./vue-version-DL5NF2G-.mjs")).isLegacyVueCompatibilityMode(compiler);
|
|
401
401
|
const plugins = compiler === false || legacy ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
|
|
402
402
|
if (compiler !== false) {
|
|
403
|
-
const { vize } = await import("./plugin-
|
|
403
|
+
const { vize } = await import("./plugin-CjXV_gJm.mjs");
|
|
404
404
|
plugins.push(vize({
|
|
405
405
|
...plugin,
|
|
406
406
|
configMode: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.683.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.683.0",
|
|
55
|
+
"@vizejs/unplugin": "0.683.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.683.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "25.9.2",
|
package/dist/plugin-B3_BaqVE.mjs
DELETED