@vizejs/vite-plugin 0.666.0 → 0.667.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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as vize } from "./plugin-
|
|
1
|
+
import { t as vize } from "./plugin-BAahoMod.mjs";
|
|
2
2
|
import { u as rewriteStaticAssetUrls } from "./vue-version-BFh0eI6J.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
|
|
@@ -1891,13 +1891,21 @@ async function prepareSfcSrcRequests(state, resolve, file, source) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
(state.srcResolutions ??= /* @__PURE__ */ new Map()).set(file, await resolveSfcSrcRequests(file, requests, resolve));
|
|
1893
1893
|
}
|
|
1894
|
-
/**
|
|
1894
|
+
/**
|
|
1895
|
+
* A `load` that compiles its SFC on demand resolves the SFC's requests first.
|
|
1896
|
+
* It returns the source it read, so that compile does not read the file again.
|
|
1897
|
+
*/
|
|
1895
1898
|
async function prepareLoadSrcRequests(state, resolve, id) {
|
|
1896
|
-
if (!id.includes(".vue")) return;
|
|
1899
|
+
if (!id.includes(".vue")) return void 0;
|
|
1897
1900
|
const request = classifyVitePluginRequest(id);
|
|
1898
1901
|
const file = request.vizeVirtualPath ?? fromPluginVisibleVirtualId(id) ?? getLoadableVueSfcPath(request);
|
|
1899
1902
|
if (!file?.endsWith(".vue") || state.cache.has(file) || state.ssrCache.has(file) || state.srcResolutions?.has(file) || !fs.existsSync(file)) return;
|
|
1900
|
-
|
|
1903
|
+
const source = fs.readFileSync(file, "utf-8");
|
|
1904
|
+
await prepareSfcSrcRequests(state, resolve, file, source);
|
|
1905
|
+
return {
|
|
1906
|
+
file,
|
|
1907
|
+
source
|
|
1908
|
+
};
|
|
1901
1909
|
}
|
|
1902
1910
|
//#endregion
|
|
1903
1911
|
//#region src/plugin/precompile-run.ts
|
|
@@ -2447,30 +2455,28 @@ const VUE_PEER_RUNTIME_ESM_ENTRIES = new Map([["vue-router", [
|
|
|
2447
2455
|
"index.mjs",
|
|
2448
2456
|
"index.js"
|
|
2449
2457
|
]]]);
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
id,
|
|
2457
|
-
importer ?? null,
|
|
2458
|
-
options?.skipSelf ?? false
|
|
2459
|
-
]);
|
|
2460
|
-
}
|
|
2461
|
-
function resolveWithVite(ctx, state, id, importer, options) {
|
|
2462
|
-
if (state.server !== null) return ctx.resolve(id, importer, options);
|
|
2463
|
-
const cache = getViteResolveCache(state);
|
|
2464
|
-
const key = createViteResolveCacheKey(id, importer, options, ctx.environment?.name);
|
|
2465
|
-
const cached = cache.get(key);
|
|
2458
|
+
/** One answer per build and environment for `key`; the dev server can change it. */
|
|
2459
|
+
function oncePerBuild(ctx, state, key, resolve) {
|
|
2460
|
+
if (state.server !== null) return resolve();
|
|
2461
|
+
const cache = state.viteResolveCache ??= /* @__PURE__ */ new Map();
|
|
2462
|
+
const cacheKey = JSON.stringify([ctx.environment?.name ?? null, ...key]);
|
|
2463
|
+
const cached = cache.get(cacheKey);
|
|
2466
2464
|
if (cached) return cached;
|
|
2467
|
-
const pending =
|
|
2468
|
-
cache.delete(
|
|
2465
|
+
const pending = resolve().catch((error) => {
|
|
2466
|
+
cache.delete(cacheKey);
|
|
2469
2467
|
throw error;
|
|
2470
2468
|
});
|
|
2471
|
-
cache.set(
|
|
2469
|
+
cache.set(cacheKey, pending);
|
|
2472
2470
|
return pending;
|
|
2473
2471
|
}
|
|
2472
|
+
function resolveWithVite(ctx, state, id, importer, options) {
|
|
2473
|
+
return oncePerBuild(ctx, state, [
|
|
2474
|
+
"resolve",
|
|
2475
|
+
id,
|
|
2476
|
+
importer ?? null,
|
|
2477
|
+
options?.skipSelf ?? false
|
|
2478
|
+
], () => ctx.resolve(id, importer, options));
|
|
2479
|
+
}
|
|
2474
2480
|
function resolveAliasRequest(state, id) {
|
|
2475
2481
|
return resolveViteAliasRequest(id, nativeCssAliasRules(state));
|
|
2476
2482
|
}
|
|
@@ -2715,6 +2721,17 @@ function normalizeResolvedVuePath(id) {
|
|
|
2715
2721
|
}
|
|
2716
2722
|
async function resolveProjectVueRuntime(ctx, state, id, importer, isSsrRequest) {
|
|
2717
2723
|
if (isSsrRequest || !isProjectVueRuntimeRequest(id)) return null;
|
|
2724
|
+
const base = normalizeViteRequireBase(importer) ?? importer;
|
|
2725
|
+
return (await oncePerBuild(ctx, state, [
|
|
2726
|
+
"project-vue-runtime",
|
|
2727
|
+
id,
|
|
2728
|
+
base ? path.dirname(base) : null
|
|
2729
|
+
], async () => {
|
|
2730
|
+
const entry = await resolveProjectVueRuntimeFrom(ctx, state, id, importer);
|
|
2731
|
+
return entry ? { id: entry } : null;
|
|
2732
|
+
}))?.id ?? null;
|
|
2733
|
+
}
|
|
2734
|
+
async function resolveProjectVueRuntimeFrom(ctx, state, id, importer) {
|
|
2718
2735
|
if (isVuePeerRuntimeRequest(id)) {
|
|
2719
2736
|
const nuxtPeerEntry = resolveProjectNuxtVuePeerRuntimeEntryWithNode(state, id);
|
|
2720
2737
|
if (nuxtPeerEntry) {
|
|
@@ -2723,10 +2740,9 @@ async function resolveProjectVueRuntime(ctx, state, id, importer, isSsrRequest)
|
|
|
2723
2740
|
}
|
|
2724
2741
|
}
|
|
2725
2742
|
if (!isProjectLocalImporter(state, importer)) return null;
|
|
2726
|
-
const isBuild = state.server === null;
|
|
2727
2743
|
const viteImporter = normalizeViteRequireBase(importer) ?? importer;
|
|
2728
2744
|
if (isVuePeerRuntimeRequest(id)) {
|
|
2729
|
-
if (
|
|
2745
|
+
if (state.server !== null && isProjectSourceImporter(state.root, importer)) {
|
|
2730
2746
|
state.logger.log(`resolveId: deferring source Vue peer runtime ${id} to Vite optimizer`);
|
|
2731
2747
|
return null;
|
|
2732
2748
|
}
|
|
@@ -3205,9 +3221,10 @@ function loadCompiledSfcModule(state, realPath, isSsr, currentBase, needsGlobBas
|
|
|
3205
3221
|
const customElement = isPluginVueCustomElement(state.mergedOptions, realPath);
|
|
3206
3222
|
const extractCss = shouldExtractCssForRequest(state, isSsr) && !customElement;
|
|
3207
3223
|
let compiled = cache.get(realPath);
|
|
3208
|
-
|
|
3224
|
+
const source = loadOptions?.sfcSource?.file === realPath ? loadOptions.sfcSource.source : void 0;
|
|
3225
|
+
if (!compiled && (source !== void 0 || fs.existsSync(realPath))) {
|
|
3209
3226
|
state.logger.log(`load: on-demand compiling ${realPath}`);
|
|
3210
|
-
compiled = compileFile(realPath, cache, getCompileOptionsForRequest(state, isSsr, realPath),
|
|
3227
|
+
compiled = compileFile(realPath, cache, getCompileOptionsForRequest(state, isSsr, realPath), source, { logWarnings: shouldLogSfcWarnings(state, realPath) });
|
|
3211
3228
|
}
|
|
3212
3229
|
syncCollectedCssForFile({
|
|
3213
3230
|
...state,
|
|
@@ -4728,11 +4745,12 @@ function vize(options = {}, compilerDefaults = {}, hostContext) {
|
|
|
4728
4745
|
});
|
|
4729
4746
|
},
|
|
4730
4747
|
async load(id, loadOptions) {
|
|
4731
|
-
await prepareLoadSrcRequests(state, viteHostResolve((request, importer) => this.resolve(request, importer, { skipSelf: true })), id);
|
|
4748
|
+
const sfcSource = await prepareLoadSrcRequests(state, viteHostResolve((request, importer) => this.resolve(request, importer, { skipSelf: true })), id);
|
|
4732
4749
|
return loadHook(state, id, {
|
|
4733
4750
|
...loadOptions,
|
|
4734
4751
|
ssr: resolveHookSsr(this, loadOptions),
|
|
4735
|
-
addWatchFile: this.addWatchFile.bind(this)
|
|
4752
|
+
addWatchFile: this.addWatchFile.bind(this),
|
|
4753
|
+
sfcSource
|
|
4736
4754
|
});
|
|
4737
4755
|
},
|
|
4738
4756
|
async transform(code, id, transformOptions) {
|
package/dist/vite-plus.mjs
CHANGED
|
@@ -400,7 +400,7 @@ function defineConfig(config = {}, integration = {}) {
|
|
|
400
400
|
const legacy = compiler !== false && (await import("./vue-version-DOjZaMiI.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-CcTdAxZL.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.667.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.667.0",
|
|
55
|
+
"@vizejs/unplugin": "0.667.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.667.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "25.9.2",
|
package/dist/plugin-CwodSCpW.mjs
DELETED