@vizejs/vite-plugin 0.135.0 → 0.138.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
@@ -149,6 +149,13 @@ export default defineNuxtConfig({
149
149
 
150
150
  ```ts
151
151
  interface VizeNativeOptions {
152
+ /**
153
+ * Vue major version for the host project.
154
+ * Set to 0.11, 1, 2, or "legacy" to let the existing compiler plugin/loader handle SFCs.
155
+ * @default 3
156
+ */
157
+ vueVersion?: 0.11 | 1 | 2 | 3 | "legacy";
158
+
152
159
  /**
153
160
  * Files to include in compilation
154
161
  * @default /\.vue$/
@@ -205,6 +212,19 @@ interface VizeNativeOptions {
205
212
  }
206
213
  ```
207
214
 
215
+ ### Legacy Vue / Nuxt 2 compatibility
216
+
217
+ Vize's native SFC compiler targets Vue 3 runtime output. In Vue 0.11, Vue 1, Vue 2,
218
+ and Nuxt 2 projects, keep the existing host compiler in charge and set:
219
+
220
+ ```ts
221
+ vize({ vueVersion: 2 });
222
+ ```
223
+
224
+ Use `0.11`, `1`, `2`, or `"legacy"` for the same host-compiler compatibility mode. This makes the
225
+ plugin non-invasive: it does not intercept `.vue` requests, does not expose the Vue 3 `vite:vue`
226
+ compatibility API, and does not inject Vue 3 bundler feature flags.
227
+
208
228
  ## How It Works
209
229
 
210
230
  ### Pre-compilation at Startup
package/dist/index.d.mts CHANGED
@@ -584,12 +584,24 @@ interface MacroArtifact {
584
584
  start: number;
585
585
  end: number;
586
586
  }
587
+ type VizeVueVersion = 0.11 | 1 | 2 | 3 | "legacy";
587
588
  interface VizeOptions {
588
589
  /**
589
590
  * Inline shared Vize config for Vite Plus-first projects.
590
591
  * Direct plugin options still take precedence over these values.
591
592
  */
592
593
  config?: UserConfigExport;
594
+ /**
595
+ * Vue major version for the host project.
596
+ *
597
+ * Legacy Vue projects must keep their existing compiler plugin/loader in
598
+ * charge of SFC compilation. Set this to `0.11`, `1`, `2`, or `"legacy"` to
599
+ * make Vize a non-invasive compatibility plugin that does not intercept
600
+ * `.vue` requests or inject Vue 3 bundler defines.
601
+ *
602
+ * @default 3
603
+ */
604
+ vueVersion?: VizeVueVersion;
593
605
  /**
594
606
  * Override the public base used for dev-time asset URLs such as /@fs paths.
595
607
  * Useful for frameworks like Nuxt that serve Vite from a subpath (e.g. /_nuxt/).
@@ -742,4 +754,4 @@ declare const __internal: {
742
754
  rewriteStaticAssetUrls: typeof rewriteStaticAssetUrls;
743
755
  };
744
756
  //#endregion
745
- export { type CompiledModule, type LoadConfigOptions, type MacroArtifact, type ResolvedVizeConfig, type UserConfigExport, type VizeConfig, type VizeOptions, __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, vize as default, vize, defineConfig, loadConfig, resolveConfigExport, vizeConfigStore };
757
+ export { type CompiledModule, type LoadConfigOptions, type MacroArtifact, type ResolvedVizeConfig, type UserConfigExport, type VizeConfig, type VizeOptions, type VizeVueVersion, __internal, rewriteStaticAssetUrls as __internal_rewriteStaticAssetUrls, vize as default, vize, defineConfig, loadConfig, resolveConfigExport, vizeConfigStore };
package/dist/index.mjs CHANGED
@@ -1273,6 +1273,19 @@ function installVirtualAssetMiddleware(devServer, state) {
1273
1273
  });
1274
1274
  }
1275
1275
  //#endregion
1276
+ //#region src/plugin/vue-version.ts
1277
+ function isLegacyVueCompatibilityMode(options) {
1278
+ return options.vueVersion !== void 0 && options.vueVersion !== 3;
1279
+ }
1280
+ function createLegacyVueCompatibilityPlugin(options) {
1281
+ return {
1282
+ name: "vite-plugin-vize:legacy-vue-compat",
1283
+ configResolved(resolvedConfig) {
1284
+ createLogger(options.debug ?? false).log(`Legacy Vue compatibility mode is active for ${resolvedConfig.root}; Vize will not compile .vue files.`);
1285
+ }
1286
+ };
1287
+ }
1288
+ //#endregion
1276
1289
  //#region src/plugin/index.ts
1277
1290
  function aliasSortKey(find) {
1278
1291
  return typeof find === "string" ? find.length : find.source.length;
@@ -1319,6 +1332,7 @@ function mergeSharedConfig(baseConfig, overrideConfig) {
1319
1332
  };
1320
1333
  }
1321
1334
  function vize(options = {}) {
1335
+ if (isLegacyVueCompatibilityMode(options)) return [createLegacyVueCompatibilityPlugin(options)];
1322
1336
  const state = {
1323
1337
  cache: /* @__PURE__ */ new Map(),
1324
1338
  ssrCache: /* @__PURE__ */ new Map(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.135.0",
3
+ "version": "0.138.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -39,9 +39,9 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@vizejs/native": "0.135.0",
42
+ "@vizejs/native": "0.138.0",
43
43
  "tinyglobby": "0.2.16",
44
- "vize": "0.135.0"
44
+ "vize": "0.138.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "25.7.0",