@vizejs/nuxt 0.169.0 → 0.171.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.d.mts CHANGED
@@ -5,6 +5,14 @@ import { NuxtMuseaOptions, NuxtMuseaOptions as NuxtMuseaOptions$1 } from "@vizej
5
5
  //#region src/compiler-options.d.ts
6
6
  type VizeNuxtPattern = string | RegExp;
7
7
  type VizeNuxtVueVersion = 0.11 | 1 | 2 | 3 | "legacy";
8
+ interface VizeNuxtCompilerCompatibilityOptions {
9
+ vueVersion?: VizeNuxtVueVersion;
10
+ hostCompiler?: boolean;
11
+ scriptSetupInStandalone?: boolean;
12
+ optionsApiVapor?: boolean;
13
+ nuxtVersion?: 2 | 3 | 4;
14
+ webpackVersion?: 4 | 5;
15
+ }
8
16
  /**
9
17
  * Nuxt-facing mirror of the public `@vizejs/vite-plugin` options.
10
18
  *
@@ -21,6 +29,16 @@ interface VizeNuxtCompilerOptions {
21
29
  * compatibility mode and does not intercept `.vue` files.
22
30
  */
23
31
  vueVersion?: VizeNuxtVueVersion;
32
+ /**
33
+ * Opt-in compatibility features shared with `@vizejs/vite-plugin`.
34
+ */
35
+ compatibility?: VizeNuxtCompilerCompatibilityOptions;
36
+ /** Emit function-body output for CDN/global Vue evaluation. */
37
+ mode?: "module" | "function";
38
+ /** Module name for runtime imports. */
39
+ runtimeModuleName?: string;
40
+ /** Global variable name for standalone/function mode. */
41
+ runtimeGlobalName?: string;
24
42
  /** Override the public base used for dev-time asset URLs. */
25
43
  devUrlBase?: string;
26
44
  /** Files to include in compilation. */
@@ -72,6 +90,33 @@ interface VizeNuxtCompatibilityOptions {
72
90
  * Vue 0.11, Vue 1, and Vue 2 all use host-compiler compatibility mode.
73
91
  */
74
92
  vueVersion?: VizeNuxtVueVersion;
93
+ /**
94
+ * Keep legacy Vue projects on the host Vue compiler while still allowing the
95
+ * Vize Nuxt module to provide bridges, linting, type checking, and Musea.
96
+ *
97
+ * @default true for Vue 0.11, Vue 1, Vue 2, and Nuxt 2
98
+ */
99
+ hostCompiler?: boolean;
100
+ /**
101
+ * Allow registering the Vite compiler bridge even when Nuxt's builder
102
+ * detection cannot prove Vite support.
103
+ *
104
+ * @default false
105
+ */
106
+ forceViteCompiler?: boolean;
107
+ /**
108
+ * Enable function-body output for CDN/global Vue evaluation.
109
+ */
110
+ scriptSetupInStandalone?: boolean;
111
+ /**
112
+ * Allow Vapor output for Options API SFCs when the compiler is active.
113
+ */
114
+ optionsApiVapor?: boolean;
115
+ /**
116
+ * Preserve shared compatibility objects that also configure
117
+ * `@vizejs/unplugin/webpack`.
118
+ */
119
+ webpackVersion?: 4 | 5;
75
120
  }
