@lunora/nuxt 1.0.0-alpha.1 → 1.0.0-alpha.2

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.
@@ -0,0 +1,9 @@
1
+ import * as nuxt_schema from 'nuxt/schema';
2
+
3
+ interface ModuleOptions {
4
+ appEntry: string;
5
+ prefix: string;
6
+ }
7
+ declare const _default: nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
8
+
9
+ export { _default as default };
@@ -0,0 +1,9 @@
1
+ {
2
+ "configKey": "lunora",
3
+ "name": "@lunora/nuxt",
4
+ "version": "1.0.0-alpha.1",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "unknown"
8
+ }
9
+ }
@@ -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 add `export { ShardDO } from "./lunora/server";` so the SHARD Durable Object is exported from the worker.'
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
  }
File without changes
@@ -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 };
File without changes
@@ -0,0 +1,21 @@
1
+ const NOOP_EXECUTION_CONTEXT = {
2
+ passThroughOnException: () => {
3
+ },
4
+ waitUntil: () => {
5
+ }
6
+ };
7
+ const delegateToLunora = async (worker, request, env, context) => {
8
+ if (!env) {
9
+ return Response.json(
10
+ {
11
+ error: {
12
+ code: "LUNORA_RUNTIME_UNAVAILABLE",
13
+ 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`)."
14
+ }
15
+ },
16
+ { status: 500 }
17
+ );
18
+ }
19
+ return worker.fetch(request, env, context ?? NOOP_EXECUTION_CONTEXT);
20
+ };
21
+ export { delegateToLunora, NOOP_EXECUTION_CONTEXT };
File without changes
@@ -0,0 +1,9 @@
1
+ import { defineEventHandler, toWebRequest } from "h3";
2
+ import lunoraApp from "#lunora/app";
3
+ import { resolveCloudflare } from "../cloudflare.js";
4
+ import { delegateToLunora } from "../handler.js";
5
+ export default defineEventHandler(async (event) => {
6
+ const { ctx, env } = resolveCloudflare(event);
7
+ const request = toWebRequest(event);
8
+ return delegateToLunora(lunoraApp, request, env, ctx);
9
+ });
package/dist/server.d.mts CHANGED
@@ -1 +1 @@
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';
1
+ export { ArgsOf, AuthLike, FunctionReference, HeadersSource, Preloaded, ReturnOf, ServerClientOptions, ServerSession, createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.mjs'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/nuxt",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.2",
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",
@@ -33,16 +33,16 @@
33
33
  ],
34
34
  "type": "module",
35
35
  "sideEffects": false,
36
- "main": "./dist/index.mjs",
37
- "module": "./dist/index.mjs",
38
- "types": "./dist/index.d.ts",
36
+ "main": "./dist/module.mjs",
37
+ "module": "./dist/module.mjs",
38
+ "types": "./dist/types.d.mts",
39
39
  "exports": {
40
40
  ".": {
41
- "types": "./dist/index.d.ts",
42
- "import": "./dist/index.mjs"
41
+ "types": "./dist/types.d.mts",
42
+ "import": "./dist/module.mjs"
43
43
  },
44
44
  "./server": {
45
- "types": "./dist/server.d.ts",
45
+ "types": "./dist/server.d.mts",
46
46
  "import": "./dist/server.mjs"
47
47
  },
48
48
  "./package.json": "./package.json"
package/dist/index.d.mts DELETED
@@ -1,6 +0,0 @@
1
- interface ModuleOptions {
2
- appEntry: string;
3
- prefix: string;
4
- }
5
- declare const _default: import("nuxt/schema").NuxtModule<ModuleOptions, ModuleOptions, false>;
6
- export { _default as default };
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- interface ModuleOptions {
2
- appEntry: string;
3
- prefix: string;
4
- }
5
- declare const _default: import("nuxt/schema").NuxtModule<ModuleOptions, ModuleOptions, false>;
6
- export { _default as default };
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';