@lunora/nuxt 1.0.0-alpha.4 → 1.0.0-alpha.5
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.json +1 -1
- package/dist/runtime/cloudflare.d.ts +24 -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 +3 -7
- package/dist/runtime/server/lunora.d.ts +3 -0
- package/dist/runtime/server/lunora.js +4 -3
- package/package.json +4 -4
package/dist/module.json
CHANGED
|
@@ -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,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";
|
package/dist/runtime/handler.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
passThroughOnException: () => {
|
|
3
|
-
},
|
|
4
|
-
waitUntil: () => {
|
|
5
|
-
}
|
|
6
|
-
};
|
|
1
|
+
import { NOOP_EXECUTION_CONTEXT } from "../../../../shared/execution-context";
|
|
7
2
|
const delegateToLunora = async (worker, request, env, context) => {
|
|
8
3
|
if (!env) {
|
|
9
4
|
return Response.json(
|
|
@@ -18,4 +13,5 @@ const delegateToLunora = async (worker, request, env, context) => {
|
|
|
18
13
|
}
|
|
19
14
|
return worker.fetch(request, env, context ?? NOOP_EXECUTION_CONTEXT);
|
|
20
15
|
};
|
|
21
|
-
export { delegateToLunora
|
|
16
|
+
export { delegateToLunora };
|
|
17
|
+
export { NOOP_EXECUTION_CONTEXT } from "../../../../shared/execution-context";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as h3 from "h3";
|
|
2
2
|
import lunoraApp from "#lunora/app";
|
|
3
3
|
import { resolveCloudflare } from "../cloudflare.js";
|
|
4
|
+
import { resolveWebRequest } from "../h3-request.js";
|
|
4
5
|
import { delegateToLunora } from "../handler.js";
|
|
5
|
-
export default defineEventHandler(async (event) => {
|
|
6
|
+
export default h3.defineEventHandler(async (event) => {
|
|
6
7
|
const { ctx, env } = resolveCloudflare(event);
|
|
7
|
-
const request =
|
|
8
|
+
const request = resolveWebRequest(h3, event);
|
|
8
9
|
return delegateToLunora(lunoraApp, request, env, ctx);
|
|
9
10
|
});
|
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.5",
|
|
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",
|
|
@@ -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.4",
|
|
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": {
|