@vizejs/vite-plugin 0.109.0 → 0.112.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/README.md CHANGED
@@ -74,6 +74,7 @@ vite {
74
74
  `@vizejs/vite-plugin` loads the same `vize.config.ts`, `vize.config.js`, `vize.config.mjs`,
75
75
  `vize.config.pkl`, and `vize.config.json` files as the `vize` npm CLI. Importing
76
76
  `defineConfig` from `@vizejs/vite-plugin` still works, but `vize` is the shared entry point.
77
+ Install `@pkl-community/pkl` or provide a `pkl` binary on `PATH` when using `vize.config.pkl`.
77
78
 
78
79
  ### Nuxt
79
80
 
package/dist/index.mjs CHANGED
@@ -386,6 +386,13 @@ function syncCollectedCssForFile(state, filePath, compiled) {
386
386
  if (compiled.css && !hasDelegatedStyles(compiled)) state.collectedCss.set(filePath, resolveCssImports(compiled.css, filePath, state.cssAliasRules, false));
387
387
  else state.collectedCss.delete(filePath);
388
388
  }
389
+ function clearBuildCaches(state) {
390
+ state.cache.clear();
391
+ state.ssrCache.clear();
392
+ state.collectedCss.clear();
393
+ state.precompileMetadata.clear();
394
+ state.pendingHmrUpdateTypes.clear();
395
+ }
389
396
  /**
390
397
  * Pre-compile all Vue files matching scan patterns.
391
398
  */
@@ -531,6 +538,14 @@ function resolveVueBundlerEntryWithNode(state, id, importer) {
531
538
  function isVueRuntimeRequest(id) {
532
539
  return splitViteIdQuery(id).request === "vue";
533
540
  }
541
+ function resolveSsrExternalVueRequest(id) {
542
+ const { request, querySuffix } = splitViteIdQuery(id);
543
+ if (querySuffix) return null;
544
+ if (request === "@vue/server-renderer" || request === "vue/server-renderer") return "vue/server-renderer";
545
+ if (request === "vue" || request.startsWith("vue/dist/")) return "vue";
546
+ if (request.startsWith("@vue/")) return request;
547
+ return null;
548
+ }
534
549
  function isVuePackageEntry(id) {
535
550
  const { request } = splitViteIdQuery(id);
536
551
  const normalized = request.split(path.sep).join("/");
@@ -631,6 +646,11 @@ async function resolveIdHook(ctx, state, id, importer, options) {
631
646
  return null;
632
647
  }
633
648
  if (!id.endsWith(".vue")) {
649
+ const ssrExternalVueRequest = isSsrRequest ? resolveSsrExternalVueRequest(id) : null;
650
+ if (ssrExternalVueRequest) return {
651
+ id: ssrExternalVueRequest,
652
+ external: true
653
+ };
634
654
  if (!id.startsWith("./") && !id.startsWith("../") && !id.startsWith("/")) {
635
655
  const isVueRuntime = isVueRuntimeRequest(id);
636
656
  const aliasRequest = resolveAliasRequest(state, id);
@@ -805,6 +825,9 @@ function getVirtualModuleDefines(state, ssr) {
805
825
  ...ssr ? state.serverViteDefine : state.clientViteDefine
806
826
  };
807
827
  }
828
+ function normalizeVueServerRendererImport(code) {
829
+ return code.replace(/\bfrom\s+(['"])@vue\/server-renderer\1/g, "from \"vue/server-renderer\"");
830
+ }
808
831
  function findMacroArtifactModule(state, realPath, ssr, kind) {
809
832
  const cache = getEnvironmentCache(state, ssr);
810
833
  realPath = classifyVitePluginRequest(realPath).normalizedVuePath;
@@ -922,14 +945,15 @@ function loadHook(state, id, loadOptions) {
922
945
  ...compiled,
923
946
  css: resolveCssImports(compiled.css, realPath, state.cssAliasRules, state.server !== null, currentBase)
924
947
  };
925
- const output = rewriteStaticAssetUrls(rewriteDynamicTemplateImports(generateOutput(compiled, {
948
+ const generatedOutput = generateOutput(compiled, {
926
949
  isProduction: state.isProduction,
927
950
  isDev: state.server !== null && !isSsr,
928
951
  ssr: isSsr,
929
952
  hmrUpdateType: pendingHmrUpdateType,
930
953
  extractCss: state.extractCss,
931
954
  filePath: realPath
932
- }), state.dynamicImportAliasRules), state.dynamicImportAliasRules);
955
+ });
956
+ const output = rewriteStaticAssetUrls(rewriteDynamicTemplateImports(isSsr ? normalizeVueServerRendererImport(generatedOutput) : generatedOutput, state.dynamicImportAliasRules), state.dynamicImportAliasRules);
933
957
  if (!loadOptions?.ssr) state.pendingHmrUpdateTypes.delete(realPath);
934
958
  return {
935
959
  code: output,
@@ -1348,6 +1372,9 @@ function vize(options = {}) {
1348
1372
  },
1349
1373
  generateBundle() {
1350
1374
  handleGenerateBundleHook(state, this.emitFile.bind(this));
1375
+ },
1376
+ closeBundle() {
1377
+ if (state.server === null) clearBuildCaches(state);
1351
1378
  }
1352
1379
  },
1353
1380
  createPostTransformPlugin(state)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.109.0",
3
+ "version": "0.112.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -37,9 +37,9 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@vizejs/native": "0.109.0",
40
+ "@vizejs/native": "0.112.0",
41
41
  "tinyglobby": "0.2.16",
42
- "vize": "0.109.0"
42
+ "vize": "0.112.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "25.7.0",