@holo-js/adapter-nuxt 0.3.11 → 0.3.12
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/module.d.mts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +39 -2
- package/package.json +14 -14
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { lstatSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { readdir, mkdir, writeFile, access } from 'node:fs/promises';
|
|
2
|
+
import { readdir, readFile, mkdir, writeFile, access } from 'node:fs/promises';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
|
-
import { resolve, extname, relative, basename, dirname } from 'node:path';
|
|
4
|
+
import { resolve, extname, relative, basename, dirname, isAbsolute } from 'node:path';
|
|
5
5
|
import { defineNuxtModule, createResolver, addServerPlugin, addServerImportsDir, addServerHandler, addPlugin } from '@nuxt/kit';
|
|
6
6
|
import { loadConfigDirectory } from '@holo-js/config';
|
|
7
7
|
import '@holo-js/db/config';
|
|
@@ -119,6 +119,35 @@ function isModuleResolutionFailure(error) {
|
|
|
119
119
|
}
|
|
120
120
|
return "code" in error && (error.code === "MODULE_NOT_FOUND" || error.code === "ERR_MODULE_NOT_FOUND");
|
|
121
121
|
}
|
|
122
|
+
function isRecord(value) {
|
|
123
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
124
|
+
}
|
|
125
|
+
function safeGeneratedArtifactPath(value) {
|
|
126
|
+
return !isAbsolute(value) && value.length > 0 && value.split(/[\\/]/u).every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
|
|
127
|
+
}
|
|
128
|
+
async function pluginGeneratedTypePaths(rootDir) {
|
|
129
|
+
const generatedRoot = resolve(rootDir, ".holo-js/generated");
|
|
130
|
+
const manifestsRoot = resolve(generatedRoot, ".plugins");
|
|
131
|
+
const entries = await readdir(manifestsRoot, { withFileTypes: true }).catch((error) => {
|
|
132
|
+
if (isRecord(error) && error.code === "ENOENT") return [];
|
|
133
|
+
throw error;
|
|
134
|
+
});
|
|
135
|
+
const paths = [];
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
if (!entry.isFile() || !entry.name.endsWith(".json")) continue;
|
|
138
|
+
const value = JSON.parse(await readFile(resolve(manifestsRoot, entry.name), "utf8"));
|
|
139
|
+
if (!isRecord(value) || typeof value.pluginId !== "string" || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(value.pluginId) || !Array.isArray(value.generatedArtifacts)) {
|
|
140
|
+
throw new Error(`Invalid Holo plugin preparation manifest: ${entry.name}`);
|
|
141
|
+
}
|
|
142
|
+
for (const artifact of value.generatedArtifacts) {
|
|
143
|
+
if (!isRecord(artifact) || typeof artifact.path !== "string" || !safeGeneratedArtifactPath(artifact.path)) {
|
|
144
|
+
throw new Error(`Invalid Holo plugin generated artifact in manifest: ${entry.name}`);
|
|
145
|
+
}
|
|
146
|
+
if (artifact.path.endsWith(".d.ts")) paths.push(resolve(generatedRoot, value.pluginId, artifact.path));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return Object.freeze([...new Set(paths)].sort());
|
|
150
|
+
}
|
|
122
151
|
function hasProjectPackage(rootDir, packageName, resolvePackage = createRequire(resolve(rootDir, "package.json")).resolve) {
|
|
123
152
|
return typeof resolveProjectPackageEntry(rootDir, packageName, resolvePackage) === "string";
|
|
124
153
|
}
|
|
@@ -397,12 +426,19 @@ const module$1 = defineNuxtModule({
|
|
|
397
426
|
const authTypesPath = resolve(rootDir, ".holo-js/generated/auth.d.ts");
|
|
398
427
|
const authorizationTypesPath = resolve(rootDir, ".holo-js/generated/authorization/types.d.ts");
|
|
399
428
|
const modelRegistryTypesPath = resolve(rootDir, ".holo-js/generated/model-registry.d.ts");
|
|
429
|
+
const pluginTypesPaths = await pluginGeneratedTypePaths(rootDir);
|
|
400
430
|
addViteOptimizeDeps(opts, resolveClientOptimizeDeps(rootDir));
|
|
401
431
|
const storageModule = await importOptionalStorageModule();
|
|
402
432
|
const loaded = await loadConfigDirectory(rootDir, {
|
|
403
433
|
preferCache: process.env.NODE_ENV === "production",
|
|
404
434
|
processEnv: process.env
|
|
405
435
|
});
|
|
436
|
+
if ((loaded.app.plugins ?? []).includes("@holo-js/panels")) {
|
|
437
|
+
opts.css = opts.css ?? [];
|
|
438
|
+
if (!opts.css.includes("@holo-js/panels-vue/style.css")) {
|
|
439
|
+
opts.css.push("@holo-js/panels-vue/style.css");
|
|
440
|
+
}
|
|
441
|
+
}
|
|
406
442
|
const storageSetup = resolveStorageSetup(storageModule, loaded);
|
|
407
443
|
const s3Driver = resolver.resolve("./runtime/drivers/s3.js");
|
|
408
444
|
opts.nitro = opts.nitro || { storage: {} };
|
|
@@ -520,6 +556,7 @@ const module$1 = defineNuxtModule({
|
|
|
520
556
|
references.push({ path: authTypesPath });
|
|
521
557
|
references.push({ path: authorizationTypesPath });
|
|
522
558
|
references.push({ path: modelRegistryTypesPath });
|
|
559
|
+
for (const path of pluginTypesPaths) references.push({ path });
|
|
523
560
|
});
|
|
524
561
|
}
|
|
525
562
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/adapter-nuxt",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Holo-JS Framework - Nuxt adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"test": "vitest --run"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@holo-js/adapter-shared": "^0.3.
|
|
41
|
+
"@holo-js/adapter-shared": "^0.3.12",
|
|
42
42
|
"@nuxt/kit": "^4.4.4",
|
|
43
|
-
"@holo-js/config": "^0.3.
|
|
44
|
-
"@holo-js/core": "^0.3.
|
|
45
|
-
"@holo-js/db": "^0.3.
|
|
46
|
-
"@holo-js/validation": "^0.3.
|
|
43
|
+
"@holo-js/config": "^0.3.12",
|
|
44
|
+
"@holo-js/core": "^0.3.12",
|
|
45
|
+
"@holo-js/db": "^0.3.12",
|
|
46
|
+
"@holo-js/validation": "^0.3.12",
|
|
47
47
|
"h3": "^1.15.11",
|
|
48
48
|
"nitropack": "^2.13.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@holo-js/broadcast": "^0.3.
|
|
52
|
-
"@holo-js/forms": "^0.3.
|
|
53
|
-
"@holo-js/realtime": "^0.3.
|
|
54
|
-
"@holo-js/storage": "^0.3.
|
|
55
|
-
"@holo-js/storage-s3": "^0.3.
|
|
51
|
+
"@holo-js/broadcast": "^0.3.12",
|
|
52
|
+
"@holo-js/forms": "^0.3.12",
|
|
53
|
+
"@holo-js/realtime": "^0.3.12",
|
|
54
|
+
"@holo-js/storage": "^0.3.12",
|
|
55
|
+
"@holo-js/storage-s3": "^0.3.12"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@holo-js/broadcast": {
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@holo-js/broadcast": "^0.3.
|
|
76
|
-
"@holo-js/realtime": "^0.3.
|
|
77
|
-
"@holo-js/storage-s3": "^0.3.
|
|
75
|
+
"@holo-js/broadcast": "^0.3.12",
|
|
76
|
+
"@holo-js/realtime": "^0.3.12",
|
|
77
|
+
"@holo-js/storage-s3": "^0.3.12",
|
|
78
78
|
"@nuxt/module-builder": "^1.0.2",
|
|
79
79
|
"@types/node": "^22.10.2",
|
|
80
80
|
"nuxt": "^4.4.4",
|