@vizejs/vite-plugin 0.480.0 → 0.482.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,5 +1,5 @@
1
- import { t as vize } from "./plugin-DtrTTtew.mjs";
2
- import { l as rewriteStaticAssetUrls } from "./vue-version-BUu5UzZ5.mjs";
1
+ import { t as vize } from "./plugin-BvYQcGKz.mjs";
2
+ import { u as rewriteStaticAssetUrls } from "./vue-version-JgVRwvCy.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-DE1fZbgD.mjs";
4
4
  //#region src/index.ts
5
5
  const __internal = { rewriteStaticAssetUrls };
@@ -1,4 +1,4 @@
1
- import { a as applyDefineReplacements, c as rewriteImportMetaGlobBase, i as isLegacyVueVersion, l as rewriteStaticAssetUrls, o as createLogger, r as isLegacyVueCompatibilityMode, s as rewriteDynamicTemplateImports, t as createLegacyVueCompatibilityPlugin, u as shouldApplyDefineInVirtualModule } from "./vue-version-BUu5UzZ5.mjs";
1
+ import { a as removeHostVueSfcCompilers, c as rewriteDynamicTemplateImports, d as shouldApplyDefineInVirtualModule, i as isLegacyVueVersion, l as rewriteImportMetaGlobBase, o as applyDefineReplacements, r as isLegacyVueCompatibilityMode, s as createLogger, t as createLegacyVueCompatibilityPlugin, u as rewriteStaticAssetUrls } from "./vue-version-JgVRwvCy.mjs";
2
2
  import { a as resolveViteConfigExport, i as resolveConfigExport, o as vizeConfigStore, r as loadConfig } from "./config-DE1fZbgD.mjs";
3
3
  import { n as registerResolvedVizeConfig, r as unregisterResolvedVizeConfig } from "./config-bridge-Dv6U7_RC.mjs";
4
4
  import { createRequire } from "node:module";
@@ -578,8 +578,15 @@ function hasDelegatedStyles(compiled) {
578
578
  if (!compiled.styles) return false;
579
579
  return compiled.styles.some((s) => needsPreprocessor(s) || isCssModule(s) || needsCssPipeline(s));
580
580
  }
581
+ /**
582
+ * Template-only HMR swaps in `updated.render`, so the render function must be
583
+ * standalone rather than the closure an inline-template `setup` returns.
584
+ * Script setup attaches it as `render: _sfc_render` in the component literal;
585
+ * other shapes assign `_sfc_main.render = _sfc_render` (or `= render`).
586
+ */
587
+ const STANDALONE_RENDER = /(?:^|\n)(?:(?:_sfc_main|__sfc__)\.render\s*=\s*(?:_sfc_render|render)\b|\s+render:\s*_sfc_render\b)/m;
581
588
  function supportsTemplateOnlyHmr(output) {
582
- return /(?:^|\n)(?:_sfc_main|__sfc__)\.render\s*=\s*render\b/m.test(output);
589
+ return STANDALONE_RENDER.test(output);
583
590
  }
