@vizejs/vite-plugin 0.139.0 → 0.140.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 +22 -4
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -562,6 +562,19 @@ function isOptimizedVueDependency(id) {
562
562
  const { request } = splitViteIdQuery(id);
563
563
  return request.split(path.sep).join("/").includes("/node_modules/.vite/deps/vue.");
564
564
  }
565
+ const vueResolvableFromRootCache = /* @__PURE__ */ new Map();
566
+ function isVueResolvableFromRoot(root) {
567
+ let cached = vueResolvableFromRootCache.get(root);
568
+ if (cached === void 0) {
569
+ cached = false;
570
+ try {
571
+ createRequire(path.join(root, "__vize_probe__.js")).resolve("vue");
572
+ cached = true;
573
+ } catch {}
574
+ vueResolvableFromRootCache.set(root, cached);
575
+ }
576
+ return cached;
577
+ }
565
578
  function normalizeResolvedVuePath(id) {
566
579
  return normalizeViteResolvedVuePath(id);
567
580
  }
@@ -699,8 +712,13 @@ async function resolveIdHook(ctx, state, id, importer, options) {
699
712
  id: normalizedFsId
700
713
  };
701
714
  if (isVueRuntime && state.server !== null && !isOptimizedVueDependency(resolved.id)) {
702
- state.logger.log(`resolveId: deferring Vue runtime ${resolved.id} to Vite optimizer`);
703
- return null;
715
+ if (isVueResolvableFromRoot(state.root)) {
716
+ state.logger.log(`resolveId: deferring Vue runtime ${resolved.id} to Vite optimizer`);
717
+ return null;
718
+ }
719
+ const isolatedEntry = resolveVueBundlerEntryWithNode(state, id, cleanImporter) ?? resolved.id;
720
+ state.logger.log(`resolveId: isolated install — resolved Vue runtime to ${isolatedEntry}`);
721
+ return isolatedEntry;
704
722
  }
705
723
  if (isVueRuntime && isVuePackageEntry(resolved.id)) {
706
724
  const vueBundlerEntry = resolveVueBundlerEntryWithNode(state, id, cleanImporter);
@@ -712,7 +730,7 @@ async function resolveIdHook(ctx, state, id, importer, options) {
712
730
  }
713
731
  if (isViteBareSpecifier(resolved.id)) {
714
732
  if (isVueRuntime) {
715
- const vueBundlerEntry = isBuild ? resolveVueBundlerEntryWithNode(state, id, cleanImporter) : null;
733
+ const vueBundlerEntry = isBuild || !isVueResolvableFromRoot(state.root) ? resolveVueBundlerEntryWithNode(state, id, cleanImporter) : null;
716
734
  if (vueBundlerEntry) {
717
735
  state.logger.log(`resolveId: resolved Vue runtime to ${vueBundlerEntry}`);
718
736
  return vueBundlerEntry;
@@ -731,7 +749,7 @@ async function resolveIdHook(ctx, state, id, importer, options) {
731
749
  }
732
750
  } catch {}
733
751
  if (isVueRuntime) {
734
- const vueBundlerEntry = isBuild ? resolveVueBundlerEntryWithNode(state, id, cleanImporter) : null;
752
+ const vueBundlerEntry = isBuild || !isVueResolvableFromRoot(state.root) ? resolveVueBundlerEntryWithNode(state, id, cleanImporter) : null;
735
753
  if (vueBundlerEntry) {
736
754
  state.logger.log(`resolveId: resolved Vue runtime to ${vueBundlerEntry}`);
737
755
  return vueBundlerEntry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.139.0",
3
+ "version": "0.140.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.139.0",
42
+ "@vizejs/native": "0.140.0",
43
43
  "tinyglobby": "0.2.16",
44
- "vize": "0.139.0"
44
+ "vize": "0.140.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "25.7.0",