@lunora/nuxt 1.0.0-alpha.1 → 1.0.0-alpha.10
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/README.md +98 -1
- package/__assets__/package-og.svg +1 -1
- package/dist/module.d.mts +9 -0
- package/dist/module.json +9 -0
- package/dist/{packem_shared/default-C1ZbJCWN.mjs → module.mjs} +1 -1
- package/dist/runtime/cloudflare.d.ts +24 -0
- package/dist/runtime/cloudflare.js +12 -0
- package/dist/runtime/h3-request.d.ts +6 -0
- package/dist/runtime/h3-request.js +2 -0
- package/dist/runtime/handler.d.ts +8 -0
- package/dist/runtime/handler.js +17 -0
- package/dist/runtime/server/lunora.d.ts +3 -0
- package/dist/runtime/server/lunora.js +10 -0
- package/dist/server.d.mts +1 -1
- package/dist/types.d.mts +7 -0
- package/package.json +11 -11
- package/dist/index.d.mts +0 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.mjs +0 -1
- package/dist/server.d.ts +0 -1
package/dist/module.json
ADDED
|
@@ -20,7 +20,7 @@ const module$1 = defineNuxtModule({
|
|
|
20
20
|
});
|
|
21
21
|
if (!existsSync(join(nuxt.options.rootDir, "exports.cloudflare.ts"))) {
|
|
22
22
|
useLogger("@lunora/nuxt").warn(
|
|
23
|
-
'missing exports.cloudflare.ts at the project root
|
|
23
|
+
'missing exports.cloudflare.ts at the project root \u2014 add `export { ShardDO } from "./lunora/server";` so the SHARD Durable Object is exported from the worker.'
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ExecutionContextLike } from "../../../../shared/execution-context.js";
|
|
2
|
+
interface CloudflareEventBag {
|
|
3
|
+
context?: ExecutionContextLike;
|
|
4
|
+
ctx?: ExecutionContextLike;
|
|
5
|
+
env?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
interface H3EventLike {
|
|
8
|
+
context?: {
|
|
9
|
+
cloudflare?: CloudflareEventBag;
|
|
10
|
+
};
|
|
11
|
+
req?: {
|
|
12
|
+
runtime?: {
|
|
13
|
+
cloudflare?: CloudflareEventBag;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface ResolvedCloudflare {
|
|
18
|
+
ctx?: ExecutionContextLike;
|
|
19
|
+
env?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
declare const resolveCloudflare: (event: H3EventLike) => ResolvedCloudflare;
|
|
22
|
+
export type { H3EventLike, ResolvedCloudflare };
|
|
23
|
+
export { resolveCloudflare };
|
|
24
|
+
export { type ExecutionContextLike } from "../../../../shared/execution-context.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const resolveCloudflare = (event) => {
|
|
2
|
+
const fromContext = event.context?.cloudflare;
|
|
3
|
+
if (fromContext?.env) {
|
|
4
|
+
return { ctx: fromContext.context ?? fromContext.ctx, env: fromContext.env };
|
|
5
|
+
}
|
|
6
|
+
const fromRuntime = event.req?.runtime?.cloudflare;
|
|
7
|
+
if (fromRuntime?.env) {
|
|
8
|
+
return { ctx: fromRuntime.ctx ?? fromRuntime.context, env: fromRuntime.env };
|
|
9
|
+
}
|
|
10
|
+
return {};
|
|
11
|
+
};
|
|
12
|
+
export { resolveCloudflare };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutionContextLike } from "../../../../shared/execution-context.js";
|
|
2
|
+
interface LunoraWorkerLike {
|
|
3
|
+
fetch: (request: Request, env: unknown, context: ExecutionContextLike) => Promise<Response> | Response;
|
|
4
|
+
}
|
|
5
|
+
declare const delegateToLunora: (worker: LunoraWorkerLike, request: Request, env: Record<string, unknown> | undefined, context?: ExecutionContextLike) => Promise<Response>;
|
|
6
|
+
export type { LunoraWorkerLike };
|
|
7
|
+
export { delegateToLunora };
|
|
8
|
+
export { NOOP_EXECUTION_CONTEXT } from "../../../../shared/execution-context.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NOOP_EXECUTION_CONTEXT } from "../../../../shared/execution-context";
|
|
2
|
+
const delegateToLunora = async (worker, request, env, context) => {
|
|
3
|
+
if (!env) {
|
|
4
|
+
return Response.json(
|
|
5
|
+
{
|
|
6
|
+
error: {
|
|
7
|
+
code: "LUNORA_RUNTIME_UNAVAILABLE",
|
|
8
|
+
message: "Lunora could not read the Cloudflare bindings from the request. The `/_lunora/**` route only works on the Cloudflare Workers runtime (deployed, or `nuxt dev` with `nitro-cloudflare-dev`)."
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
{ status: 500 }
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return worker.fetch(request, env, context ?? NOOP_EXECUTION_CONTEXT);
|
|
15
|
+
};
|
|
16
|
+
export { delegateToLunora };
|
|
17
|
+
export { NOOP_EXECUTION_CONTEXT } from "../../../../shared/execution-context";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as h3 from "h3";
|
|
2
|
+
import lunoraApp from "#lunora/app";
|
|
3
|
+
import { resolveCloudflare } from "../cloudflare.js";
|
|
4
|
+
import { resolveWebRequest } from "../h3-request.js";
|
|
5
|
+
import { delegateToLunora } from "../handler.js";
|
|
6
|
+
export default h3.defineEventHandler(async (event) => {
|
|
7
|
+
const { ctx, env } = resolveCloudflare(event);
|
|
8
|
+
const request = resolveWebRequest(h3, event);
|
|
9
|
+
return delegateToLunora(lunoraApp, request, env, ctx);
|
|
10
|
+
});
|
package/dist/server.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ArgsOf, AuthLike, FunctionReference, HeadersSource, Preloaded, ReturnOf, ServerClientOptions, ServerSession, createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
|
package/dist/types.d.mts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/nuxt",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"description": "Nuxt module for Lunora — single-worker composition (mounts /_lunora/* into Nitro) plus reactive-loader server helpers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -26,23 +26,23 @@
|
|
|
26
26
|
"directory": "packages/nuxt"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"dist",
|
|
29
|
+
"./dist",
|
|
30
30
|
"README.md",
|
|
31
31
|
"LICENSE.md",
|
|
32
32
|
"__assets__"
|
|
33
33
|
],
|
|
34
34
|
"type": "module",
|
|
35
35
|
"sideEffects": false,
|
|
36
|
-
"main": "./dist/
|
|
37
|
-
"module": "./dist/
|
|
38
|
-
"types": "./dist/
|
|
36
|
+
"main": "./dist/module.mjs",
|
|
37
|
+
"module": "./dist/module.mjs",
|
|
38
|
+
"types": "./dist/types.d.mts",
|
|
39
39
|
"exports": {
|
|
40
40
|
".": {
|
|
41
|
-
"types": "./dist/
|
|
42
|
-
"import": "./dist/
|
|
41
|
+
"types": "./dist/types.d.mts",
|
|
42
|
+
"import": "./dist/module.mjs"
|
|
43
43
|
},
|
|
44
44
|
"./server": {
|
|
45
|
-
"types": "./dist/server.d.
|
|
45
|
+
"types": "./dist/server.d.mts",
|
|
46
46
|
"import": "./dist/server.mjs"
|
|
47
47
|
},
|
|
48
48
|
"./package.json": "./package.json"
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@lunora/client": "1.0.0-alpha.
|
|
55
|
-
"@nuxt/kit": "^4.
|
|
54
|
+
"@lunora/client": "1.0.0-alpha.8",
|
|
55
|
+
"@nuxt/kit": "^4.4.8"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"h3": "^1.0.0",
|
|
58
|
+
"h3": "^1.0.0 || ^2.0.0",
|
|
59
59
|
"nuxt": "^4.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
package/dist/index.d.mts
DELETED
package/dist/index.d.ts
DELETED
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './packem_shared/default-C1ZbJCWN.mjs';
|
package/dist/server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { type ArgsOf, type AuthLike, type FunctionReference, type HeadersSource, type Preloaded, type ReturnOf, type ServerClientOptions, type ServerSession, createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
|