@vizejs/nuxt 0.696.0 → 0.697.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.mjs +12 -3
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,15 @@ import fs, { readFileSync, realpathSync } from "node:fs";
|
|
|
4
4
|
import path, { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
|
+
//#region src/component-registration.ts
|
|
8
|
+
function registeredComponentPath(component, components) {
|
|
9
|
+
const name = component.pascalName ?? component.name;
|
|
10
|
+
const hasClientVariant = components.some((candidate) => candidate.pascalName === component.pascalName && candidate.mode === "client");
|
|
11
|
+
if (component._raw || component.mode !== "server" || !name || hasClientVariant) return component.filePath;
|
|
12
|
+
const separator = component.filePath.includes("?") ? "&" : "?";
|
|
13
|
+
return `${component.filePath}${separator}nuxt_component=server&nuxt_component_name=${name}&nuxt_component_export=${component.export ?? "default"}`;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
7
16
|
//#region src/component-imports.ts
|
|
8
17
|
const COMPONENT_CALL_RE = /_?resolveComponent\s*\(\s*["'`]([^"'`]+)["'`]\s*(?:,\s*[^)]+)?\)/g;
|
|
9
18
|
const COMPONENTS_IMPORT_RE = /import\s+(?!type\b)\{([^}]*)\}\s+from\s+(["'])#components\2\s*;?/g;
|
|
@@ -88,7 +97,7 @@ function injectNuxtComponentImports(code, resolveComponentImport) {
|
|
|
88
97
|
continue;
|
|
89
98
|
}
|
|
90
99
|
changed = true;
|
|
91
|
-
const result = addResolvedComponentBinding(explicitComponentImports, resolved, specifier.localName, `
|
|
100
|
+
const result = addResolvedComponentBinding(explicitComponentImports, resolved, specifier.localName, `__vize_nuxt_import_component_${importCounter++}_raw`);
|
|
92
101
|
needsCreateClientOnly ||= result.needsCreateClientOnly;
|
|
93
102
|
needsDefineAsyncComponent ||= result.needsDefineAsyncComponent;
|
|
94
103
|
}
|
|
@@ -102,7 +111,7 @@ function injectNuxtComponentImports(code, resolveComponentImport) {
|
|
|
102
111
|
const importKey = `${resolved.exportName}\u0000${resolved.filePath}\u0000${resolved.lazy ? "lazy" : "eager"}\u0000${resolved.mode ?? "default"}`;
|
|
103
112
|
let variableName = importedComponents.get(importKey);
|
|
104
113
|
if (!variableName) {
|
|
105
|
-
variableName = `
|
|
114
|
+
variableName = `__vize_nuxt_component_${counter++}`;
|
|
106
115
|
importedComponents.set(importKey, variableName);
|
|
107
116
|
const result = addResolvedComponentBinding(componentImports, resolved, variableName, `${variableName}_raw`);
|
|
108
117
|
needsCreateClientOnly ||= result.needsCreateClientOnly;
|
|
@@ -340,7 +349,7 @@ function createNuxtComponentResolver(options) {
|
|
|
340
349
|
return {
|
|
341
350
|
register(components) {
|
|
342
351
|
for (const component of components) {
|
|
343
|
-
const resolved = createComponentImport(component
|
|
352
|
+
const resolved = createComponentImport(registeredComponentPath(component, components), component.export || "default", false, component.mode);
|
|
344
353
|
addRegisteredComponentAlias(registered, component.pascalName, resolved);
|
|
345
354
|
addRegisteredComponentAlias(registered, component.kebabName, resolved);
|
|
346
355
|
addRegisteredComponentAlias(registered, component.name, resolved);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.697.0",
|
|
4
4
|
"description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@nuxt/kit": "3.21.8",
|
|
52
|
-
"@vizejs/native": "0.
|
|
53
|
-
"@vizejs/nuxt-lint-config": "0.
|
|
54
|
-
"@vizejs/vite-plugin": "0.
|
|
55
|
-
"@vizejs/vite-plugin-musea": "0.
|
|
56
|
-
"vize": "0.
|
|
52
|
+
"@vizejs/native": "0.697.0",
|
|
53
|
+
"@vizejs/nuxt-lint-config": "0.697.0",
|
|
54
|
+
"@vizejs/vite-plugin": "0.697.0",
|
|
55
|
+
"@vizejs/vite-plugin-musea": "0.697.0",
|
|
56
|
+
"vize": "0.697.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"jiti-nuxt2": "npm:jiti@1.21.7",
|
|
60
|
-
"oxlint-plugin-vize": "0.
|
|
60
|
+
"oxlint-plugin-vize": "0.697.0",
|
|
61
61
|
"typescript": "6.0.3",
|
|
62
62
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|
|
63
63
|
"vite-plus": "1.3.0",
|