@vizejs/nuxt 0.817.0 → 0.818.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 +23 -5
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -1878,17 +1878,35 @@ const VUE_SSR_EXTERNAL = [
1878
1878
  "vue/server-renderer",
1879
1879
  "@vue/server-renderer"
1880
1880
  ];
1881
- const VUE_RUNTIME_DEDUPE = [
1882
- "vue",
1881
+ const VUE_RUNTIME_PACKAGES = [
1883
1882
  "@vue/reactivity",
1884
1883
  "@vue/runtime-core",
1885
1884
  "@vue/runtime-dom",
1886
1885
  "@vue/shared"
1887
1886
  ];
1888
- function dedupeVueRuntimePackages(vite) {
1887
+ function packageDirectory(from, name) {
1888
+ try {
1889
+ return dirname(realpathSync(createRequire(join(from, "package.json")).resolve(`${name}/package.json`)));
1890
+ } catch {
1891
+ return;
1892
+ }
1893
+ }
1894
+ /**
1895
+ * Dedupe makes Vite resolve a package from the project, whoever imports it. The
1896
+ * project can also hold an `@vue/*` copy that its `vue` does not use, such as
1897
+ * the one another dependency pins, and Vue would then run on that copy. So an
1898
+ * `@vue/*` package is deduped only where the project resolves Vue's own copy.
1899
+ */
1900
+ function dedupeVueRuntimePackages(vite, rootDir) {
1889
1901
  vite.resolve ||= {};
1890
1902
  const dedupe = new Set(vite.resolve.dedupe ?? []);
1891
- for (const packageName of VUE_RUNTIME_DEDUPE) dedupe.add(packageName);
1903
+ dedupe.add("vue");
1904
+ const vue = packageDirectory(rootDir, "vue");
1905
+ const runtime = vue && packageDirectory(vue, "@vue/runtime-dom");
1906
+ for (const name of VUE_RUNTIME_PACKAGES) {
1907
+ const own = vue && (packageDirectory(vue, name) ?? (runtime && packageDirectory(runtime, name)));
1908
+ if (own && own === packageDirectory(rootDir, name)) dedupe.add(name);
1909
+ }
1892
1910
  vite.resolve.dedupe = [...dedupe];
1893
1911
  }
1894
1912
  function ssrRolldownOptions(config) {
@@ -2084,7 +2102,7 @@ async function setupVizeNuxtModule(raw, nuxt) {
2084
2102
  if (nuxt.options.dev !== false) return;
2085
2103
  isNuxtBuild = true;
2086
2104
  nuxt.options.vite ||= {};
2087
- dedupeVueRuntimePackages(nuxt.options.vite);
2105
+ dedupeVueRuntimePackages(nuxt.options.vite, nuxt.options.rootDir);
2088
2106
  });
2089
2107
  nuxt.hook("vite:extendConfig", (config, context) => {
2090
2108
  if (nuxt.options.dev === false && context?.isServer) externalizeVueRuntimeForNuxtSsr(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.817.0",
3
+ "version": "0.818.0",
4
4
  "description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
5
5
  "keywords": [
6
6
  "compiler",
@@ -50,16 +50,16 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@nuxt/kit": "3.21.8",
53
- "@vizejs/native": "0.817.0",
54
- "@vizejs/nuxt-lint-config": "0.817.0",
55
- "@vizejs/vite-plugin": "0.817.0",
56
- "@vizejs/vite-plugin-musea": "0.817.0",
57
- "vize": "0.817.0"
53
+ "@vizejs/native": "0.818.0",
54
+ "@vizejs/nuxt-lint-config": "0.818.0",
55
+ "@vizejs/vite-plugin": "0.818.0",
56
+ "@vizejs/vite-plugin-musea": "0.818.0",
57
+ "vize": "0.818.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "jiti-nuxt2": "npm:jiti@1.21.7",
61
61
  "oxlint": "1.78.0",
62
- "oxlint-plugin-vize": "0.817.0",
62
+ "oxlint-plugin-vize": "0.818.0",
63
63
  "typescript": "6.0.3",
64
64
  "vite": "npm:@voidzero-dev/vite-plus-core@1.5.0",
65
65
  "vite-plus": "1.5.0",