@lunora/nuxt 1.0.0-alpha.25 → 1.0.0-alpha.27

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 CHANGED
@@ -59,14 +59,23 @@ export default defineNuxtConfig({
59
59
  });
60
60
  ```
61
61
 
62
- Add `exports.cloudflare.ts` to the project root so the `ShardDO` Durable Object
63
- class is exported from the emitted worker entry:
62
+ Add a `worker.ts` wrapper at the project root and point `wrangler.jsonc`'s `main`
63
+ at it, so the `ShardDO` Durable Object class is exported from the deployed worker.
64
+ Nitro's `cloudflare_module` output exports only the SSR handler, so `main` must
65
+ point at the wrapper — not the raw `.output/server/index.mjs` — or `wrangler deploy`
66
+ fails on the missing DO class:
64
67
 
65
68
  ```ts
66
- // exports.cloudflare.ts
69
+ // worker.ts
70
+ export { default } from "./.output/server/index.mjs";
67
71
  export { ShardDO } from "./lunora/server";
68
72
  ```
69
73
 
74
+ ```jsonc
75
+ // wrangler.jsonc
76
+ { "main": "worker.ts" }
77
+ ```
78
+
70
79
  `lunora/server.ts` is your built Lunora app (`defineApp().build()`) — its default
71
80
  export is the worker (a `fetch` entrypoint), and it re-exports `ShardDO`. The
72
81
  module aliases the `#lunora/app` virtual to it (configurable via the `lunora.appEntry`
@@ -88,8 +97,8 @@ option, default `~/lunora/server`) and serves it at the `/_lunora/**` route
88
97
  and forwards to your app's `fetch`. A missing Cloudflare runtime answers a clear 500.
89
98
  - **`#lunora/app` alias**: points the route's worker import at your app entry,
90
99
  forwarded into the Nitro server bundle via `nuxt.options.alias`.
91
- - **`ShardDO`** rides to the worker entry through your root `exports.cloudflare.ts`
92
- (the `cloudflare_module` preset appends its exports).
100
+ - **`ShardDO`** rides to the deployed worker through your root `worker.ts` wrapper
101
+ (`wrangler.jsonc`'s `main`), which re-exports Nitro's SSR handler and `ShardDO`.
93
102
 
94
103
  ## Verify before deploy
95
104
 
@@ -102,11 +111,12 @@ Single-worker composition rides on two Nitro behaviours that vary across version
102
111
  subscriptions never connect while RPC does, Nitro is normalising the upgrade
103
112
  response and `/_lunora/ws` needs a deploy-boundary handoff instead of the H3
104
113
  route return.
105
- 2. **`exports.cloudflare.ts` hook.** The `cloudflare_module` preset must append
106
- this file's exports onto the worker entry. If `wrangler deploy` fails with
107
- "ShardDO class not exported", your Nitro version may use a different hook
108
- (`nitro.cloudflare.additionalModules`, or a `rollupConfig` output export). The
109
- module `warn()`s when the file is missing but can't verify the hook fires.
114
+ 2. **`worker.ts` wrapper.** `wrangler.jsonc`'s `main` must point at a root
115
+ `worker.ts` that re-exports Nitro's SSR handler _and_ `ShardDO` Nitro's
116
+ `cloudflare_module` output exports only the SSR handler. If `wrangler deploy`
117
+ fails with "ShardDO class not exported", check that `main` points at the
118
+ wrapper and that it re-exports `ShardDO`. The module `warn()`s when
119
+ `worker.ts` is missing but can't verify wrangler's `main` points at it.
110
120
 
111
121
  ## Server data-loading
112
122
 
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.24",
4
+ "version": "1.0.0-alpha.26",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -2,7 +2,6 @@ import { existsSync } from 'node:fs';
2
2
  import { join, resolve, dirname } from 'node:path';
3
3
  import { defineNuxtModule, createResolver, addServerHandler, useLogger } from '@nuxt/kit';
4
4
 
5
- const JS_EXTENSION_SUFFIX = /\.js$/;
6
5
  const resolveTildePath = (specifier, rootDirectory, sourceDirectory) => {
7
6
  if (specifier.startsWith("~~/")) {
8
7
  return join(rootDirectory, specifier.slice(3));
@@ -10,8 +9,13 @@ const resolveTildePath = (specifier, rootDirectory, sourceDirectory) => {
10
9
  if (specifier.startsWith("~/")) {
11
10
  return join(sourceDirectory, specifier.slice(2));
12
11
  }
12
+ if (specifier.startsWith("./") || specifier.startsWith("../")) {
13
+ return join(rootDirectory, specifier);
14
+ }
13
15
  return specifier;
14
16
  };
17
+
18
+ const JS_EXTENSION_SUFFIX = /\.js$/;
15
19
  const lunoraTsSourceResolver = (rootDirectory) => {
16
20
  const lunoraDirectory = join(rootDirectory, "lunora");
17
21
  return {
@@ -1,2 +1,3 @@
1
- declare const _default: any;
1
+ import * as h3 from "h3";
2
+ declare const _default: h3.EventHandler<h3.EventHandlerRequest, Promise<Response>>;
2
3
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/nuxt",
3
- "version": "1.0.0-alpha.25",
3
+ "version": "1.0.0-alpha.27",
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,8 +51,8 @@
51
51
  "access": "public"
52
52
  },
53
53
  "dependencies": {
54
- "@lunora/client": "1.0.0-alpha.20",
55
- "@lunora/runtime": "1.0.0-alpha.22",
54
+ "@lunora/client": "1.0.0-alpha.21",
55
+ "@lunora/runtime": "1.0.0-alpha.24",
56
56
  "@nuxt/kit": "^4.4.8"
57
57
  },
58
58
  "peerDependencies": {