@lunora/nuxt 0.0.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.
- package/LICENSE.md +105 -0
- package/README.md +78 -43
- package/__assets__/package-og.svg +14 -0
- package/dist/module.d.mts +9 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +29 -0
- package/dist/runtime/cloudflare.d.ts +0 -0
- package/dist/runtime/cloudflare.js +12 -0
- package/dist/runtime/handler.d.ts +0 -0
- package/dist/runtime/handler.js +21 -0
- package/dist/runtime/server/lunora.d.ts +0 -0
- package/dist/runtime/server/lunora.js +9 -0
- package/dist/server.d.mts +1 -0
- package/dist/server.mjs +1 -0
- package/dist/types.d.mts +7 -0
- package/package.json +69 -7
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { defineNuxtModule, createResolver, addServerHandler, useLogger } from '@nuxt/kit';
|
|
4
|
+
|
|
5
|
+
const module$1 = defineNuxtModule({
|
|
6
|
+
defaults: {
|
|
7
|
+
appEntry: "~/lunora/server",
|
|
8
|
+
prefix: "/_lunora"
|
|
9
|
+
},
|
|
10
|
+
meta: {
|
|
11
|
+
configKey: "lunora",
|
|
12
|
+
name: "@lunora/nuxt"
|
|
13
|
+
},
|
|
14
|
+
setup(options, nuxt) {
|
|
15
|
+
const resolver = createResolver(import.meta.url);
|
|
16
|
+
nuxt.options.alias["#lunora/app"] = options.appEntry;
|
|
17
|
+
addServerHandler({
|
|
18
|
+
handler: resolver.resolve("./runtime/server/lunora"),
|
|
19
|
+
route: `${options.prefix}/**`
|
|
20
|
+
});
|
|
21
|
+
if (!existsSync(join(nuxt.options.rootDir, "exports.cloudflare.ts"))) {
|
|
22
|
+
useLogger("@lunora/nuxt").warn(
|
|
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
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { module$1 as default };
|
|
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
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ArgsOf, AuthLike, FunctionReference, HeadersSource, Preloaded, ReturnOf, ServerClientOptions, ServerSession, createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
|
package/dist/server.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
|
package/dist/types.d.mts
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/nuxt",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
|
+
"description": "Nuxt module for Lunora — single-worker composition (mounts /_lunora/* into Nitro) plus reactive-loader server helpers",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
"cloudflare",
|
|
7
|
+
"durable-objects",
|
|
8
|
+
"lunora",
|
|
9
|
+
"nitro",
|
|
10
|
+
"nuxt",
|
|
11
|
+
"nuxt-module",
|
|
12
|
+
"realtime",
|
|
13
|
+
"ssr",
|
|
14
|
+
"workers"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://lunora.sh",
|
|
17
|
+
"bugs": "https://github.com/anolilab/lunora/issues",
|
|
18
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "Daniel Bannert",
|
|
21
|
+
"email": "d.bannert@anolilab.de"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/anolilab/lunora.git",
|
|
26
|
+
"directory": "packages/nuxt"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE.md",
|
|
32
|
+
"__assets__"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"main": "./dist/module.mjs",
|
|
37
|
+
"module": "./dist/module.mjs",
|
|
38
|
+
"types": "./dist/types.d.mts",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/types.d.mts",
|
|
42
|
+
"import": "./dist/module.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./server": {
|
|
45
|
+
"types": "./dist/server.d.mts",
|
|
46
|
+
"import": "./dist/server.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./package.json": "./package.json"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@lunora/client": "1.0.0-alpha.1",
|
|
55
|
+
"@nuxt/kit": "^4.0.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"h3": "^1.0.0",
|
|
59
|
+
"nuxt": "^4.0.0"
|
|
60
|
+
},
|
|
61
|
+
"peerDependenciesMeta": {
|
|
62
|
+
"h3": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"nuxt": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": "^22.15.0 || >=24.11.0"
|
|
71
|
+
}
|
|
72
|
+
}
|