@vizejs/nuxt 0.818.0 → 0.819.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 +15 -5
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -929,7 +929,7 @@ function findMatchingParen(code, openParenIndex) {
929
929
  }
930
930
  return -1;
931
931
  }
932
- const NAMED_IMPORT_RE = /^import\s*\{([\s\S]*?)\}\s*from\s*(['"])(vue|#imports|#entry)\2\s*;?/gm;
932
+ const NAMED_IMPORT_RE = /^import\s*\{([^{}]*?)\}\s*from\s*(['"])(vue(?:\/dist\/[^'"\r\n]+)?|#imports|#entry)\2\s*;?/gm;
933
933
  function parseNamedImportSpecifiers(specifierSource) {
934
934
  return specifierSource.split(",").map((specifier) => specifier.trim()).filter(Boolean).flatMap((specifier) => {
935
935
  const withoutType = specifier.replace(/^type\s+/, "").trim();
@@ -961,8 +961,11 @@ function renderNamedImport(specifiers, source, quote) {
961
961
  function preserveExplicitVueImportsFromNuxtAutoImports(originalCode, injectedCode) {
962
962
  const originalVueSpecifiers = /* @__PURE__ */ new Map();
963
963
  for (const statement of collectNamedImports(originalCode)) {
964
- if (statement.source !== "vue") continue;
965
- for (const specifier of statement.specifiers) originalVueSpecifiers.set(specifier.local, specifier);
964
+ if (statement.source !== "vue" && !statement.source.startsWith("vue/dist/")) continue;
965
+ for (const specifier of statement.specifiers) originalVueSpecifiers.set(specifier.local, {
966
+ ...specifier,
967
+ source: statement.source
968
+ });
966
969
  }
967
970
  if (originalVueSpecifiers.size === 0) return injectedCode;
968
971
  const restoredSpecifiers = /* @__PURE__ */ new Map();
@@ -990,11 +993,18 @@ function preserveExplicitVueImportsFromNuxtAutoImports(originalCode, injectedCod
990
993
  for (const replacement of replacements.reverse()) output = output.slice(0, replacement.start) + replacement.text + output.slice(replacement.end);
991
994
  const currentVueLocals = /* @__PURE__ */ new Set();
992
995
  for (const statement of collectNamedImports(output)) {
993
- if (statement.source !== "vue") continue;
996
+ if (statement.source !== "vue" && !statement.source.startsWith("vue/dist/")) continue;
994
997
  for (const specifier of statement.specifiers) currentVueLocals.add(specifier.local);
995
998
  }
996
999
  const missing = [...restoredSpecifiers.values()].filter((specifier) => !currentVueLocals.has(specifier.local));
997
- if (missing.length > 0) output = `${renderNamedImport(missing, "vue", "\"")}\n${output}`;
1000
+ const missingBySource = /* @__PURE__ */ new Map();
1001
+ for (const specifier of missing) {
1002
+ const specifiers = missingBySource.get(specifier.source) ?? [];
1003
+ specifiers.push(specifier);
1004
+ missingBySource.set(specifier.source, specifiers);
1005
+ }
1006
+ const restoredImports = [...missingBySource].map(([source, specifiers]) => renderNamedImport(specifiers, source, "\""));
1007
+ if (restoredImports.length > 0) output = `${restoredImports.join("\n")}\n${output}`;
998
1008
  return output.replace(/\n{3,}/g, "\n\n");
999
1009
  }
1000
1010
  function preserveExplicitVueImportsFromVizeModuleSource(id, code) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.818.0",
3
+ "version": "0.819.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.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"
53
+ "@vizejs/native": "0.819.0",
54
+ "@vizejs/nuxt-lint-config": "0.819.0",
55
+ "@vizejs/vite-plugin": "0.819.0",
56
+ "@vizejs/vite-plugin-musea": "0.819.0",
57
+ "vize": "0.819.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.818.0",
62
+ "oxlint-plugin-vize": "0.819.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",