584
591
  /**
585
592
  * Prepend a runtime `<style>` injection for plain CSS to a module's output.
@@ -2064,6 +2071,133 @@ function isOptimizedVueDependency(state, id) {
2064
2071
  return normalized.includes("/node_modules/.vite/deps/vue.");
2065
2072
  }
2066
2073
  //#endregion
2074
+ //#region src/plugin/ssr-modules.ts
2075
+ /**
2076
+ * Point a compiled SSR module at the `vue/server-renderer` subpath.
2077
+ *
2078
+ * The compiler emits `@vue/server-renderer`, which is not a dependency every
2079
+ * app declares; the subpath re-export always resolves alongside `vue` itself.
2080
+ */
2081
+ function normalizeVueServerRendererImport(code) {
2082
+ return code.replace(/\bfrom\s+(['"])@vue\/server-renderer\1/g, "from \"vue/server-renderer\"");
2083
+ }
2084
+ /**
2085
+ * Marks a module whose registration has already been appended.
2086
+ *
2087
+ * Idempotency cannot key on the helper identifiers: an SFC is free to declare
2088
+ * `__vize_useSSRContext` itself, and skipping registration for it would cost it
2089
+ * its initial stylesheet.
2090
+ */
2091
+ const REGISTRATION_MARKER = "/* @vize-ssr-modules-registered */";
2092
+ /**
2093
+ * Matches the `_sfc_main` component declaration the emitted module carries.
2094
+ *
2095
+ * A bare `\b_sfc_main\b` also matches the identifier inside a string literal or
2096
+ * a comment, and wrapping a component that was never declared is a
2097
+ * `ReferenceError` at render time.
2098
+ */
2099
+ const SFC_MAIN_DECLARATION = /\b(?:const|let|var)\s+_sfc_main\s*=/;
2100
+ /**
2101
+ * Register an SFC in `ssrContext.modules` during SSR, the way
2102
+ * `@vitejs/plugin-vue` does.
2103
+ *
2104
+ * After rendering, `vue-bundle-renderer` intersects `ssrContext.modules` with
2105
+ * the client manifest to decide which stylesheets belong in the document head.
2106
+ * A component that never registers itself contributes no `<link>`, so the
2107
+ * server-rendered markup arrives unstyled and only gains its styles once the
2108
+ * route chunk loads on the client — a flash of unstyled content that never
2109
+ * recovers when JavaScript is disabled (#3868).
2110
+ *
2111
+ * The key must be the module's path relative to the Vite root with POSIX
2112
+ * separators, because that is what the client manifest is keyed on.
2113
+ */
2114
+ function ssrModuleRegistrationCode(filePath, root, helpers = {}, frameworkRoot) {
2115
+ const moduleId = JSON.stringify(frameworkRoot === void 0 ? toManifestModuleId(filePath, root) : path.relative(frameworkRoot, filePath).replace(/\\/g, "/"));
2116
+ const useSSRContext = helpers.useSSRContext ?? "__vize_useSSRContext";
2117
+ const sfcSetup = helpers.sfcSetup ?? "__vize_sfc_setup";
2118
+ return {
2119
+ prologue: `${REGISTRATION_MARKER}\nimport { useSSRContext as ${useSSRContext} } from "vue";`,
2120
+ epilogue: [
2121
+ `const ${sfcSetup} = _sfc_main.setup;`,
2122
+ `_sfc_main.setup = (props, ctx) => {`,
2123
+ ` const ssrContext = ${useSSRContext}();`,
2124
+ ` (ssrContext.modules || (ssrContext.modules = new Set())).add(${moduleId});`,
2125
+ ` return ${sfcSetup} ? ${sfcSetup}(props, ctx) : undefined;`,
2126
+ `};`
2127
+ ].join("\n")
2128
+ };
2129
+ }
2130
+ /**
2131
+ * The client-manifest key for `filePath`: relative to `root`, POSIX separators.
2132
+ *
2133
+ * A path outside the root keeps its absolute form rather than becoming a `../`
2134
+ * chain, matching how Vite keys modules it cannot root-relativize. Only a real
2135
+ * parent-directory step counts as outside: a filename that merely begins with
2136
+ * `..` still lives in the root and is keyed relative to it.
2137
+ */
2138
+ function toManifestModuleId(filePath, root) {
2139
+ const relative = path.relative(root, filePath).replace(/\\/g, "/");
2140
+ if (!relative || relative === ".." || relative.startsWith("../") || path.isAbsolute(relative)) return filePath.replace(/\\/g, "/");
2141
+ return relative;
2142
+ }
2143
+ /**
2144
+ * Wrap an emitted module with the registration.
2145
+ *
2146
+ * The wrapper is appended, so it closes over whatever `setup` the emitter's own
2147
+ * rewrites left in place, but its `import` is *prepended*. A trailing `import`
2148
+ * is legal ESM, yet it makes the module's last import statement its last line,
2149
+ * and Nuxt's auto-import injection then inserts nothing — a component relying on
2150
+ * an auto-imported composable loses that binding and throws `ReferenceError` at
2151
+ * render time (#3868). Leading the module with the import keeps the import
2152
+ * section where every downstream transform expects to find it.
2153
+ *
2154
+ * `useSSRContext()` throws outside a render, so this is a no-op unless `isSsr`.
2155
+ * Modules without an `_sfc_main` declaration — a render-function-only output, or
2156
+ * a boundary placeholder — have no component object to wrap and are returned
2157
+ * untouched.
2158
+ */
2159
+ function appendSsrModuleRegistration(code, filePath, root, isSsr, frameworkRoot) {
2160
+ if (!isSsr || !SFC_MAIN_DECLARATION.test(code)) return code;
2161
+ if (code.includes(REGISTRATION_MARKER)) return code;
2162
+ const { prologue, epilogue } = ssrModuleRegistrationCode(filePath, root, {
2163
+ useSSRContext: freeIdentifier("__vize_useSSRContext", code),
2164
+ sfcSetup: freeIdentifier("__vize_sfc_setup", code)
2165
+ }, frameworkRoot);
2166
+ return `${prologue}\n${code}\n${epilogue}`;
2167
+ }
2168
+ /**
2169
+ * `base`, or `base` plus the smallest numeric suffix the module does not use.
2170
+ *
2171
+ * Re-declaring an identifier the SFC already bound is a `SyntaxError`, which
2172
+ * would take down the whole module rather than just its stylesheet.
2173
+ */
2174
+ function freeIdentifier(base, code) {
2175
+ if (!new RegExp(`\\b${base}\\b`).test(code)) return base;
2176
+ for (let suffix = 2;; suffix++) {
2177
+ const candidate = `${base}${suffix}`;
2178
+ if (!new RegExp(`\\b${candidate}\\b`).test(code)) return candidate;
2179
+ }
2180
+ }
2181
+ /**
2182
+ * Whether the environment bundles `request` instead of loading it at runtime.
2183
+ *
2184
+ * Node SSR leaves Vue external, but a worker runtime such as Cloudflare's
2185
+ * workerd (Void, `@cloudflare/vite-plugin`) sets `noExternal: true` and has no
2186
+ * `node_modules` to import from, so Vue must stay in its bundle.
2187
+ */
2188
+ function ssrEnvironmentBundles(resolve, request) {
2189
+ const { noExternal, external } = resolve ?? {};
2190
+ const packageName = request.split("/", request.startsWith("@") ? 2 : 1).join("/");
2191
+ if (external !== true && (external?.includes(request) || external?.includes(packageName))) return false;
2192
+ if (noExternal === true) return true;
2193
+ if (noExternal === void 0) return false;
2194
+ return (Array.isArray(noExternal) ? noExternal : [noExternal]).some((pattern) => typeof pattern === "string" ? pattern === packageName : pattern.test(packageName));
2195
+ }
2196
+ /** Keep compiler/config root separate from Nuxt's source-relative manifest IDs. */
2197
+ function registerSfcModule(state, code, filePath, isSsr) {
2198
+ return appendSsrModuleRegistration(code, filePath, state.root, isSsr, state.mergedOptions.ssrModuleIdRoot);
2199
+ }
2200
+ //#endregion
2067
2201
  //#region src/plugin/tree-shaking.ts
2068
2202
  /** Template-only client output has no authored top-level script effects. */
2069
2203
  function isPureTemplateOnlyModule(compiled) {
@@ -2551,10 +2685,11 @@ async function resolveIdHook(ctx, state, id, importer, options) {
2551
2685
  return devSsrVueEntry;
2552
2686
  }
2553
2687
  }
2554
- return {
2688
+ if (!ssrEnvironmentBundles(ctx.environment?.config?.resolve, ssrExternalVueRequest)) return {
2555
2689
  id: ssrExternalVueRequest,
2556
2690
  external: true
2557
2691
  };
2692
+ return resolveWithVite(ctx, state, ssrExternalVueRequest, cleanImporter, { skipSelf: true });
2558
2693
  }
2559
2694
  if (!id.startsWith("./") && !id.startsWith("../") && !id.startsWith("/")) {
2560
2695
  const isVueRuntime = isVueRuntimeRequest(id);
@@ -2764,118 +2899,6 @@ function shouldLoadCompiledVueSfcPath(state, realPath, hasNuxtComponentQuery = f
2764
2899
  return true;
2765
2900
  }
2766
2901
  //#endregion
2767
- //#region src/plugin/ssr-modules.ts
2768
- /**
2769
- * Point a compiled SSR module at the `vue/server-renderer` subpath.
2770
- *
2771
- * The compiler emits `@vue/server-renderer`, which is not a dependency every
2772
- * app declares; the subpath re-export always resolves alongside `vue` itself.
2773
- */
2774
- function normalizeVueServerRendererImport(code) {
2775
- return code.replace(/\bfrom\s+(['"])@vue\/server-renderer\1/g, "from \"vue/server-renderer\"");
2776
- }
2777
- /**
2778
- * Marks a module whose registration has already been appended.
2779
- *
2780
- * Idempotency cannot key on the helper identifiers: an SFC is free to declare
2781
- * `__vize_useSSRContext` itself, and skipping registration for it would cost it
2782
- * its initial stylesheet.
2783
- */
2784
- const REGISTRATION_MARKER = "/* @vize-ssr-modules-registered */";
2785
- /**
2786
- * Matches the `_sfc_main` component declaration the emitted module carries.
2787
- *
2788
- * A bare `\b_sfc_main\b` also matches the identifier inside a string literal or
2789
- * a comment, and wrapping a component that was never declared is a
2790
- * `ReferenceError` at render time.
2791
- */
2792
- const SFC_MAIN_DECLARATION = /\b(?:const|let|var)\s+_sfc_main\s*=/;
2793
- /**
2794
- * Register an SFC in `ssrContext.modules` during SSR, the way
2795
- * `@vitejs/plugin-vue` does.
2796
- *
2797
- * After rendering, `vue-bundle-renderer` intersects `ssrContext.modules` with
2798
- * the client manifest to decide which stylesheets belong in the document head.
2799
- * A component that never registers itself contributes no `<link>`, so the
2800
- * server-rendered markup arrives unstyled and only gains its styles once the
2801
- * route chunk loads on the client — a flash of unstyled content that never
2802
- * recovers when JavaScript is disabled (#3868).
2803
- *
2804
- * The key must be the module's path relative to the Vite root with POSIX
2805
- * separators, because that is what the client manifest is keyed on.
2806
- */
2807
- function ssrModuleRegistrationCode(filePath, root, helpers = {}, frameworkRoot) {
2808
- const moduleId = JSON.stringify(frameworkRoot === void 0 ? toManifestModuleId(filePath, root) : path.relative(frameworkRoot, filePath).replace(/\\/g, "/"));
2809
- const useSSRContext = helpers.useSSRContext ?? "__vize_useSSRContext";
2810
- const sfcSetup = helpers.sfcSetup ?? "__vize_sfc_setup";
2811
- return {
2812
- prologue: `${REGISTRATION_MARKER}\nimport { useSSRContext as ${useSSRContext} } from "vue";`,
2813
- epilogue: [
2814
- `const ${sfcSetup} = _sfc_main.setup;`,
2815
- `_sfc_main.setup = (props, ctx) => {`,
2816
- ` const ssrContext = ${useSSRContext}();`,
2817
- ` (ssrContext.modules || (ssrContext.modules = new Set())).add(${moduleId});`,
2818
- ` return ${sfcSetup} ? ${sfcSetup}(props, ctx) : undefined;`,
2819
- `};`
2820
- ].join("\n")
2821
- };
2822
- }
2823
- /**
2824
- * The client-manifest key for `filePath`: relative to `root`, POSIX separators.
2825
- *
2826
- * A path outside the root keeps its absolute form rather than becoming a `../`
2827
- * chain, matching how Vite keys modules it cannot root-relativize. Only a real
2828
- * parent-directory step counts as outside: a filename that merely begins with
2829
- * `..` still lives in the root and is keyed relative to it.
2830
- */
2831
- function toManifestModuleId(filePath, root) {
2832
- const relative = path.relative(root, filePath).replace(/\\/g, "/");
2833
- if (!relative || relative === ".." || relative.startsWith("../") || path.isAbsolute(relative)) return filePath.replace(/\\/g, "/");
2834
- return relative;
2835
- }
2836
- /**
2837
- * Wrap an emitted module with the registration.
2838
- *
2839
- * The wrapper is appended, so it closes over whatever `setup` the emitter's own
2840
- * rewrites left in place, but its `import` is *prepended*. A trailing `import`
2841
- * is legal ESM, yet it makes the module's last import statement its last line,
2842
- * and Nuxt's auto-import injection then inserts nothing — a component relying on
2843
- * an auto-imported composable loses that binding and throws `ReferenceError` at
2844
- * render time (#3868). Leading the module with the import keeps the import
2845
- * section where every downstream transform expects to find it.
2846
- *
2847
- * `useSSRContext()` throws outside a render, so this is a no-op unless `isSsr`.
2848
- * Modules without an `_sfc_main` declaration — a render-function-only output, or
2849
- * a boundary placeholder — have no component object to wrap and are returned
2850
- * untouched.
2851
- */
2852
- function appendSsrModuleRegistration(code, filePath, root, isSsr, frameworkRoot) {
2853
- if (!isSsr || !SFC_MAIN_DECLARATION.test(code)) return code;
2854
- if (code.includes(REGISTRATION_MARKER)) return code;
2855
- const { prologue, epilogue } = ssrModuleRegistrationCode(filePath, root, {
2856
- useSSRContext: freeIdentifier("__vize_useSSRContext", code),
2857
- sfcSetup: freeIdentifier("__vize_sfc_setup", code)
2858
- }, frameworkRoot);
2859
- return `${prologue}\n${code}\n${epilogue}`;
2860
- }
2861
- /**
2862
- * `base`, or `base` plus the smallest numeric suffix the module does not use.
2863
- *
2864
- * Re-declaring an identifier the SFC already bound is a `SyntaxError`, which
2865
- * would take down the whole module rather than just its stylesheet.
2866
- */
2867
- function freeIdentifier(base, code) {
2868
- if (!new RegExp(`\\b${base}\\b`).test(code)) return base;
2869
- for (let suffix = 2;; suffix++) {
2870
- const candidate = `${base}${suffix}`;
2871
- if (!new RegExp(`\\b${candidate}\\b`).test(code)) return candidate;
2872
- }
2873
- }
2874
- /** Keep compiler/config root separate from Nuxt's source-relative manifest IDs. */
2875
- function registerSfcModule(state, code, filePath, isSsr) {
2876
- return appendSsrModuleRegistration(code, filePath, state.root, isSsr, state.mergedOptions.ssrModuleIdRoot);
2877
- }
2878
- //#endregion
2879
2902
  //#region src/plugin/vite-transform.ts
2880
2903
  function createVirtualTypeScriptTransformer(viteApi) {
2881
2904
  return async (code, id) => {
@@ -3434,6 +3457,84 @@ async function handleHotUpdateEnvironmentHook(state, environment, options) {
3434
3457
  return modules;
3435
3458
  }
3436
3459
  //#endregion
3460
+ //#region src/plugin/manifest.ts
3461
+ /** The query `toPluginVisibleVirtualId` gives a main SFC module. */
3462
+ const MAIN_SFC_QUERY = "?vue&vize";
3463
+ function sourceIdentity(key) {
3464
+ const query = key.indexOf("?");
3465
+ if (query < 0 || key.slice(query) !== MAIN_SFC_QUERY) return null;
3466
+ const source = key.slice(0, query);
3467
+ return source.endsWith(".vue") ? source : null;
3468
+ }
3469
+ /**
3470
+ * Key a Vite build manifest by SFC source path, as `@vitejs/plugin-vue` does.
3471
+ *
3472
+ * Vize's main SFC modules carry `?vue&vize`, so Vite keys their chunks
3473
+ * `pages/index.vue?vue&vize`. Servers that look up a route's CSS and preloads
3474
+ * by its source file (Void, Vite SSR setups) would miss them.
3475
+ */
3476
+ function restoreManifestSourceIds(manifest) {
3477
+ const identities = /* @__PURE__ */ new Map();
3478
+ for (const [key, entry] of Object.entries(manifest)) {
3479
+ const source = sourceIdentity(key);
3480
+ if (!source || entry.src !== key || Object.hasOwn(manifest, source)) continue;
3481
+ identities.set(key, source);
3482
+ }
3483
+ if (identities.size === 0) return false;
3484
+ for (const [key, entry] of Object.entries(manifest)) {
3485
+ const source = identities.get(key);
3486
+ if (source) {
3487
+ delete manifest[key];
3488
+ manifest[source] = entry;
3489
+ entry.src = source;
3490
+ }
3491
+ for (const field of ["imports", "dynamicImports"]) {
3492
+ const references = entry[field];
3493
+ if (references?.some((reference) => identities.has(reference))) entry[field] = references.map((reference) => identities.get(reference) ?? reference);
3494
+ }
3495
+ }
3496
+ return true;
3497
+ }
3498
+ /** Same for `build.ssrManifest`, whose keys are module IDs. */
3499
+ function restoreSsrManifestSourceIds(manifest) {
3500
+ let changed = false;
3501
+ for (const key of Object.keys(manifest)) {
3502
+ const source = sourceIdentity(key);
3503
+ if (!source || Object.hasOwn(manifest, source)) continue;
3504
+ manifest[source] = manifest[key];
3505
+ delete manifest[key];
3506
+ changed = true;
3507
+ }
3508
+ return changed;
3509
+ }
3510
+ function manifestFileName(option, fallback) {
3511
+ if (!option) return null;
3512
+ return typeof option === "string" ? option : fallback;
3513
+ }
3514
+ function rewriteAsset(bundle, fileName, restore) {
3515
+ const asset = fileName ? bundle[fileName] : void 0;
3516
+ if (asset?.type !== "asset" || asset.source === void 0) return;
3517
+ const text = typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source);
3518
+ const manifest = JSON.parse(text);
3519
+ if (restore(manifest)) asset.source = JSON.stringify(manifest, null, 2);
3520
+ }
3521
+ function createManifestPlugin() {
3522
+ return {
3523
+ name: "vite-plugin-vize:manifest",
3524
+ apply: "build",
3525
+ generateBundle: {
3526
+ order: "post",
3527
+ handler(_, bundle) {
3528
+ const build = this.environment?.config.build;
3529
+ if (!build) return;
3530
+ const assets = bundle;
3531
+ rewriteAsset(assets, manifestFileName(build.manifest, ".vite/manifest.json"), restoreManifestSourceIds);
3532
+ rewriteAsset(assets, manifestFileName(build.ssrManifest, ".vite/ssr-manifest.json"), restoreSsrManifestSourceIds);
3533
+ }
3534
+ }
3535
+ };
3536
+ }
3537
+ //#endregion
3437
3538
  //#region src/plugin/compat.ts
3438
3539
  /**
3439
3540
  * The `vite:vue` shim a host framework probes for a Vue plugin.
@@ -4327,6 +4428,8 @@ function vize(options = {}, compilerDefaults = {}, hostContext) {
4327
4428
  const sharedConfigPromise = resolveSharedConfig(options, state.root, configEnv, state.logger, resolvedConfig, hostContext);
4328
4429
  const sharedConfig = await register(resolvedConfig, state.root, sharedConfigPromise);
4329
4430
  state.mergedOptions = mergeCompilerOptions(options, sharedConfig, compilerDefaults);
4431
+ const replaced = removeHostVueSfcCompilers(resolvedConfig.plugins, state.mergedOptions);
4432
+ if (replaced > 0) state.logger.log(`Replaced ${replaced} @vitejs/plugin-vue instance(s) with Vize.`);
4330
4433
  state.fileCompilerOptions = createFileCompilerOptions(sharedConfig, state.root, options, compilerDefaults);
4331
4434
  state.compilerScopeIdentity = sharedConfig?.entries;
4332
4435
  state.dynamicImportAliasRules = [];
@@ -4419,7 +4522,8 @@ function vize(options = {}, compilerDefaults = {}, hostContext) {
4419
4522
  }
4420
4523
  },
4421
4524
  createStylePostTransformPlugin(),
4422
- createPostTransformPlugin(state)
4525
+ createPostTransformPlugin(state),
4526
+ ...hostContext === "nuxt" ? [] : [createManifestPlugin()]
4423
4527
  ];
4424
4528
  }
4425
4529
  //#endregion
@@ -0,0 +1,2 @@
1
+ import { t as vize } from "./plugin-BvYQcGKz.mjs";
2
+ export { vize };
@@ -303,10 +303,10 @@ function defineConfig(config = {}, integration = {}) {
303
303
  const source = await resolveConfig(config, env);
304
304
  const { vp, metadata, compiler } = normalizeConfig(source, integration);
305
305
  const { options } = metadata;
306
- const legacy = compiler !== false && (await import("./vue-version-DGtIj1Bv.mjs")).isLegacyVueCompatibilityMode(compiler);
306
+ const legacy = compiler !== false && (await import("./vue-version-C75M7lgZ.mjs")).isLegacyVueCompatibilityMode(compiler);
307
307
  const plugins = compiler === false || legacy ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
308
308
  if (compiler !== false) {
309
- const { vize } = await import("./plugin-VGQR_WGT.mjs");
309
+ const { vize } = await import("./plugin-t5V0g-uQ.mjs");
310
310
  plugins.push(vize({
311
311
  ...compiler,
312
312
  configMode: false,
@@ -1,2 +1,2 @@
1
- import { r as isLegacyVueCompatibilityMode } from "./vue-version-BUu5UzZ5.mjs";
1
+ import { r as isLegacyVueCompatibilityMode } from "./vue-version-JgVRwvCy.mjs";
2
2
  export { isLegacyVueCompatibilityMode };
@@ -71,5 +71,23 @@ function createLegacyVueCompatibilityPlugin(options) {
71
71
  }
72
72
  };
73
73
  }
74
+ /**
75
+ * Remove `@vitejs/plugin-vue` instances that sit beside Vize, such as the one a
76
+ * framework adapter bundles (`@void/vue`'s `voidVue()`), so one compiler owns
77
+ * each `.vue` module. Vize's own `vite:vue` shim has no compiler hooks and stays.
78
+ * An explicit `exclude` keeps the host compiler for the SFCs Vize skips.
79
+ */
80
+ function removeHostVueSfcCompilers(plugins, options) {
81
+ if (options.exclude !== void 0) return 0;
82
+ let removed = 0;
83
+ for (let index = plugins.length - 1; index >= 0; index--) {
84
+ const plugin = plugins[index];
85
+ if (plugin.name === "vite:vue" && (plugin.transform || plugin.load)) {
86
+ plugins.splice(index, 1);
87
+ removed++;
88
+ }
89
+ }
90
+ return removed;
91
+ }
74
92
  //#endregion
75
- export { applyDefineReplacements as a, rewriteImportMetaGlobBase as c, isLegacyVueVersion as i, rewriteStaticAssetUrls as l, hasHostVueSfcCompilerPlugin as n, createLogger as o, isLegacyVueCompatibilityMode as r, rewriteDynamicTemplateImports as s, createLegacyVueCompatibilityPlugin as t, shouldApplyDefineInVirtualModule as u };
93
+ export { removeHostVueSfcCompilers as a, rewriteDynamicTemplateImports as c, shouldApplyDefineInVirtualModule as d, isLegacyVueVersion as i, rewriteImportMetaGlobBase as l, hasHostVueSfcCompilerPlugin as n, applyDefineReplacements as o, isLegacyVueCompatibilityMode as r, createLogger as s, createLegacyVueCompatibilityPlugin as t, rewriteStaticAssetUrls as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.480.0",
3
+ "version": "0.482.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.480.0",
55
- "@vizejs/unplugin": "0.480.0",
54
+ "@vizejs/native": "0.482.0",
55
+ "@vizejs/unplugin": "0.482.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.480.0"
60
+ "vize": "0.482.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "25.9.2",
@@ -1,2 +0,0 @@
1
- import { t as vize } from "./plugin-DtrTTtew.mjs";
2
- export { vize };