@vizejs/vite-plugin 0.428.1 → 0.429.1

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 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-BSmJ5UMW.mjs";
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-CwtUr1uY.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-CkmrBDhz.mjs";
1
+ import { n as rewriteStaticAssetUrls, t as vize } from "./plugin-DfwtlJyA.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 };
@@ -1,4 +1,4 @@
1
- import { f as ResolvedVizeConfig } from "../types-BSmJ5UMW.mjs";
1
+ import { f as ResolvedVizeConfig } from "../types-CwtUr1uY.mjs";
2
2
  import { ResolvedConfig } from "vite";
3
3
 
4
4
  //#region src/internal/config-bridge.d.ts
@@ -0,0 +1,2 @@
1
+ import { t as vize } from "./plugin-DfwtlJyA.mjs";
2
+ export { vize };
@@ -232,7 +232,7 @@ function insertBeforeSfcMainDefaultExport(code, insertion, options = {}) {
232
232
  return `${code.slice(0, exportStart)}${insertion}\n${code.slice(exportStart)}`;
233
233
  }
234
234
  //#endregion
235
- //#region src/utils/source-map.ts
235
+ //#region ../shared/source-map.ts
236
236
  function isSourceMapV3(value) {
237
237
  if (value === null || typeof value !== "object") return false;
238
238
  const map = value;
@@ -279,6 +279,59 @@ function shiftMappedLines(map, atLine, count) {
279
279
  mappings: shifted.join(";")
280
280
  };
281
281
  }
282
+ /** Prefix a native JSX module with unmapped generated whole lines.
283
+ * The actual style injection supplies the prefix; authored UTF-16 columns are
284
+ * unchanged because the module resumes at column zero on a new generated line.
285
+ */
286
+ function prependMappedJsxCode(code, mapJson, prefix) {
287
+ const output = prefix + code;
288
+ if (!prefix) return {
289
+ code: output,
290
+ map: mapJson ?? null
291
+ };
292
+ const map = parseSourceMap(mapJson);
293
+ if (!map || !prefix.endsWith("\n")) return {
294
+ code: output,
295
+ map: null
296
+ };
297
+ return {
298
+ code: output,
299
+ map: JSON.stringify(shiftMappedLines(map, 0, countNewlines(prefix)))
300
+ };
301
+ }
302
+ //#endregion
303
+ //#region src/utils/source-map.ts
304
+ /**
305
+ * Keeping the compiler's Source Map v3 document valid through the edits
306
+ * `generateOutput` makes to the emitted module (#3399).
307
+ *
308
+ * The native compiler returns a map for the module it emitted. `generateOutput`
309
+ * then rewrites that module: it prepends a `<style>` injection, splices style
310
+ * imports in after the last static import, inserts CSS-module wiring before the
311
+ * default export, rewrites `export default` to `const _sfc_main =`, and appends
312
+ * `__scopeId`/HMR code. All of those are whole-line insertions or same-line
313
+ * substitutions, which is exactly the class of edit a v3 `mappings` string can
314
+ * absorb without being decoded:
315
+ *
316
+ * - Lines are separated by `;` and each line's segments by `,`.
317
+ * - A segment's generated column is relative to the previous segment **on the
318
+ * same line** and resets at every line, so an inserted line never disturbs the
319
+ * columns after it.
320
+ * - The source index/line/column fields are relative to the previous *segment*,
321
+ * not the previous line, so inserting empty lines between segments leaves
322
+ * every delta untouched.
323
+ *
324
+ * Shifting generated lines is therefore literally inserting `;` characters, with
325
+ * no VLQ decoding and no chance of a rounding error.
326
+ *
327
+ * Rather than have every call site declare where its edit landed — which would
328
+ * silently rot the first time an edit moves — {@link MappedModule.edit} derives
329
+ * it from the two strings: the common prefix and suffix bound the changed span
330
+ * exactly, and the change in newline count inside that span is the line shift.
331
+ * A same-line substitution comes out as a zero shift (columns within a line are
332
+ * not tracked; a frame still resolves to the right authored line), and an edit
333
+ * that *removes* lines drops the map rather than emit one that is wrong.
334
+ */
282
335
  /**
283
336
  * A module's code and the map that describes it, edited together.
284
337
  *
@@ -315,6 +368,31 @@ var MappedModule = class {
315
368
  }
316
369
  };
317
370
  //#endregion
371
+ //#region src/plugin/style-request.ts
372
+ const STYLE_MARKER = ".__vize_style_";
373
+ /** Keep the CSS extension in the path, outside Vue/Nuxt's query metadata. */
374
+ function createStyleVirtualId(id) {
375
+ const start = id.indexOf("?");
376
+ const filename = id.slice(0, start);
377
+ const params = new URLSearchParams(id.slice(start + 1));
378
+ if (params.has("vize-file") && filename.includes(STYLE_MARKER)) return `${params.get("vize-file") ?? ""}${filename.slice(filename.lastIndexOf(STYLE_MARKER))}?${id.slice(start + 1).replaceAll(".", "%2E")}`;
379
+ const index = params.get("index") ?? "0";
380
+ const lang = params.get("lang") || "css";
381
+ const suffix = params.has("module") ? `.module.${lang}` : `.${lang}`;
382
+ const source = params.has("vize-file") ? "" : `&${new URLSearchParams({ "vize-file": filename }).toString().replaceAll(".", "%2E")}`;
383
+ return `${filename}${STYLE_MARKER}${index}${suffix}?${(id.slice(start + 1) + source).replaceAll(".", "%2E")}`;
384
+ }
385
+ /** Recover the authored SFC before native classification and cache lookup. */
386
+ function normalizeStyleVirtualId(id) {
387
+ const withoutPrefix = id.startsWith("\0") ? id.slice(1) : id;
388
+ if (!withoutPrefix.includes("?vue")) return id;
389
+ const start = withoutPrefix.indexOf("?");
390
+ const query = withoutPrefix.slice(start + 1);
391
+ const source = new URLSearchParams(query).get("vize-file");
392
+ if (source && withoutPrefix.slice(0, start).includes(STYLE_MARKER)) return `${source}?${query}`;
393
+ return withoutPrefix.replace(/\.module\.\w+$/, "").replace(/\.\w+$/, "");
394
+ }
395
+ //#endregion
318
396
  //#region src/utils/css.ts
