@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "configKey": "lunora",
3
3
  "name": "@lunora/nuxt",
4
- "version": "1.0.0-alpha.3",
4
+ "version": "1.0.0-alpha.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -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,6 @@
1
+ interface H3RequestNamespace {
2
+ toWebRequest?: unknown;
3
+ }
4
+ declare const resolveWebRequest: (h3: H3RequestNamespace, event: unknown) => Request;
5
+ export type { H3RequestNamespace };
6
+ export { resolveWebRequest };
@@ -0,0 +1,2 @@
1
+ const resolveWebRequest = (h3, event) => typeof h3.toWebRequest === "function" ? h3.toWebRequest(event) : event.req;
2
+ export { resolveWebRequest };
@@ -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";
@@ -1,9 +1,4 @@
1
- const NOOP_EXECUTION_CONTEXT = {
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, NOOP_EXECUTION_CONTEXT };
16
+ export { delegateToLunora };
17
+ export { NOOP_EXECUTION_CONTEXT } from "../../../../shared/execution-context";
@@ -0,0 +1,3 @@
1
+ import * as h3 from "h3";
2
+ declare const _default: h3.EventHandler<h3.EventHandlerRequest, Promise<Response>>;
3
+ export default _default;
@@ -1,9 +1,10 @@
1
- import { defineEventHandler, toWebRequest } from "h3";
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 = toWebRequest(event);
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.4",
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.3",
55
- "@nuxt/kit": "^4.0.0"
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": {