@holo-js/adapter-nuxt 0.3.0 → 0.3.1
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 +19 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +123 -6
- package/package.json +14 -14
package/dist/module.d.mts
CHANGED
|
@@ -66,6 +66,17 @@ interface NuxtOptionsWithNitro {
|
|
|
66
66
|
nitro: {
|
|
67
67
|
storage: Record<string, unknown>;
|
|
68
68
|
errorHandler?: string | string[];
|
|
69
|
+
externals?: {
|
|
70
|
+
external?: unknown[];
|
|
71
|
+
inline?: unknown[];
|
|
72
|
+
trace?: boolean;
|
|
73
|
+
traceInclude?: string[];
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
};
|
|
76
|
+
rollupConfig?: {
|
|
77
|
+
preserveSymlinks?: boolean;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
};
|
|
69
80
|
virtual?: Record<string, () => string>;
|
|
70
81
|
experimental?: {
|
|
71
82
|
asyncContext?: boolean;
|
|
@@ -99,6 +110,10 @@ interface NuxtOptionsWithNitro {
|
|
|
99
110
|
_holoTypesRegistered?: boolean;
|
|
100
111
|
}
|
|
101
112
|
declare function hasProjectPackage(rootDir: string, packageName: string, resolvePackage?: (packageName: string) => string): boolean;
|
|
113
|
+
declare function resolveProjectPackageEntry(rootDir: string, packageName: string, resolvePackage?: (packageName: string) => string): string | undefined;
|
|
114
|
+
declare function resolveProjectPackageTraceEntry(rootDir: string, packageName: string): string | undefined;
|
|
115
|
+
declare function isProjectPackageLinked(rootDir: string, packageRootName: string): boolean;
|
|
116
|
+
declare function addNitroRuntimeTraceIncludes(opts: NuxtOptionsWithNitro, rootDir: string, pluginPackages?: readonly string[], resolvePackage?: (rootDir: string, packageName: string) => string | undefined): void;
|
|
102
117
|
declare function resolveClientOptimizeDeps(rootDir: string): string[];
|
|
103
118
|
declare function addViteOptimizeDeps(opts: NuxtOptionsWithNitro, deps: readonly string[]): void;
|
|
104
119
|
declare function isRealtimeDefinitionModule(_rootDir: string, id: string): boolean;
|
|
@@ -131,6 +146,7 @@ declare const moduleInternals: {
|
|
|
131
146
|
addViteOptimizeDeps: typeof addViteOptimizeDeps;
|
|
132
147
|
addVitePlugin: typeof addVitePlugin;
|
|
133
148
|
addNitroErrorHandler: typeof addNitroErrorHandler;
|
|
149
|
+
addNitroRuntimeTraceIncludes: typeof addNitroRuntimeTraceIncludes;
|
|
134
150
|
createRealtimeDefinitionVitePlugin: typeof createRealtimeDefinitionVitePlugin;
|
|
135
151
|
existsFile: typeof existsFile;
|
|
136
152
|
hasProjectPackage: typeof hasProjectPackage;
|
|
@@ -141,6 +157,9 @@ declare const moduleInternals: {
|
|
|
141
157
|
finalizeStorageSetup: typeof finalizeStorageSetup;
|
|
142
158
|
resolveStorageSetup: typeof resolveStorageSetup;
|
|
143
159
|
isModuleResolutionFailure: typeof isModuleResolutionFailure;
|
|
160
|
+
resolveProjectPackageEntry: typeof resolveProjectPackageEntry;
|
|
161
|
+
resolveProjectPackageTraceEntry: typeof resolveProjectPackageTraceEntry;
|
|
162
|
+
isProjectPackageLinked: typeof isProjectPackageLinked;
|
|
144
163
|
isRealtimeDefinitionModule: typeof isRealtimeDefinitionModule;
|
|
145
164
|
resolveClientOptimizeDeps: typeof resolveClientOptimizeDeps;
|
|
146
165
|
resolveExistingRealtimeDefinitionFile: typeof resolveExistingRealtimeDefinitionFile;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
1
|
+
import { lstatSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { readdir, mkdir, writeFile, access } from 'node:fs/promises';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import { resolve, extname, relative, basename, dirname } from 'node:path';
|
|
@@ -27,6 +27,68 @@ const CLIENT_OPTIMIZE_DEPS = [
|
|
|
27
27
|
include: `${HOLO_PACKAGE_SCOPE}validation > valibot`
|
|
28
28
|
}
|
|
29
29
|
];
|
|
30
|
+
const NITRO_RUNTIME_TRACE_IMPORTS = [
|
|
31
|
+
"@holo-js/auth-clerk",
|
|
32
|
+
"@holo-js/auth-social",
|
|
33
|
+
"@holo-js/auth-workos",
|
|
34
|
+
"@holo-js/authorization",
|
|
35
|
+
"@holo-js/broadcast",
|
|
36
|
+
"@holo-js/cache",
|
|
37
|
+
"@holo-js/cache-db",
|
|
38
|
+
"@holo-js/cache-redis",
|
|
39
|
+
"@holo-js/db-mysql",
|
|
40
|
+
"@holo-js/db-postgres",
|
|
41
|
+
"@holo-js/db-sqlite",
|
|
42
|
+
"@holo-js/events",
|
|
43
|
+
"@holo-js/mail",
|
|
44
|
+
"@holo-js/media",
|
|
45
|
+
"@holo-js/notifications",
|
|
46
|
+
"@holo-js/queue",
|
|
47
|
+
"@holo-js/queue-db",
|
|
48
|
+
"@holo-js/queue-redis",
|
|
49
|
+
"@holo-js/security",
|
|
50
|
+
"@holo-js/security/drivers/redis-adapter",
|
|
51
|
+
"@holo-js/session",
|
|
52
|
+
"@holo-js/session/drivers/redis-adapter",
|
|
53
|
+
"@holo-js/storage",
|
|
54
|
+
"@holo-js/storage/runtime",
|
|
55
|
+
"@holo-js/storage-s3"
|
|
56
|
+
];
|
|
57
|
+
const NITRO_RUNTIME_EXTERNALS = [
|
|
58
|
+
"@holo-js/auth",
|
|
59
|
+
"@holo-js/auth-clerk",
|
|
60
|
+
"@holo-js/auth-social",
|
|
61
|
+
"@holo-js/auth-workos",
|
|
62
|
+
"@holo-js/authorization",
|
|
63
|
+
"@holo-js/broadcast",
|
|
64
|
+
"@holo-js/cache",
|
|
65
|
+
"@holo-js/cache-db",
|
|
66
|
+
"@holo-js/cache-redis",
|
|
67
|
+
"@holo-js/config",
|
|
68
|
+
"@holo-js/core",
|
|
69
|
+
"@holo-js/db",
|
|
70
|
+
"@holo-js/db-mysql",
|
|
71
|
+
"@holo-js/db-postgres",
|
|
72
|
+
"@holo-js/db-sqlite",
|
|
73
|
+
"@holo-js/events",
|
|
74
|
+
"@holo-js/kernel",
|
|
75
|
+
"@holo-js/mail",
|
|
76
|
+
"@holo-js/media",
|
|
77
|
+
"@holo-js/notifications",
|
|
78
|
+
"@holo-js/queue",
|
|
79
|
+
"@holo-js/queue-db",
|
|
80
|
+
"@holo-js/queue-redis",
|
|
81
|
+
"@holo-js/realtime",
|
|
82
|
+
"@holo-js/security",
|
|
83
|
+
"@holo-js/session",
|
|
84
|
+
"@holo-js/storage",
|
|
85
|
+
"@holo-js/storage-s3",
|
|
86
|
+
"@holo-js/validation"
|
|
87
|
+
];
|
|
88
|
+
const NITRO_RUNTIME_INLINE_IMPORTS = [
|
|
89
|
+
"@holo-js/auth/nuxt",
|
|
90
|
+
"@holo-js/auth/nuxt/server"
|
|
91
|
+
];
|
|
30
92
|
function escapeRegExp(value) {
|
|
31
93
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
32
94
|
}
|
|
@@ -58,16 +120,58 @@ function isModuleResolutionFailure(error) {
|
|
|
58
120
|
return "code" in error && (error.code === "MODULE_NOT_FOUND" || error.code === "ERR_MODULE_NOT_FOUND");
|
|
59
121
|
}
|
|
60
122
|
function hasProjectPackage(rootDir, packageName, resolvePackage = createRequire(resolve(rootDir, "package.json")).resolve) {
|
|
123
|
+
return typeof resolveProjectPackageEntry(rootDir, packageName, resolvePackage) === "string";
|
|
124
|
+
}
|
|
125
|
+
function resolveProjectPackageEntry(rootDir, packageName, resolvePackage = createRequire(resolve(rootDir, "package.json")).resolve) {
|
|
61
126
|
try {
|
|
62
|
-
resolvePackage(packageName);
|
|
63
|
-
return true;
|
|
127
|
+
return resolvePackage(packageName);
|
|
64
128
|
} catch (error) {
|
|
65
129
|
if (isModuleResolutionFailure(error)) {
|
|
66
|
-
return
|
|
130
|
+
return void 0;
|
|
67
131
|
}
|
|
68
132
|
throw error;
|
|
69
133
|
}
|
|
70
134
|
}
|
|
135
|
+
function resolveProjectPackageTraceEntry(rootDir, packageName) {
|
|
136
|
+
const packageSegments = packageName.split("/");
|
|
137
|
+
const packageRootName = packageName.startsWith("@") ? packageSegments.slice(0, 2).join("/") : packageSegments[0];
|
|
138
|
+
if (!packageRootName) {
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
if (isProjectPackageLinked(rootDir, packageRootName)) {
|
|
142
|
+
return void 0;
|
|
143
|
+
}
|
|
144
|
+
return resolveProjectPackageEntry(rootDir, packageName);
|
|
145
|
+
}
|
|
146
|
+
function isProjectPackageLinked(rootDir, packageRootName) {
|
|
147
|
+
const projectPackageRoot = resolve(rootDir, "node_modules", packageRootName);
|
|
148
|
+
return lstatSync(projectPackageRoot, { throwIfNoEntry: false })?.isSymbolicLink() === true;
|
|
149
|
+
}
|
|
150
|
+
function addNitroRuntimeTraceIncludes(opts, rootDir, pluginPackages = [], resolvePackage = resolveProjectPackageTraceEntry) {
|
|
151
|
+
const externals = opts.nitro.externals ?? {};
|
|
152
|
+
const external = new Set(externals.external ?? []);
|
|
153
|
+
const inline = new Set(externals.inline ?? []);
|
|
154
|
+
const traceInclude = new Set(externals.traceInclude ?? []);
|
|
155
|
+
for (const specifier of NITRO_RUNTIME_EXTERNALS) {
|
|
156
|
+
external.add(specifier);
|
|
157
|
+
}
|
|
158
|
+
for (const specifier of NITRO_RUNTIME_INLINE_IMPORTS) {
|
|
159
|
+
inline.add(specifier);
|
|
160
|
+
}
|
|
161
|
+
for (const specifier of [...NITRO_RUNTIME_TRACE_IMPORTS, ...pluginPackages]) {
|
|
162
|
+
const packageEntry = resolvePackage(rootDir, specifier);
|
|
163
|
+
if (packageEntry) {
|
|
164
|
+
traceInclude.add(packageEntry);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
opts.nitro.externals = {
|
|
168
|
+
...externals,
|
|
169
|
+
external: [...external],
|
|
170
|
+
inline: [...inline],
|
|
171
|
+
trace: isProjectPackageLinked(rootDir, "@holo-js/core") ? false : externals.trace,
|
|
172
|
+
traceInclude: [...traceInclude]
|
|
173
|
+
};
|
|
174
|
+
}
|
|
71
175
|
function resolveClientOptimizeDeps(rootDir) {
|
|
72
176
|
const projectRequire = createRequire(resolve(rootDir, "package.json"));
|
|
73
177
|
const deps = [];
|
|
@@ -303,6 +407,13 @@ const module$1 = defineNuxtModule({
|
|
|
303
407
|
const s3Driver = resolver.resolve("./runtime/drivers/s3.js");
|
|
304
408
|
opts.nitro = opts.nitro || { storage: {} };
|
|
305
409
|
opts.nitro.storage = opts.nitro.storage || {};
|
|
410
|
+
if (isProjectPackageLinked(rootDir, "@holo-js/core")) {
|
|
411
|
+
opts.nitro.rollupConfig = {
|
|
412
|
+
...opts.nitro.rollupConfig,
|
|
413
|
+
preserveSymlinks: true
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
addNitroRuntimeTraceIncludes(opts, rootDir, loaded.app.plugins);
|
|
306
417
|
addNitroErrorHandler(opts, resolver.resolve("./runtime/server/error"));
|
|
307
418
|
opts.nitro.experimental = {
|
|
308
419
|
...opts.nitro.experimental || {},
|
|
@@ -380,8 +491,10 @@ const module$1 = defineNuxtModule({
|
|
|
380
491
|
storageModule.applyNitroStorageConfig(opts, normalizedStorage, s3Driver);
|
|
381
492
|
}
|
|
382
493
|
const runtimePath = resolver.resolve("./runtime");
|
|
383
|
-
|
|
384
|
-
opts.build.transpile.
|
|
494
|
+
for (const packageName of [runtimePath, "@holo-js/auth"]) {
|
|
495
|
+
if (!opts.build.transpile.includes(packageName)) {
|
|
496
|
+
opts.build.transpile.push(packageName);
|
|
497
|
+
}
|
|
385
498
|
}
|
|
386
499
|
if (storageModule && !opts._holoStorageFinalizeRegistered) {
|
|
387
500
|
opts._holoStorageFinalizeRegistered = true;
|
|
@@ -407,6 +520,7 @@ const moduleInternals = {
|
|
|
407
520
|
addViteOptimizeDeps,
|
|
408
521
|
addVitePlugin,
|
|
409
522
|
addNitroErrorHandler,
|
|
523
|
+
addNitroRuntimeTraceIncludes,
|
|
410
524
|
createRealtimeDefinitionVitePlugin,
|
|
411
525
|
existsFile,
|
|
412
526
|
hasProjectPackage,
|
|
@@ -417,6 +531,9 @@ const moduleInternals = {
|
|
|
417
531
|
finalizeStorageSetup,
|
|
418
532
|
resolveStorageSetup,
|
|
419
533
|
isModuleResolutionFailure,
|
|
534
|
+
resolveProjectPackageEntry,
|
|
535
|
+
resolveProjectPackageTraceEntry,
|
|
536
|
+
isProjectPackageLinked,
|
|
420
537
|
isRealtimeDefinitionModule,
|
|
421
538
|
resolveClientOptimizeDeps,
|
|
422
539
|
resolveExistingRealtimeDefinitionFile,
|
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.1",
|
|
4
4
|
"description": "Holo-JS Framework - Nuxt adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,20 +38,20 @@
|
|
|
38
38
|
"test": "vitest --run"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@holo-js/adapter-shared": "^0.3.
|
|
41
|
+
"@holo-js/adapter-shared": "^0.3.1",
|
|
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.1",
|
|
44
|
+
"@holo-js/core": "^0.3.1",
|
|
45
|
+
"@holo-js/db": "^0.3.1",
|
|
46
|
+
"@holo-js/validation": "^0.3.1",
|
|
47
47
|
"h3": "^1.15.11"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@holo-js/broadcast": "^0.3.
|
|
51
|
-
"@holo-js/forms": "^0.3.
|
|
52
|
-
"@holo-js/realtime": "^0.3.
|
|
53
|
-
"@holo-js/storage": "^0.3.
|
|
54
|
-
"@holo-js/storage-s3": "^0.3.
|
|
50
|
+
"@holo-js/broadcast": "^0.3.1",
|
|
51
|
+
"@holo-js/forms": "^0.3.1",
|
|
52
|
+
"@holo-js/realtime": "^0.3.1",
|
|
53
|
+
"@holo-js/storage": "^0.3.1",
|
|
54
|
+
"@holo-js/storage-s3": "^0.3.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"@holo-js/broadcast": {
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@holo-js/broadcast": "^0.3.
|
|
75
|
-
"@holo-js/realtime": "^0.3.
|
|
76
|
-
"@holo-js/storage-s3": "^0.3.
|
|
74
|
+
"@holo-js/broadcast": "^0.3.1",
|
|
75
|
+
"@holo-js/realtime": "^0.3.1",
|
|
76
|
+
"@holo-js/storage-s3": "^0.3.1",
|
|
77
77
|
"@nuxt/module-builder": "^1.0.2",
|
|
78
78
|
"@types/node": "^22.10.2",
|
|
79
79
|
"nuxt": "^4.4.4",
|