319
397
  function scopeCssForPipeline(css, scopeId) {
320
398
  return scopeViteCssForPipeline(css, scopeId);
@@ -450,12 +528,8 @@ function isCssModule(block) {
450
528
  function needsCssPipeline(block) {
451
529
  return block.content.includes("@apply");
452
530
  }
453
- function styleVirtualSuffix(block) {
454
- const lang = block.lang ?? "css";
455
- return block.module !== false ? `.module.${lang}` : `.${lang}`;
456
- }
457
- function createStyleImportUrl(filePath, params, block) {
458
- return `${filePath}?${params.toString()}${styleVirtualSuffix(block)}`;
531
+ function createStyleImportUrl(filePath, params) {
532
+ return createStyleVirtualId(`${filePath}?${params.toString()}`);
459
533
  }
460
534
  /**
461
535
  * Check if any style blocks in the compiled module require delegation to
@@ -586,16 +660,16 @@ function generateOutputWithMap(compiled, options) {
586
660
  if (isCssModule(block)) throw new Error("<style module> is not supported in custom element mode");
587
661
  params.set("inline", "");
588
662
  const bindingName = `_style_${block.index}`;
589
- const importUrl = createStyleImportUrl(filePath, params, block);
663
+ const importUrl = createStyleImportUrl(filePath, params);
590
664
  styleImports.push(`import ${bindingName} from ${JSON.stringify(importUrl)};`);
591
665
  customElementStyleBindings.push(bindingName);
592
666
  } else if (isCssModule(block)) {
593
667
  const bindingName = typeof block.module === "string" ? block.module : "$style";
594
668
  params.set("module", typeof block.module === "string" ? block.module : "");
595
- const importUrl = createStyleImportUrl(filePath, params, block);
669
+ const importUrl = createStyleImportUrl(filePath, params);
596
670
  cssModuleImports.push(`import ${bindingName} from ${JSON.stringify(importUrl)};`);
597
671
  } else {
598
- const importUrl = createStyleImportUrl(filePath, params, block);
672
+ const importUrl = createStyleImportUrl(filePath, params);
599
673
  styleImports.push(`import ${JSON.stringify(importUrl)};`);
600
674
  }
601
675
  }
@@ -636,26 +710,26 @@ function isVizeSsrVirtual(id) {
636
710
  function toVirtualId(realPath, ssr = false) {
637
711
  return createViteVirtualId(realPath, ssr);
638
712
  }
639
- function toPluginVisibleVirtualId(realPath, ssr = false, querySuffix = "") {
713
+ function toPluginVisibleVirtualId(realPath, _ssr = false, querySuffix = "") {
640
714
  const params = new URLSearchParams(querySuffix.startsWith("?") ? querySuffix.slice(1) : "");
641
715
  params.delete("vue");
642
716
  params.delete("vize");
643
717
  params.delete("vize-ssr");
644
718
  const rest = params.toString();
645
- return `${realPath}.ts?vue&${ssr ? "vize-ssr" : "vize"}${rest ? `&${rest}` : ""}`;
719
+ return `${realPath}?vue&vize${rest ? `&${rest}` : ""}`;
646
720
  }
647
721
  /**
648
722
  * String pre-gate for {@link fromPluginVisibleVirtualId}, so ordinary module IDs
649
723
  * never cross the native boundary (#3427).
650
724
  *
651
- * A non-null result requires `request.path` to end with `.vue.ts` or `.vue.tsx`
725
+ * A non-null result requires `request.path` to end with `.vue`, `.vue.ts` or `.vue.tsx`
652
726
  * and `request.querySuffix` to be non-empty. `request.path` is `id` up to the
653
727
  * first `?` and `querySuffix` is non-empty exactly when that `?` exists, so both
654
728
  * conditions imply these two substring tests. The tests are strictly weaker, so
655
729
  * everything the old code accepted still reaches the classifier.
656
730
  */
657
731
  function mayBePluginVisibleVirtualId(id) {
658
- return !id.startsWith("\0") && id.includes(".vue.ts") && id.includes("?");
732
+ return !id.startsWith("\0") && id.includes(".vue") && id.includes("?");
659
733
  }
660
734
  function fromPluginVisibleVirtualId(id) {
661
735
  if (!mayBePluginVisibleVirtualId(id)) return null;
@@ -679,7 +753,7 @@ function stripFsPrefix(path) {
679
753
  return path.startsWith("/@fs") ? path.slice(4) : path;
680
754
  }
681
755
  function isPluginVisibleVueVirtualPath(path) {
682
- return path.endsWith(".vue.ts") || path.endsWith(".vue.tsx");
756
+ return path.endsWith(".vue") || path.endsWith(".vue.ts") || path.endsWith(".vue.tsx");
683
757
  }
684
758
  function stripPluginVisibleVueVirtualSuffix(path) {
685
759
  if (path.endsWith(".vue.tsx")) return path.slice(0, -4);
@@ -1156,8 +1230,7 @@ function compileJsxModule(filePath, source, options = {}) {
1156
1230
  let map = result.map ?? null;
1157
1231
  if (css && !options.ssr) {
1158
1232
  const styleKey = result.scopedStyles[0].scopeId.replace(/^data-v-/, "");
1159
- code = prependInlineStyleInjection(code, css, styleKey);
1160
- map = null;
1233
+ ({code, map} = prependMappedJsxCode(code, map, prependInlineStyleInjection("", css, styleKey)));
1161
1234
  }
1162
1235
  return {
1163
1236
  code,
@@ -2320,7 +2393,7 @@ function nativeCssAliasRules(state) {
2320
2393
  return state.cssAliasRules.length === 0 ? EMPTY_NATIVE_ALIAS_RULES : state.cssAliasRules.map(toNativeCssAliasRule);
2321
2394
  }
2322
2395
  function isPotentialVizeResolveId(id) {
2323
- return id.startsWith("\0") || id.startsWith("vize:") || id.startsWith("/@fs") || isProjectVueRuntimeRequest(id) || id === "virtual:vize-styles" || id.endsWith(".vue") || id.includes(".vue?") || /\.vue\.tsx?\?/.test(id) || id.includes("?macro=true") || id.includes("?definePage");
2396
+ return id.startsWith("\0") || id.startsWith("vize:") || id.startsWith("/@fs") || isProjectVueRuntimeRequest(id) || id === "virtual:vize-styles" || id.endsWith(".vue") || /\.vue(?:\?|\.__vize_style_)/.test(id) || /\.vue\.tsx?\?/.test(id) || id.includes("?macro=true") || id.includes("?definePage");
2324
2397
  }
2325
2398
  function classifyImporterRequest(importer) {
2326
2399
  return importer ? classifyVitePluginRequest(importer) : null;
@@ -2426,7 +2499,7 @@ async function resolveIdHook(ctx, state, id, importer, options) {
2426
2499
  state.logger.log(`resolveId: skipping vitepress-plugin-llms style import ${id}`);
2427
2500
  return null;
2428
2501
  }
2429
- return `${request.normalizedFsId ?? id}${request.styleVirtualSuffix}`;
2502
+ return createStyleVirtualId(request.normalizedFsId ?? id);
2430
2503
  }
2431
2504
  if (isBuild && request.normalizedFsId) return request.normalizedFsId;
2432
2505
  const isMacroImporter = importerRequest?.isMacroVirtualId ?? false;
@@ -2707,8 +2780,8 @@ const SFC_MAIN_DECLARATION = /\b(?:const|let|var)\s+_sfc_main\s*=/;
2707
2780
  * The key must be the module's path relative to the Vite root with POSIX
2708
2781
  * separators, because that is what the client manifest is keyed on.
2709
2782
  */
2710
- function ssrModuleRegistrationCode(filePath, root, helpers = {}) {
2711
- const moduleId = JSON.stringify(toManifestModuleId(filePath, root));
2783
+ function ssrModuleRegistrationCode(filePath, root, helpers = {}, frameworkRoot) {
2784
+ const moduleId = JSON.stringify(frameworkRoot === void 0 ? toManifestModuleId(filePath, root) : path.relative(frameworkRoot, filePath).replace(/\\/g, "/"));
2712
2785
  const useSSRContext = helpers.useSSRContext ?? "__vize_useSSRContext";
2713
2786
  const sfcSetup = helpers.sfcSetup ?? "__vize_sfc_setup";
2714
2787
  return {
@@ -2752,13 +2825,13 @@ function toManifestModuleId(filePath, root) {
2752
2825
  * a boundary placeholder — have no component object to wrap and are returned
2753
2826
  * untouched.
2754
2827
  */
2755
- function appendSsrModuleRegistration(code, filePath, root, isSsr) {
2828
+ function appendSsrModuleRegistration(code, filePath, root, isSsr, frameworkRoot) {
2756
2829
  if (!isSsr || !SFC_MAIN_DECLARATION.test(code)) return code;
2757
2830
  if (code.includes(REGISTRATION_MARKER)) return code;
2758
2831
  const { prologue, epilogue } = ssrModuleRegistrationCode(filePath, root, {
2759
2832
  useSSRContext: freeIdentifier("__vize_useSSRContext", code),
2760
2833
  sfcSetup: freeIdentifier("__vize_sfc_setup", code)
2761
- });
2834
+ }, frameworkRoot);
2762
2835
  return `${prologue}\n${code}\n${epilogue}`;
2763
2836
  }
2764
2837
  /**
@@ -2774,6 +2847,10 @@ function freeIdentifier(base, code) {
2774
2847
  if (!new RegExp(`\\b${candidate}\\b`).test(code)) return candidate;
2775
2848
  }
2776
2849
  }
2850
+ /** Keep compiler/config root separate from Nuxt's source-relative manifest IDs. */
2851
+ function registerSfcModule(state, code, filePath, isSsr) {
2852
+ return appendSsrModuleRegistration(code, filePath, state.root, isSsr, state.mergedOptions.ssrModuleIdRoot);
2853
+ }
2777
2854
  //#endregion
2778
2855
  //#region src/plugin/vite-transform.ts
2779
2856
  function createVirtualTypeScriptTransformer(viteApi) {
@@ -2851,10 +2928,12 @@ async function transformVizeVirtualModule(state, code, realPath, ssr, forceTypeS
2851
2928
  }
2852
2929
  //#endregion
2853
2930
  //#region src/plugin/load-style.ts
2854
- function normalizeStyleVirtualId(id) {
2855
- const withoutPrefix = id.startsWith("\0") ? id.slice(1) : id;
2856
- if (!withoutPrefix.includes("?vue")) return id;
2857
- return withoutPrefix.replace(/\.module\.\w+$/, "").replace(/\.\w+$/, "");
2931
+ /** Nuxt can load an emitted CSS entry before loading its owning SFC. */
2932
+ function getCompiledStyleSource(state, realPath, ssr) {
2933
+ const cache = getEnvironmentCache(state, ssr);
2934
+ const compiled = cache.get(realPath) ?? state.cache.get(realPath) ?? state.ssrCache.get(realPath);
2935
+ if (compiled || !shouldLoadCompiledVueSfcPath(state, realPath) || !fs.existsSync(realPath)) return compiled;
2936
+ return compileFile(realPath, cache, getCompileOptionsForRequest(state, ssr));
2858
2937
  }
2859
2938
  //#endregion
2860
2939
  //#region src/plugin/load.ts
@@ -2929,7 +3008,7 @@ function loadCompiledSfcModule(state, realPath, isSsr, currentBase, loadOptions)
2929
3008
  rewritten.edit(rewriteDynamicTemplateImports(rewritten.code, state.dynamicImportAliasRules));
2930
3009
  rewritten.edit(rewriteStaticAssetUrls(rewritten.code, state.dynamicImportAliasRules));
2931
3010
  rewritten.edit(rewriteImportMetaGlobBase(rewritten.code, realPath, state.root));
2932
- rewritten.edit(appendSsrModuleRegistration(rewritten.code, realPath, state.root, isSsr));
3011
+ rewritten.edit(registerSfcModule(state, rewritten.code, realPath, isSsr));
2933
3012
  return {
2934
3013
  code: rewritten.code,
2935
3014
  map: rewritten.map
@@ -2965,7 +3044,7 @@ function loadHook(state, id, loadOptions) {
2965
3044
  const realPath = sourceRequest.vizeVirtualPath ?? sourceRequest.normalizedFsId ?? sourceRequest.normalizedVuePath ?? styleRequest.path;
2966
3045
  const lang = styleRequest.styleLang ?? null;
2967
3046
  const scoped = styleRequest.styleScoped ?? null;
2968
- const fallbackCompiled = loadOptions?.ssr ? state.ssrCache.get(realPath) ?? state.cache.get(realPath) : state.cache.get(realPath) ?? state.ssrCache.get(realPath);
3047
+ const fallbackCompiled = getCompiledStyleSource(state, realPath, !!loadOptions?.ssr);
2969
3048
  const blockIndex = styleRequest.styleIndex ?? -1;
2970
3049
  if (fallbackCompiled?.styles && blockIndex >= 0 && blockIndex < fallbackCompiled.styles.length) {
2971
3050
  const block = fallbackCompiled.styles[blockIndex];
@@ -3068,7 +3147,7 @@ function transformJsxRequest(state, code, id, options) {
3068
3147
  };
3069
3148
  }
3070
3149
  async function transformHook(state, code, id, options) {
3071
- if (!id.startsWith("\0") && !id.includes(".vue.ts") && !isJsxComponentPath(id)) return null;
3150
+ if (!id.startsWith("\0") && !id.includes(".vue") && !isJsxComponentPath(id)) return null;
3072
3151
  const pluginVisibleVirtualPath = fromPluginVisibleVirtualId(id);
3073
3152
  const jsxResult = transformJsxRequest(state, code, id, { ssr: options?.ssr });
3074
3153
  if (jsxResult !== void 0) return jsxResult;
@@ -3094,7 +3173,10 @@ function getVueModuleFileCandidates(vueFile) {
3094
3173
  toVirtualId(vueFile, true),
3095
3174
  toPluginVisibleVirtualId(vueFile, true),
3096
3175
  toPluginVisibleVirtualId(vueFile).split("?")[0],
3097
- vueFile
3176
+ vueFile,
3177
+ `${vueFile}.ts`,
3178
+ `${vueFile}.ts?vue&vize`,
3179
+ `${vueFile}.ts?vue&vize-ssr`
3098
3180
  ];
3099
3181
  const viteFsCandidates = candidates.flatMap((candidate) => {
3100
3182
  const viteFsId = toViteFsFileId(candidate);
@@ -3103,7 +3185,11 @@ function getVueModuleFileCandidates(vueFile) {
3103
3185
  return unique([...candidates, ...viteFsCandidates]);
3104
3186
  }
3105
3187
  function getStyleModuleFileCandidates(styleId) {
3106
- return unique([styleId, `${styleId}.css`]);
3188
+ return unique([
3189
+ styleId,
3190
+ `${styleId}.css`,
3191
+ createStyleVirtualId(styleId)
3192
+ ]);
3107
3193
  }
3108
3194
  async function collectModulesByFile(server, fileIds) {
3109
3195
  const modules = /* @__PURE__ */ new Set();
@@ -3370,11 +3456,6 @@ function createVueCompatPlugin(state, options) {
3370
3456
  }
3371
3457
  };
3372
3458
  }
3373
- function normalizeVirtualStyleId(id) {
3374
- const withoutPrefix = id.startsWith("\0") ? id.slice(1) : id;
3375
- if (!withoutPrefix.includes("?vue")) return id;
3376
- return withoutPrefix.replace(/\.module\.\w+$/, "").replace(/\.\w+$/, "");
3377
- }
3378
3459
  /**
3379
3460
  * String pre-gate for {@link transformScopedPreprocessorCss} (#3427).
3380
3461
  *
@@ -3383,15 +3464,15 @@ function normalizeVirtualStyleId(id) {
3383
3464
  * not a style query. The native `isVueStyleQuery` is
3384
3465
  * `query.contains("vue&type=style") || query.contains("vue=&type=style")`, both
3385
3466
  * of which contain `type=style`; the query is a substring of the id, and
3386
- * `normalizeVirtualStyleId` only ever deletes characters, so a normalized id
3387
- * that classifies as a style query implies `type=style` in the raw id.
3467
+ * `normalizeVirtualStyleId` preserves the query, so a normalized style id
3468
+ * implies `type=style` in the raw id.
3388
3469
  */
3389
3470
  function mayBeVueStyleQuery(id) {
3390
3471
  return id.includes("type=style");
3391
3472
  }
3392
3473
  function transformScopedPreprocessorCss(code, id) {
3393
3474
  if (!mayBeVueStyleQuery(id)) return null;
3394
- const request = classifyVitePluginRequest(normalizeVirtualStyleId(id));
3475
+ const request = classifyVitePluginRequest(normalizeStyleVirtualId(id));
3395
3476
  if (!request.isVueStyleQuery || !request.styleScoped || !request.styleLang || request.styleLang === "css") return null;
3396
3477
  return scopeCssForPipeline(code, request.styleScoped);
3397
3478
  }
@@ -3939,6 +4020,10 @@ function resolveCompatibilityOptions(options, compilerConfig = {}) {
3939
4020
  function aliasSortKey(find) {
3940
4021
  return typeof find === "string" ? find.length : find.source.length;
3941
4022
  }
4023
+ /** Vite 8 supplies SSR identity through the environment instead of hook arguments. */
4024
+ function resolveHookSsr(context, options) {
4025
+ return options?.ssr ?? (context.environment?.name === "ssr" || context.environment?.name === "server");
4026
+ }
3942
4027
  //#endregion
3943
4028
  //#region src/plugin/index.ts
3944
4029
  function vize(options = {}) {
@@ -4083,16 +4168,23 @@ function vize(options = {}) {
4083
4168
  state.logger.log("Cache keys:", [...state.cache.keys()].slice(0, 3));
4084
4169
  },
4085
4170
  resolveId(id, importer, options) {
4086
- return resolveIdHook(this, state, id, importer, options);
4171
+ return resolveIdHook(this, state, id, importer, {
4172
+ ...options,
4173
+ ssr: resolveHookSsr(this, options)
4174
+ });
4087
4175
  },
4088
4176
  load(id, loadOptions) {
4089
4177
  return loadHook(state, id, {
4090
4178
  ...loadOptions,
4179
+ ssr: resolveHookSsr(this, loadOptions),
4091
4180
  addWatchFile: this.addWatchFile.bind(this)
4092
4181
  });
4093
4182
  },
4094
4183
  async transform(code, id, transformOptions) {
4095
- return transformHook(state, code, id, transformOptions);
4184
+ return transformHook(state, code, id, {
4185
+ ...transformOptions,
4186
+ ssr: resolveHookSsr(this, transformOptions)
4187
+ });
4096
4188
  },
4097
4189
  async hotUpdate(options) {
4098
4190
  return handleHotUpdateEnvironmentHook(state, this.environment, options);
@@ -1158,11 +1158,10 @@ interface VizeOptions extends ExperimentalPluginOptions {
1158
1158
  templateSyntax?: "standard" | "strict" | "quirks";
1159
1159
  /** Vue whitespace strategy, or Vize's narrow Vue 2 line-break migration mode. @default "condense" */
1160
1160
  whitespace?: "condense" | "preserve" | "vue2-line-breaks";
1161
- /**
1162
- * Root directory to scan for .vue files
1163
- * @default Vite's root
1164
- */
1161
+ /** Root directory to scan for .vue files; defaults to Vite's root. */
1165
1162
  root?: string;
1163
+ /** Framework manifest root; registers relative IDs, including external SFCs. */
1164
+ ssrModuleIdRoot?: string;
1166
1165
  /**
1167
1166
  * Glob patterns to scan for .vue files during pre-compilation
1168
1167
  * Use an empty array to disable startup pre-compilation and compile on demand.
@@ -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-BSmJ5UMW.mjs";
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-CwtUr1uY.mjs";
2
2
  import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
3
3
 
4
4
  //#region src/vite-plus/types.d.ts
@@ -321,7 +321,7 @@ function defineConfig(config = {}, integration = {}) {
321
321
  const { options } = metadata;
322
322
  const plugins = compiler === false ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
323
323
  if (compiler !== false) {
324
- const { vize } = await import("./plugin-BZN9h1bb.mjs");
324
+ const { vize } = await import("./plugin-Cxx-XPU9.mjs");
325
325
  plugins.unshift(vize({
326
326
  ...compiler,
327
327
  configMode: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.428.1",
3
+ "version": "0.429.1",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -51,18 +51,19 @@
51
51
  "access": "public"
52
52
  },
53
53
  "dependencies": {
54
- "@vizejs/native": "0.428.1",
55
- "@vizejs/unplugin": "0.428.1",
54
+ "@vizejs/native": "0.429.1",
55
+ "@vizejs/unplugin": "0.429.1",
56
56
  "jsonc-parser": "^3.3.1",
57
57
  "oxc-parser": "0.144.0",
58
58
  "tinyglobby": "0.2.17",
59
- "vize": "0.428.1"
59
+ "vize": "0.429.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "25.9.2",
63
63
  "typescript": "6.0.3",
64
64
  "vite": "npm:@voidzero-dev/vite-plus-core@0.1.24",
65
- "vite-plus": "^0.2.3"
65
+ "vite-plus": "^0.2.3",
66
+ "vue": "3.5.35"
66
67
  },
67
68
  "peerDependencies": {
68
69
  "vite": "^7.3.0 || ^8.0.0",
@@ -1,2 +0,0 @@
1
- import { t as vize } from "./plugin-CkmrBDhz.mjs";
2
- export { vize };