@vizejs/nuxt 0.433.0 → 0.435.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.
Files changed (2) hide show
  1. package/dist/index.mjs +30 -10
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -1049,6 +1049,21 @@ function rewriteBareVueImportsToClientRuntime(code) {
1049
1049
  function unsupportedNuxtVueCompilerOptions(options) {
1050
1050
  return Object.entries(options ?? {}).filter(([key, value]) => value !== void 0 && (key !== "whitespace" || value !== "condense" && value !== "preserve")).map(([key]) => key);
1051
1051
  }
1052
+ /** Separate Nuxt's inherited default from authored module compiler options. */
1053
+ function splitNuxtCompilerDefaults(resolved, compiler, vueCompilerOptions) {
1054
+ const whitespace = vueCompilerOptions?.whitespace;
1055
+ if (whitespace !== "condense" && whitespace !== "preserve") return {
1056
+ options: resolved,
1057
+ defaults: {}
1058
+ };
1059
+ return {
1060
+ options: {
1061
+ ...resolved,
1062
+ whitespace: typeof compiler === "object" && compiler != null ? compiler.whitespace : void 0
1063
+ },
1064
+ defaults: { whitespace }
1065
+ };
1066
+ }
1052
1067
  function isLegacyVueVersion(version) {
1053
1068
  return version === .11 || version === 1 || version === 2 || version === "2.7" || version === "legacy";
1054
1069
  }
@@ -1148,6 +1163,20 @@ function mergePlainRecords(...values) {
1148
1163
  return result;
1149
1164
  }
1150
1165
  //#endregion
1166
+ //#region src/vite-compiler.ts
1167
+ /** Keep lazy plugin loading and native-only registration outside the module entry. */
1168
+ async function setupNuxtViteCompiler(compilerOptions, host, compiler) {
1169
+ const { default: vize } = await import("@vizejs/vite-plugin");
1170
+ const { options: explicit, defaults } = splitNuxtCompilerDefaults(compilerOptions, compiler, host.vue?.compilerOptions);
1171
+ host.vite ||= {};
1172
+ host.vite.plugins = host.vite.plugins || [];
1173
+ host.vite.plugins.push(vize({
1174
+ ...explicit,
1175
+ nuxtPageMeta: true,
1176
+ ssrModuleIdRoot: host.srcDir
1177
+ }, defaults));
1178
+ }
1179
+ //#endregion
1151
1180
  //#region src/libraries.ts
1152
1181
  function projectLoader(rootDir, specifier, option) {
1153
1182
  return async () => {
@@ -1394,16 +1423,7 @@ async function setupVizeNuxtModule(options, nuxt) {
1394
1423
  }
1395
1424
  await setupLintInspector(options.lint, nuxt, compilerOptions, lintGeneration, nuxt.options.dev);
1396
1425
  const usesVizeCompiler = shouldUseVizeCompiler(compilerOptions);
1397
- if (compilerOptions !== false && compilerOptions.compatibility?.hostCompiler !== true) {
1398
- const { default: vize } = await import("@vizejs/vite-plugin");
1399
- nuxt.options.vite ||= {};
1400
- nuxt.options.vite.plugins = nuxt.options.vite.plugins || [];
1401
- nuxt.options.vite.plugins.push(vize({
1402
- ...compilerOptions,
1403
- nuxtPageMeta: true,
1404
- ssrModuleIdRoot: nuxt.options.srcDir
1405
- }));
1406
- }
1426
+ if (compilerOptions !== false && compilerOptions.compatibility?.hostCompiler !== true) await setupNuxtViteCompiler(compilerOptions, nuxt.options, options.compiler);
1407
1427
  let isNuxtBuild = false;
1408
1428
  let isViteBuild = false;
1409
1429
  if (usesVizeCompiler) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.433.0",
3
+ "version": "0.435.0",
4
4
  "description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
5
5
  "keywords": [
6
6
  "compiler",
@@ -49,12 +49,12 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@nuxt/kit": "3.11.2",
52
- "@vizejs/native": "0.433.0",
53
- "@vizejs/nuxt-lint-config": "0.433.0",
54
- "@vizejs/vite-plugin": "0.433.0",
55
- "@vizejs/vite-plugin-musea": "0.433.0",
56
- "oxlint-plugin-vize": "0.433.0",
57
- "vize": "0.433.0"
52
+ "@vizejs/native": "0.435.0",
53
+ "@vizejs/nuxt-lint-config": "0.435.0",
54
+ "@vizejs/vite-plugin": "0.435.0",
55
+ "@vizejs/vite-plugin-musea": "0.435.0",
56
+ "oxlint-plugin-vize": "0.435.0",
57
+ "vize": "0.435.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "jiti-nuxt2": "npm:jiti@1.21.7",