76
121
  interface VizeNuxtBridgeOptions {
77
122
  /**
@@ -173,4 +218,4 @@ interface VizeNuxtOptions {
173
218
  //#region src/index.d.ts
174
219
  declare const _default: _$nuxt_schema0.NuxtModule<VizeNuxtOptions, VizeNuxtOptions, false>;
175
220
  //#endregion
176
- export { type MuseaOptions, type NuxtMuseaOptions, type VizeNuxtBridgeOptions, type VizeNuxtCompatibilityOptions, type VizeNuxtCompilerOptions, type VizeNuxtDevOptions, type VizeNuxtMajorVersion, type VizeNuxtOptions, type VizeNuxtUnoCssOptions, type VizeNuxtVueVersion, _default as default };
221
+ export { type MuseaOptions, type NuxtMuseaOptions, type VizeNuxtBridgeOptions, type VizeNuxtCompatibilityOptions, type VizeNuxtCompilerCompatibilityOptions, type VizeNuxtCompilerOptions, type VizeNuxtDevOptions, type VizeNuxtMajorVersion, type VizeNuxtOptions, type VizeNuxtUnoCssOptions, type VizeNuxtVueVersion, _default as default };
package/dist/index.mjs CHANGED
@@ -605,12 +605,30 @@ const DEFAULT_NUXT_BRIDGE_OPTIONS = {
605
605
  };
606
606
  const DEFAULT_NUXT_UNOCSS_OPTIONS = { originalSource: {} };
607
607
  const DEFAULT_NUXT_DEV_OPTIONS = { stylesheetLinks: true };
608
+ function isLegacyVueVersion(version) {
609
+ return version === .11 || version === 1 || version === 2 || version === "legacy";
610
+ }
611
+ function normalizeNuxtCompilerCompatibilityOptions(compatibility) {
612
+ const normalized = {};
613
+ const legacyHost = isLegacyVueVersion(compatibility.vueVersion) || compatibility.nuxtVersion === 2;
614
+ if (compatibility.vueVersion !== void 0) normalized.vueVersion = compatibility.vueVersion;
615
+ if (compatibility.hostCompiler !== void 0 || legacyHost) normalized.hostCompiler = compatibility.hostCompiler ?? true;
616
+ if (compatibility.scriptSetupInStandalone !== void 0) normalized.scriptSetupInStandalone = compatibility.scriptSetupInStandalone;
617
+ if (compatibility.optionsApiVapor !== void 0) normalized.optionsApiVapor = compatibility.optionsApiVapor;
618
+ if (compatibility.nuxtVersion !== void 0) normalized.nuxtVersion = compatibility.nuxtVersion;
619
+ if (compatibility.webpackVersion !== void 0) normalized.webpackVersion = compatibility.webpackVersion;
620
+ return normalized;
621
+ }
608
622
  function resolveNuxtCompilerOptions(rootDir, baseURL, buildAssetsDir, compiler, compatibility = {}) {
609
623
  if (compiler === false) return false;
610
- if (compatibility.supportsViteCompiler === false) return false;
624
+ if (compatibility.supportsViteCompiler === false && compatibility.forceViteCompiler !== true) return false;
625
+ const compatibilityOptions = normalizeNuxtCompilerCompatibilityOptions(compatibility);
626
+ const hasCompatibilityOptions = Object.keys(compatibilityOptions).length > 0;
611
627
  const overrides = typeof compiler === "object" && compiler != null ? compiler : {};
612
628
  return buildNuxtCompilerOptions(rootDir, baseURL, buildAssetsDir, {
613
629
  vueVersion: compatibility.vueVersion,
630
+ ...hasCompatibilityOptions ? { compatibility: compatibilityOptions } : {},
631
+ mode: compatibility.scriptSetupInStandalone === true ? "function" : void 0,
614
632
  ...overrides
615
633
  });
616
634
  }
@@ -717,7 +735,7 @@ function getNuxtBuildAssetsDir(nuxt) {
717
735
  return nuxt.options.app?.buildAssetsDir ?? nuxt.options.build?.publicPath;
718
736
  }
719
737
  function shouldUseVizeCompiler(compilerOptions) {
720
- return compilerOptions !== false && (compilerOptions.vueVersion ?? 3) === 3;
738
+ return compilerOptions !== false && compilerOptions.compatibility?.hostCompiler !== true && (compilerOptions.vueVersion ?? 3) === 3;
721
739
  }
722
740
  function dedupeVueRuntimePackages(vite) {
723
741
  vite.resolve ||= {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.169.0",
3
+ "version": "0.171.0",
4
4
  "description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
5
5
  "keywords": [
6
6
  "compiler",
@@ -41,10 +41,10 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@nuxt/kit": "4.4.6",
44
- "@vizejs/musea-nuxt": "0.169.0",
45
- "@vizejs/vite-plugin": "0.169.0",
46
- "@vizejs/vite-plugin-musea": "0.169.0",
47
- "vize": "0.169.0"
44
+ "@vizejs/musea-nuxt": "0.171.0",
45
+ "@vizejs/vite-plugin": "0.171.0",
46
+ "@vizejs/vite-plugin-musea": "0.171.0",
47
+ "vize": "0.171.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "typescript": "6.0.3",