@rshono/core 1.0.0-rc.6 → 1.0.0-rc.8
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 +195 -168
- package/dist/builder/page-files.d.ts.map +1 -1
- package/dist/builder/page-files.js +7 -3
- package/dist/builder/page-files.js.map +1 -1
- package/dist/builder/public-env.d.ts +6 -0
- package/dist/builder/public-env.d.ts.map +1 -1
- package/dist/builder/public-env.js +6 -0
- package/dist/builder/public-env.js.map +1 -1
- package/dist/builder/rspack-config.d.ts.map +1 -1
- package/dist/builder/rspack-config.js +16 -19
- package/dist/builder/rspack-config.js.map +1 -1
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/dev.js +63 -35
- package/dist/cli/dev.js.map +1 -1
- package/dist/cli/index.js +3 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/config.d.ts +56 -55
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -1
- package/dist/config.js.map +1 -1
- package/dist/deploy/contract.d.ts +15 -10
- package/dist/deploy/contract.d.ts.map +1 -1
- package/dist/deploy/contract.js.map +1 -1
- package/dist/deploy/filesystem.d.ts.map +1 -1
- package/dist/deploy/filesystem.js +6 -7
- package/dist/deploy/filesystem.js.map +1 -1
- package/dist/deploy/node/runtime.d.ts +5 -5
- package/dist/deploy/node/runtime.d.ts.map +1 -1
- package/dist/deploy/node/runtime.js +7 -11
- package/dist/deploy/node/runtime.js.map +1 -1
- package/dist/deploy/presets.d.ts +2 -6
- package/dist/deploy/presets.d.ts.map +1 -1
- package/dist/deploy/presets.js +2 -6
- package/dist/deploy/presets.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/router.d.ts +74 -36
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +2 -3
- package/dist/router.js.map +1 -1
- package/dist/runtime/boundaries.d.ts +10 -0
- package/dist/runtime/boundaries.d.ts.map +1 -1
- package/dist/runtime/boundaries.js +6 -0
- package/dist/runtime/boundaries.js.map +1 -1
- package/dist/runtime/client.d.ts +5 -3
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +5 -3
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/context.d.ts +195 -45
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js +277 -59
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/control.d.ts.map +1 -1
- package/dist/runtime/control.js +7 -0
- package/dist/runtime/control.js.map +1 -1
- package/dist/runtime/entry.client.js +29 -47
- package/dist/runtime/entry.client.js.map +1 -1
- package/dist/runtime/entry.rsc.d.ts.map +1 -1
- package/dist/runtime/entry.rsc.js +109 -140
- package/dist/runtime/entry.rsc.js.map +1 -1
- package/dist/runtime/flight-inject.d.ts +4 -4
- package/dist/runtime/flight-inject.js +2 -2
- package/dist/runtime/flight-inject.js.map +1 -1
- package/dist/runtime/navigation.d.ts +11 -0
- package/dist/runtime/navigation.d.ts.map +1 -1
- package/dist/runtime/navigation.js +3 -0
- package/dist/runtime/navigation.js.map +1 -1
- package/dist/runtime/request.d.ts +3 -3
- package/dist/runtime/request.js +3 -3
- package/dist/runtime/request.js.map +1 -1
- package/dist/runtime/server.d.ts +7 -12
- package/dist/runtime/server.d.ts.map +1 -1
- package/dist/runtime/server.js +15 -12
- package/dist/runtime/server.js.map +1 -1
- package/dist/server/prerendered.d.ts +20 -35
- package/dist/server/prerendered.d.ts.map +1 -1
- package/dist/server/prerendered.js +8 -18
- package/dist/server/prerendered.js.map +1 -1
- package/dist/server/server-config.d.ts +10 -29
- package/dist/server/server-config.d.ts.map +1 -1
- package/dist/server/server-config.js +4 -70
- package/dist/server/server-config.js.map +1 -1
- package/dist/server/ssg.d.ts.map +1 -1
- package/dist/server/ssg.js +10 -11
- package/dist/server/ssg.js.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -11,16 +11,21 @@ export interface RspackHookContext {
|
|
|
11
11
|
* Project configuration for rshono, default-exported from `rshono.config.ts` at the project root
|
|
12
12
|
* (`.js` / `.mjs` also work). Every field is optional; omit the file entirely to accept all defaults.
|
|
13
13
|
*
|
|
14
|
+
* Deliberately small: it holds what only the *build* can decide. Everything that is a per-request
|
|
15
|
+
* concern — CSRF, CSP, the body cap — is Hono middleware in `src/server.ts` instead, because Hono
|
|
16
|
+
* already ships all of it and a config field would only be a worse way to spell the same call.
|
|
17
|
+
*
|
|
14
18
|
* @example
|
|
15
19
|
* ```ts
|
|
16
20
|
* import { defineConfig } from '@rshono/core';
|
|
17
21
|
*
|
|
18
22
|
* export default defineConfig({
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* allowedOrigins: ['https://admin.example.com'],
|
|
23
|
+
* deploy: 'cloudflare',
|
|
24
|
+
* siteUrl: 'https://example.com',
|
|
22
25
|
* });
|
|
23
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://www.rshono.com/docs/configuration | Docs — configuration}
|
|
24
29
|
*/
|
|
25
30
|
export interface RshonoConfig {
|
|
26
31
|
/**
|
|
@@ -30,79 +35,75 @@ export interface RshonoConfig {
|
|
|
30
35
|
* Overridden by the `--deploy` flag or the `RSHONO_DEPLOY` env var, so one config can still be
|
|
31
36
|
* built for more than one place. `rshono dev` ignores it entirely and always runs the Node dev
|
|
32
37
|
* server.
|
|
38
|
+
*
|
|
39
|
+
* @see {@link https://www.rshono.com/docs/deployment | Docs — deployment}
|
|
33
40
|
*/
|
|
34
41
|
deploy?: DeployTarget;
|
|
35
42
|
/**
|
|
36
43
|
* The public origin the site is served from, e.g. `'https://example.com'`.
|
|
37
44
|
*
|
|
38
|
-
* Only used when prerendering `render: 'static'` routes
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* `og:url`. Dynamic routes are unaffected: they resolve the URL per request.
|
|
45
|
+
* Only used when prerendering `render: 'static'` routes: they are rendered once at build time, with
|
|
46
|
+
* no request to read a `Host` from, so a page's `url` prop falls back to `http://localhost` without
|
|
47
|
+
* this — and that is what its canonical tag, absolute links and `og:url` get baked with. Dynamic
|
|
48
|
+
* routes resolve the URL per request and are unaffected.
|
|
43
49
|
*
|
|
44
|
-
*
|
|
50
|
+
* Must be a bare origin; a path is rejected rather than silently dropped.
|
|
51
|
+
*
|
|
52
|
+
* @see {@link https://www.rshono.com/docs/configuration#siteurl | Docs — siteUrl}
|
|
45
53
|
*/
|
|
46
54
|
siteUrl?: string;
|
|
47
55
|
/**
|
|
48
56
|
* Honour `X-Forwarded-Host` / `X-Forwarded-Proto` when resolving the browser-facing request
|
|
49
|
-
* URL
|
|
57
|
+
* URL — `getRequestContext().url` and a page's `url` prop.
|
|
58
|
+
*
|
|
59
|
+
* Middleware in `src/server.ts` is handed Hono's `c` and so reads `c.req.url`, the *internal*
|
|
60
|
+
* address, whatever this says. Hono's `csrf()` is the one to watch: behind a proxy that rewrites
|
|
61
|
+
* `Host`, give it the public origin explicitly (`csrf({ origin: 'https://example.com' })`) rather
|
|
62
|
+
* than leaving it to compare against an address the browser never used.
|
|
50
63
|
*
|
|
51
|
-
* **Off by default, and leave it off unless a proxy you control sets those headers
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
64
|
+
* **Off by default, and leave it off unless a proxy you control sets those headers**: any client
|
|
65
|
+
* can send them, so with nothing stripping them at the edge one request can point every absolute
|
|
66
|
+
* URL the app builds at an attacker's host (and poison a shared cache). Turn it on when you
|
|
67
|
+
* terminate TLS or rewrite `Host` at a reverse proxy / load balancer. Always `true` under
|
|
68
|
+
* `rshono dev`, where the framework's own proxy sets them and binds to localhost. Default `false`.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Host | MDN — X-Forwarded-Host}
|
|
71
|
+
* @see {@link https://www.rshono.com/docs/configuration#proxy-headers | Docs — proxy headers}
|
|
57
72
|
*/
|
|
58
73
|
trustProxy?: boolean;
|
|
59
74
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
checkOrigin?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Extra origins allowed to post server actions, in addition to the app's own origin.
|
|
66
|
-
* Accepts full origins or bare hosts, e.g. `['https://admin.example.com', 'localhost:4000']`.
|
|
67
|
-
*/
|
|
68
|
-
allowedOrigins?: string[];
|
|
69
|
-
/**
|
|
70
|
-
* Send a strict per-request-nonce `Content-Security-Policy` with every HTML document.
|
|
71
|
-
* While enabled, `render: 'static'` routes render per request (a prerendered file can't carry a
|
|
72
|
-
* per-request nonce). Default `false`.
|
|
73
|
-
*/
|
|
74
|
-
csp?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Directives merged over the built-in {@link csp} policy, which is deliberately strict
|
|
77
|
-
* (`default-src 'self'`, no framing, no plugins) and so blocks third-party images, fonts and
|
|
78
|
-
* API hosts until you widen it here. Set a directive to `''` to drop it entirely.
|
|
79
|
-
*
|
|
80
|
-
* The per-request nonce is always appended to `script-src`, whatever you put there.
|
|
81
|
-
* Ignored unless `csp` is `true`.
|
|
75
|
+
* Escape hatch: mutate the generated Rspack config just before it's compiled. Called once per
|
|
76
|
+
* compiler — inspect {@link RspackHookContext.isServer} to tell them apart. Mutate `config` in
|
|
77
|
+
* place and return nothing, or return a replacement.
|
|
82
78
|
*
|
|
83
79
|
* @example
|
|
84
80
|
* ```ts
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* 'font-src': "'self' https://fonts.gstatic.com",
|
|
88
|
-
* 'frame-ancestors': "'self'",
|
|
81
|
+
* rspack(config, { isServer }) {
|
|
82
|
+
* config.module?.rules?.push({ test: /\.svg$/, type: 'asset/source' });
|
|
89
83
|
* }
|
|
90
84
|
* ```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* Max server-action request body before it's rejected with 413 — a memory-exhaustion guard.
|
|
95
|
-
* A number is bytes; a string carries a unit (`'512kb'`, `'4mb'`); `false` (or `0`) disables the cap.
|
|
96
|
-
* Default `'1mb'`.
|
|
97
|
-
*/
|
|
98
|
-
bodySizeLimit?: string | number | false;
|
|
99
|
-
/**
|
|
100
|
-
* Escape hatch: mutate the generated Rspack config just before it's compiled. Called once per
|
|
101
|
-
* compiler — inspect {@link RspackHookContext.isServer} to tell them apart. Mutate `config` in
|
|
102
|
-
* place and return nothing, or return a replacement.
|
|
85
|
+
*
|
|
86
|
+
* @see {@link https://rspack.rs/config/ | Rspack — configuration reference}
|
|
87
|
+
* @see {@link https://www.rshono.com/docs/configuration#the-rspack-hook | Docs — the rspack hook}
|
|
103
88
|
*/
|
|
104
89
|
rspack?: (config: RspackOptions, ctx: RspackHookContext) => RspackOptions | void;
|
|
105
90
|
}
|
|
106
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Identity helper that types a config object — gives editor autocomplete without an explicit
|
|
93
|
+
* annotation. Default-export the result from `rshono.config.ts`.
|
|
94
|
+
*
|
|
95
|
+
* @param config - The project's {@link RshonoConfig}; every field is optional.
|
|
96
|
+
* @returns The config, unchanged and fully typed.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* // rshono.config.ts
|
|
101
|
+
* import { defineConfig } from '@rshono/core';
|
|
102
|
+
*
|
|
103
|
+
* export default defineConfig({ deploy: 'cloudflare', siteUrl: 'https://example.com' });
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see {@link https://www.rshono.com/docs/configuration | Docs — configuration}
|
|
107
|
+
*/
|
|
107
108
|
export declare function defineConfig(config: RshonoConfig): RshonoConfig;
|
|
108
109
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,kGAAkG;AAClG,MAAM,WAAW,iBAAiB;IAChC,oGAAoG;IACpG,QAAQ,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,KAAK,EAAE,OAAO,CAAC;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,kGAAkG;AAClG,MAAM,WAAW,iBAAiB;IAChC,oGAAoG;IACpG,QAAQ,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,iBAAiB,KAAK,aAAa,GAAG,IAAI,CAAC;CAClF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAE/D"}
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Identity helper that types a config object — gives editor autocomplete without an explicit
|
|
3
|
+
* annotation. Default-export the result from `rshono.config.ts`.
|
|
4
|
+
*
|
|
5
|
+
* @param config - The project's {@link RshonoConfig}; every field is optional.
|
|
6
|
+
* @returns The config, unchanged and fully typed.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // rshono.config.ts
|
|
11
|
+
* import { defineConfig } from '@rshono/core';
|
|
12
|
+
*
|
|
13
|
+
* export default defineConfig({ deploy: 'cloudflare', siteUrl: 'https://example.com' });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://www.rshono.com/docs/configuration | Docs — configuration}
|
|
17
|
+
*/
|
|
2
18
|
export function defineConfig(config) {
|
|
3
19
|
return config;
|
|
4
20
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AA6FA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { RspackOptions } from '@rspack/core';\nimport type { DeployTarget } from './deploy/contract.js';\n\n/** Which of the two Rspack compilers the {@link RshonoConfig.rspack} hook is being called for. */\nexport interface RspackHookContext {\n /** `true` for the server (`target: node`) bundle, `false` for the client (`target: web`) bundle. */\n isServer: boolean;\n /** `true` under `rshono dev`, `false` under `rshono build`. */\n isDev: boolean;\n}\n\n/**\n * Project configuration for rshono, default-exported from `rshono.config.ts` at the project root\n * (`.js` / `.mjs` also work). Every field is optional; omit the file entirely to accept all defaults.\n *\n * Deliberately small: it holds what only the *build* can decide. Everything that is a per-request\n * concern — CSRF, CSP, the body cap — is Hono middleware in `src/server.ts` instead, because Hono\n * already ships all of it and a config field would only be a worse way to spell the same call.\n *\n * @example\n * ```ts\n * import { defineConfig } from '@rshono/core';\n *\n * export default defineConfig({\n * deploy: 'cloudflare',\n * siteUrl: 'https://example.com',\n * });\n * ```\n *\n * @see {@link https://www.rshono.com/docs/configuration | Docs — configuration}\n */\nexport interface RshonoConfig {\n /**\n * The hosting platform `rshono build` targets. Default `'node'` — a long-lived server process, for\n * a VPS, a container or anywhere else you run `rshono start`.\n *\n * Overridden by the `--deploy` flag or the `RSHONO_DEPLOY` env var, so one config can still be\n * built for more than one place. `rshono dev` ignores it entirely and always runs the Node dev\n * server.\n *\n * @see {@link https://www.rshono.com/docs/deployment | Docs — deployment}\n */\n deploy?: DeployTarget;\n /**\n * The public origin the site is served from, e.g. `'https://example.com'`.\n *\n * Only used when prerendering `render: 'static'` routes: they are rendered once at build time, with\n * no request to read a `Host` from, so a page's `url` prop falls back to `http://localhost` without\n * this — and that is what its canonical tag, absolute links and `og:url` get baked with. Dynamic\n * routes resolve the URL per request and are unaffected.\n *\n * Must be a bare origin; a path is rejected rather than silently dropped.\n *\n * @see {@link https://www.rshono.com/docs/configuration#siteurl | Docs — siteUrl}\n */\n siteUrl?: string;\n /**\n * Honour `X-Forwarded-Host` / `X-Forwarded-Proto` when resolving the browser-facing request\n * URL — `getRequestContext().url` and a page's `url` prop.\n *\n * Middleware in `src/server.ts` is handed Hono's `c` and so reads `c.req.url`, the *internal*\n * address, whatever this says. Hono's `csrf()` is the one to watch: behind a proxy that rewrites\n * `Host`, give it the public origin explicitly (`csrf({ origin: 'https://example.com' })`) rather\n * than leaving it to compare against an address the browser never used.\n *\n * **Off by default, and leave it off unless a proxy you control sets those headers**: any client\n * can send them, so with nothing stripping them at the edge one request can point every absolute\n * URL the app builds at an attacker's host (and poison a shared cache). Turn it on when you\n * terminate TLS or rewrite `Host` at a reverse proxy / load balancer. Always `true` under\n * `rshono dev`, where the framework's own proxy sets them and binds to localhost. Default `false`.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-Host | MDN — X-Forwarded-Host}\n * @see {@link https://www.rshono.com/docs/configuration#proxy-headers | Docs — proxy headers}\n */\n trustProxy?: boolean;\n /**\n * Escape hatch: mutate the generated Rspack config just before it's compiled. Called once per\n * compiler — inspect {@link RspackHookContext.isServer} to tell them apart. Mutate `config` in\n * place and return nothing, or return a replacement.\n *\n * @example\n * ```ts\n * rspack(config, { isServer }) {\n * config.module?.rules?.push({ test: /\\.svg$/, type: 'asset/source' });\n * }\n * ```\n *\n * @see {@link https://rspack.rs/config/ | Rspack — configuration reference}\n * @see {@link https://www.rshono.com/docs/configuration#the-rspack-hook | Docs — the rspack hook}\n */\n rspack?: (config: RspackOptions, ctx: RspackHookContext) => RspackOptions | void;\n}\n\n/**\n * Identity helper that types a config object — gives editor autocomplete without an explicit\n * annotation. Default-export the result from `rshono.config.ts`.\n *\n * @param config - The project's {@link RshonoConfig}; every field is optional.\n * @returns The config, unchanged and fully typed.\n *\n * @example\n * ```ts\n * // rshono.config.ts\n * import { defineConfig } from '@rshono/core';\n *\n * export default defineConfig({ deploy: 'cloudflare', siteUrl: 'https://example.com' });\n * ```\n *\n * @see {@link https://www.rshono.com/docs/configuration | Docs — configuration}\n */\nexport function defineConfig(config: RshonoConfig): RshonoConfig {\n return config;\n}\n"]}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import type { Context, Hono } from 'hono';
|
|
2
2
|
import type { PrerenderVariant, PrerenderedPage } from '../server/prerendered.js';
|
|
3
3
|
/**
|
|
4
|
-
* A hosting platform rshono
|
|
4
|
+
* A hosting platform `rshono build` targets. Selected with `deploy` in `rshono.config.ts`, the
|
|
5
5
|
* `--deploy` flag or the `RSHONO_DEPLOY` env var, and resolved to a preset by `deploy/presets.ts`.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `cloudflare
|
|
10
|
-
*
|
|
7
|
+
* - `'node'` (the default) — rshono binds the port itself and you run the build with `rshono start`.
|
|
8
|
+
* Covers a VPS, a container, a PaaS, and — through `node:` compatibility — Bun and Deno.
|
|
9
|
+
* - `'cloudflare'` — a Worker; the entry exports `{ fetch }`.
|
|
10
|
+
* - `'vercel'` — a Vercel function, plus the on-disk layout and config file streaming needs there.
|
|
11
|
+
* - `'aws-lambda'` — a streaming Lambda handler.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* One entry per *handoff* — who opens the socket, and what shape a request arrives in — because that
|
|
14
|
+
* is the part an app cannot arrange for itself. There is deliberately no target whose only content
|
|
15
|
+
* would be "run the Node build", which is why Bun and Deno have none: importing the `node` bundle
|
|
16
|
+
* under those runtimes is the whole of what one would say.
|
|
14
17
|
*
|
|
15
18
|
* `rshono dev` always runs the `node` server whatever this says — the dev server owns the process,
|
|
16
19
|
* watches both compilers and fronts them on one port, none of which a hosting platform provides.
|
|
20
|
+
*
|
|
21
|
+
* @see {@link https://www.rshono.com/docs/deployment#the-targets | Docs — the targets}
|
|
17
22
|
*/
|
|
18
23
|
export type DeployTarget = 'node' | 'cloudflare' | 'vercel' | 'aws-lambda';
|
|
19
24
|
/**
|
|
@@ -33,9 +38,9 @@ export interface DeployRuntime {
|
|
|
33
38
|
* Hands the assembled app to the platform, and returns whatever the entry module should
|
|
34
39
|
* `export default` there.
|
|
35
40
|
*
|
|
36
|
-
* The two shapes hosting takes, in one call: where rshono owns the process
|
|
37
|
-
*
|
|
38
|
-
*
|
|
41
|
+
* The two shapes hosting takes, in one call: where rshono owns the process this binds a port and
|
|
42
|
+
* returns nothing; where the host owns it, it returns the export the platform looks for —
|
|
43
|
+
* `{ fetch }` on Workers, a handler function on Vercel and Lambda.
|
|
39
44
|
*/
|
|
40
45
|
serveApp(app: Hono): unknown;
|
|
41
46
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/deploy/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAElF
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/deploy/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAElF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE3E;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,iBAAiB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACnC;;;OAGG;IACH,mBAAmB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACrC;;;;;;;;OAQG;IACH,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACxF,4GAA4G;IAC5G,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/deploy/contract.ts"],"names":[],"mappings":"","sourcesContent":["import type { Context, Hono } from 'hono';\nimport type { PrerenderVariant, PrerenderedPage } from '../server/prerendered.js';\n\n/**\n * A hosting platform rshono
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/deploy/contract.ts"],"names":[],"mappings":"","sourcesContent":["import type { Context, Hono } from 'hono';\nimport type { PrerenderVariant, PrerenderedPage } from '../server/prerendered.js';\n\n/**\n * A hosting platform `rshono build` targets. Selected with `deploy` in `rshono.config.ts`, the\n * `--deploy` flag or the `RSHONO_DEPLOY` env var, and resolved to a preset by `deploy/presets.ts`.\n *\n * - `'node'` (the default) — rshono binds the port itself and you run the build with `rshono start`.\n * Covers a VPS, a container, a PaaS, and — through `node:` compatibility — Bun and Deno.\n * - `'cloudflare'` — a Worker; the entry exports `{ fetch }`.\n * - `'vercel'` — a Vercel function, plus the on-disk layout and config file streaming needs there.\n * - `'aws-lambda'` — a streaming Lambda handler.\n *\n * One entry per *handoff* — who opens the socket, and what shape a request arrives in — because that\n * is the part an app cannot arrange for itself. There is deliberately no target whose only content\n * would be \"run the Node build\", which is why Bun and Deno have none: importing the `node` bundle\n * under those runtimes is the whole of what one would say.\n *\n * `rshono dev` always runs the `node` server whatever this says — the dev server owns the process,\n * watches both compilers and fronts them on one port, none of which a hosting platform provides.\n *\n * @see {@link https://www.rshono.com/docs/deployment#the-targets | Docs — the targets}\n */\nexport type DeployTarget = 'node' | 'cloudflare' | 'vercel' | 'aws-lambda';\n\n/**\n * Everything the app server needs from the platform it is running on.\n *\n * One preset implements this per target, and the `@rshono/deploy` alias resolves to exactly that\n * module at build time (see `builder/rspack-config.ts`), so only the selected platform's code is\n * ever in the bundle. `runtime/entry.rsc.tsx` is written against this interface and nothing else —\n * it is the whole of what \"which platform is this\" means at request time.\n *\n * The members are the capabilities that genuinely differ between a host with a disk and one without:\n * who opens the socket, who serves the assets, where a prerendered page is read from, and whether\n * there is a `.env` to load at all.\n */\nexport interface DeployRuntime {\n /**\n * Hands the assembled app to the platform, and returns whatever the entry module should\n * `export default` there.\n *\n * The two shapes hosting takes, in one call: where rshono owns the process this binds a port and\n * returns nothing; where the host owns it, it returns the export the platform looks for —\n * `{ fetch }` on Workers, a handler function on Vercel and Lambda.\n */\n serveApp(app: Hono): unknown;\n /**\n * Mounts the hashed client bundle at `/_static`. A no-op where the platform's own CDN serves it\n * before a request ever reaches the app.\n *\n * Called *before* the app's routes, so the bundle is never shadowed by one.\n */\n mountStaticAssets(app: Hono): void;\n /**\n * Mounts the `public/` fallback at the web root — files served verbatim, and only for paths no\n * route claimed. Called *after* every route for exactly that reason.\n */\n mountPublicFallback(app: Hono): void;\n /**\n * Reads the page prerendered for `c.req.path` by `rshono build`, or `null` when there is none (in\n * which case the route renders per request, which is always a valid answer).\n *\n * Takes the whole {@link Context} rather than just the path because on a platform with no\n * filesystem the store *is* a request-scoped binding — `c.env.ASSETS` on Workers. The path is\n * untrusted either way, so an implementation has to treat traversal as a miss, not a lookup\n * (see `prerenderedRelPath`).\n */\n readPrerendered(c: Context, variant: PrerenderVariant): Promise<PrerenderedPage | null>;\n /** Loads `.env` files, where the platform has a filesystem to read them from. Env is bindings elsewhere. */\n loadEnv(): void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/deploy/filesystem.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/deploy/filesystem.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAoBnD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAiB7D,CAAC"}
|
|
@@ -5,14 +5,13 @@ import { readPrerendered } from '../server/ssg.js';
|
|
|
5
5
|
import { createPublicFallback, createStaticAssetsApp } from '../server/static.js';
|
|
6
6
|
const isDev = __RSHONO_CONFIG__.isDev;
|
|
7
7
|
/**
|
|
8
|
-
* The project root, derived from where the bundle
|
|
9
|
-
*
|
|
10
|
-
* `import.meta.dirname` `<root>/dist/server` at runtime.
|
|
8
|
+
* The project root, derived from where the bundle ended up: this module is compiled into
|
|
9
|
+
* `<root>/dist/server/main.mjs`, so `import.meta.dirname` is `<root>/dist/server` at runtime.
|
|
11
10
|
*
|
|
12
|
-
* Derived rather than baked in at build time
|
|
13
|
-
* output to the machine that produced it
|
|
14
|
-
* A preset that relocates the bundle keeps `dist/server/main.mjs` intact inside its own layout
|
|
15
|
-
* exactly this reason.
|
|
11
|
+
* Derived rather than baked in at build time, because an absolute build-time path would tie the
|
|
12
|
+
* output to the machine that produced it — and building in CI to run somewhere else is the normal
|
|
13
|
+
* case. A preset that relocates the bundle keeps `dist/server/main.mjs` intact inside its own layout
|
|
14
|
+
* for exactly this reason.
|
|
16
15
|
*/
|
|
17
16
|
const rootDir = join(import.meta.dirname, '..', '..');
|
|
18
17
|
const staticDir = join(rootDir, 'dist', 'static');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/deploy/filesystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/deploy/filesystem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEtD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5C,kHAAkH;AAClH,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,iBAAiB,CAAC,GAAS;QACzB,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,mBAAmB,CAAC,GAAS;QAC3B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO;QACnC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,oBAAoB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,eAAe,CAAC,CAAC,EAAE,OAAO;QACxB,OAAO,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACL,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;CACF,CAAC","sourcesContent":["import type { Hono } from 'hono';\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { loadEnvFiles } from '../server/load-env.js';\nimport { readPrerendered } from '../server/ssg.js';\nimport { createPublicFallback, createStaticAssetsApp } from '../server/static.js';\nimport type { DeployRuntime } from './contract.js';\n\nconst isDev = __RSHONO_CONFIG__.isDev;\n\n/**\n * The project root, derived from where the bundle ended up: this module is compiled into\n * `<root>/dist/server/main.mjs`, so `import.meta.dirname` is `<root>/dist/server` at runtime.\n *\n * Derived rather than baked in at build time, because an absolute build-time path would tie the\n * output to the machine that produced it — and building in CI to run somewhere else is the normal\n * case. A preset that relocates the bundle keeps `dist/server/main.mjs` intact inside its own layout\n * for exactly this reason.\n */\nconst rootDir = join(import.meta.dirname, '..', '..');\n\nconst staticDir = join(rootDir, 'dist', 'static');\nconst ssgDir = join(rootDir, 'dist', 'ssg');\n/** `public/` is copied into `dist/` by the build, so a deployed build is self-contained; dev reads the source. */\nconst publicDir = isDev ? join(rootDir, 'public') : join(rootDir, 'dist', 'public');\n\n/**\n * Everything a deploy target with a real filesystem does the same way.\n *\n * Node and the serverless runtimes that unpack a bundle onto a read-only disk (Vercel, AWS Lambda)\n * differ only in how the finished app is handed over — so each of those presets is this object plus\n * its own {@link DeployRuntime.serveApp}, and the implementations live once, in `server/`.\n */\nexport const fileSystemRuntime: Omit<DeployRuntime, 'serveApp'> = {\n mountStaticAssets(app: Hono): void {\n app.route('/_static', createStaticAssetsApp({ root: staticDir, isDev }));\n },\n\n mountPublicFallback(app: Hono): void {\n if (!existsSync(publicDir)) return;\n app.on(['GET', 'HEAD'], '/*', createPublicFallback({ root: publicDir, isDev }));\n },\n\n readPrerendered(c, variant) {\n return readPrerendered(ssgDir, c.req.path, variant);\n },\n\n loadEnv(): void {\n loadEnvFiles(rootDir);\n },\n};\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DeployRuntime } from '../contract.js';
|
|
2
2
|
/**
|
|
3
|
-
* Node: a long-lived process that owns its own port, with a filesystem behind every asset. The shape
|
|
4
|
-
* framework was built against, and the only target `rshono dev` ever produces.
|
|
3
|
+
* Node: a long-lived process that owns its own port, with a filesystem behind every asset. The shape
|
|
4
|
+
* the framework was built against, and the only target `rshono dev` ever produces.
|
|
5
5
|
*
|
|
6
|
-
* Anything that runs a Node process runs this build — a VPS, a container, a PaaS — and Bun and Deno
|
|
7
|
-
* expected to as well, since the listener below is `@hono/node-server` and both implement the
|
|
8
|
-
* APIs it needs.
|
|
6
|
+
* Anything that runs a Node process runs this build — a VPS, a container, a PaaS — and Bun and Deno
|
|
7
|
+
* are expected to as well, since the listener below is `@hono/node-server` and both implement the
|
|
8
|
+
* `node:` APIs it needs.
|
|
9
9
|
*/
|
|
10
10
|
export declare const runtime: DeployRuntime;
|
|
11
11
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/deploy/node/runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/deploy/node/runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAqBpD;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,aA4BrB,CAAC"}
|
|
@@ -9,12 +9,8 @@ const WILDCARD_HOST = '0.0.0.0';
|
|
|
9
9
|
* Resolves the address to listen on: an explicit override (the dev server, which picks the port for its
|
|
10
10
|
* worker) beats the environment, which beats the built-in default.
|
|
11
11
|
*
|
|
12
|
-
* `PORT` and `HOST` are the whole interface, because that is the deployment convention everywhere
|
|
13
|
-
* runs
|
|
14
|
-
* means "any free port", is honoured.
|
|
15
|
-
*
|
|
16
|
-
* Lives here rather than in a `deploy/listen.ts` of its own because `node` is the only target that
|
|
17
|
-
* binds anything: every other one is handed a request by its host.
|
|
12
|
+
* `PORT` and `HOST` are the whole interface, because that is the deployment convention everywhere
|
|
13
|
+
* this runs. `??` rather than `||` so an explicit `PORT=0`, meaning "any free port", is honoured.
|
|
18
14
|
*/
|
|
19
15
|
function listenAddress(overrides) {
|
|
20
16
|
const envPort = process.env.PORT !== undefined ? Number(process.env.PORT) : undefined;
|
|
@@ -24,12 +20,12 @@ function listenAddress(overrides) {
|
|
|
24
20
|
};
|
|
25
21
|
}
|
|
26
22
|
/**
|
|
27
|
-
* Node: a long-lived process that owns its own port, with a filesystem behind every asset. The shape
|
|
28
|
-
* framework was built against, and the only target `rshono dev` ever produces.
|
|
23
|
+
* Node: a long-lived process that owns its own port, with a filesystem behind every asset. The shape
|
|
24
|
+
* the framework was built against, and the only target `rshono dev` ever produces.
|
|
29
25
|
*
|
|
30
|
-
* Anything that runs a Node process runs this build — a VPS, a container, a PaaS — and Bun and Deno
|
|
31
|
-
* expected to as well, since the listener below is `@hono/node-server` and both implement the
|
|
32
|
-
* APIs it needs.
|
|
26
|
+
* Anything that runs a Node process runs this build — a VPS, a container, a PaaS — and Bun and Deno
|
|
27
|
+
* are expected to as well, since the listener below is `@hono/node-server` and both implement the
|
|
28
|
+
* `node:` APIs it needs.
|
|
33
29
|
*/
|
|
34
30
|
export const runtime = {
|
|
35
31
|
...fileSystemRuntime,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/deploy/node/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,2FAA2F;AAC3F,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/deploy/node/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,2FAA2F;AAC3F,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,SAAgD;IACrE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtF,OAAO;QACL,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,OAAO,IAAI,eAAe,CAAC,IAAI;QACxD,QAAQ,EAAE,SAAS,EAAE,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,eAAe,CAAC,IAAI;KAC1E,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,GAAG,iBAAiB;IAEpB,QAAQ,CAAC,GAAS;QAChB,+FAA+F;QAC/F,+FAA+F;QAC/F,0BAA0B;QAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB;YAAE,OAAO;QAEzC,mGAAmG;QACnG,wBAAwB;QACxB,MAAM,SAAS,GAAG,UAAyD,CAAC;QAC5E,MAAM,OAAO,GAAG,aAAa,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;QAEtD,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9D,IAAI,UAAU,EAAE,CAAC;gBACf,UAAU,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACjF,OAAO,CAAC,GAAG,CAAC,gCAAgC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACnE,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["import { serve } from '@hono/node-server';\nimport type { Hono } from 'hono';\nimport { parentPort, workerData } from 'node:worker_threads';\nimport { SERVER_DEFAULTS } from '../../server/server-config.js';\nimport { onShutdown } from '../../server/shutdown.js';\nimport type { DeployRuntime } from '../contract.js';\nimport { fileSystemRuntime } from '../filesystem.js';\n\n/** Bound to every interface — so the address printed on start is `localhost`, not this. */\nconst WILDCARD_HOST = '0.0.0.0';\n\n/**\n * Resolves the address to listen on: an explicit override (the dev server, which picks the port for its\n * worker) beats the environment, which beats the built-in default.\n *\n * `PORT` and `HOST` are the whole interface, because that is the deployment convention everywhere\n * this runs. `??` rather than `||` so an explicit `PORT=0`, meaning \"any free port\", is honoured.\n */\nfunction listenAddress(overrides?: { port?: number; hostname?: string }): { port: number; hostname: string } {\n const envPort = process.env.PORT !== undefined ? Number(process.env.PORT) : undefined;\n return {\n port: overrides?.port ?? envPort ?? SERVER_DEFAULTS.port,\n hostname: overrides?.hostname ?? process.env.HOST ?? SERVER_DEFAULTS.host,\n };\n}\n\n/**\n * Node: a long-lived process that owns its own port, with a filesystem behind every asset. The shape\n * the framework was built against, and the only target `rshono dev` ever produces.\n *\n * Anything that runs a Node process runs this build — a VPS, a container, a PaaS — and Bun and Deno\n * are expected to as well, since the listener below is `@hono/node-server` and both implement the\n * `node:` APIs it needs.\n */\nexport const runtime: DeployRuntime = {\n ...fileSystemRuntime,\n\n serveApp(app: Hono): undefined {\n // `rshono build` imports this bundle to prerender `render: 'static'` routes. That pass renders\n // through `app.fetch` directly and must not bind a port — nothing is listening for it, and the\n // build would never exit.\n if (process.env.RSHONO_PRERENDER) return;\n\n // The dev server runs this bundle in a worker thread and picks the port itself, so its choice wins\n // over the environment.\n const devWorker = workerData as { port?: number; hostname?: string } | null;\n const address = listenAddress(devWorker ?? undefined);\n\n const server = serve({ fetch: app.fetch, ...address }, (info) => {\n if (parentPort) {\n parentPort.postMessage({ type: 'ready', port: info.port });\n } else {\n const host = address.hostname === WILDCARD_HOST ? 'localhost' : address.hostname;\n console.log(` ➜ rshono serving on http://${host}:${info.port}`);\n }\n });\n\n onShutdown(() => {\n server.close(() => process.exit(0));\n setTimeout(() => process.exit(0), 3000).unref();\n });\n },\n};\n"]}
|
package/dist/deploy/presets.d.ts
CHANGED
|
@@ -57,12 +57,8 @@ export interface DeployPreset {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Node: a long-lived server process. The generated config is already this shape, so the preset has
|
|
60
|
-
* nothing to contribute — the
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* Anywhere that runs a Node process runs this build: a VPS, a container, a PaaS. Bun and Deno are
|
|
64
|
-
* expected to as well, through their `node:` compatibility — they had a preset each, and since neither
|
|
65
|
-
* held anything but a default export, running the bundle (`bun dist/server/main.mjs`) replaces it.
|
|
60
|
+
* nothing to contribute — the settings in `builder/rspack-config.ts` (`target: 'node'`, the externals
|
|
61
|
+
* policy, ESM chunk output) are the Node ones by default.
|
|
66
62
|
*/
|
|
67
63
|
export declare const NODE_PRESET: DeployPreset;
|
|
68
64
|
/** Every target `deploy` accepts, for error messages and docs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/deploy/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC,uGAAuG;IACvG,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kGAAkG;IAClG,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,qFAAqF;IACrF,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;OAIG;IACH,eAAe,CAAC,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9C;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/deploy/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC,uGAAuG;IACvG,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kGAAkG;IAClG,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,qFAAqF;IACrF,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;OAIG;IACH,eAAe,CAAC,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9C;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,YAIzB,CAAC;AA4DF,kEAAkE;AAClE,eAAO,MAAM,cAAc,EAA2B,YAAY,EAAE,CAAC;AAErE;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE3D;AAED,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,aAAkB,GAAG,YAAY,CAS7E"}
|
package/dist/deploy/presets.js
CHANGED
|
@@ -2,12 +2,8 @@ import { finalizeCloudflareBuild } from './cloudflare/build.js';
|
|
|
2
2
|
import { finalizeVercelBuild } from './vercel/build.js';
|
|
3
3
|
/**
|
|
4
4
|
* Node: a long-lived server process. The generated config is already this shape, so the preset has
|
|
5
|
-
* nothing to contribute — the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Anywhere that runs a Node process runs this build: a VPS, a container, a PaaS. Bun and Deno are
|
|
9
|
-
* expected to as well, through their `node:` compatibility — they had a preset each, and since neither
|
|
10
|
-
* held anything but a default export, running the bundle (`bun dist/server/main.mjs`) replaces it.
|
|
5
|
+
* nothing to contribute — the settings in `builder/rspack-config.ts` (`target: 'node'`, the externals
|
|
6
|
+
* policy, ESM chunk output) are the Node ones by default.
|
|
11
7
|
*/
|
|
12
8
|
export const NODE_PRESET = {
|
|
13
9
|
name: 'node',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../src/deploy/presets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA2DxD
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../src/deploy/presets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA2DxD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,wBAAwB;IACvC,UAAU,EAAE,oBAAoB;CACjC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,iBAAiB,GAAiB;IACtC,IAAI,EAAE,YAAY;IAClB,aAAa,EAAE,8BAA8B;IAC7C,UAAU,EAAE,+BAA+B;IAC3C,iBAAiB,EAAE,CAAC,SAAS,CAAC;IAC9B,aAAa,EAAE,CAAC,YAAY,CAAC;IAC7B,eAAe,CAAC,MAAM;QACpB,MAAM,CAAC,MAAM,GAAG,WAAW,CAAC;QAC5B,MAAM,CAAC,aAAa,GAAG,eAAe,CAAC;QACvC,MAAM,CAAC,SAAS,GAAG,CAAC,uBAAuB,CAAC,CAAC;QAC7C,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAC3D,CAAC;IACD,QAAQ,EAAE,uBAAuB;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,aAAa,GAAiB;IAClC,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,0BAA0B;IACzC,UAAU,EAAE,wCAAwC;IACpD,QAAQ,EAAE,mBAAmB;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,iBAAiB,GAAiB;IACtC,IAAI,EAAE,YAAY;IAClB,aAAa,EAAE,8BAA8B;IAC7C,UAAU,EAAE,oDAAoD;CACjE,CAAC;AAEF,MAAM,OAAO,GAAuC;IAClD,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,iBAAiB;IAC7B,MAAM,EAAE,aAAa;IACrB,YAAY,EAAE,iBAAiB;CAChC,CAAC;AAEF,kEAAkE;AAClE,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAmB,CAAC;AAErE;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAQ,OAAoD,CAAC,MAAM,CAAC,EAAE,UAAU,IAAI,IAAI,CAAC;AAC3F,CAAC;AAYD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAO,GAAkB,EAAE;IAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;IACrF,IAAI,CAAC,MAAM;QAAE,OAAO,WAAW,CAAC;IAEhC,MAAM,MAAM,GAAI,OAAoD,CAAC,MAAM,CAAC,CAAC;IAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,uBAAuB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/H,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { RspackOptions } from '@rspack/core';\nimport { finalizeCloudflareBuild } from './cloudflare/build.js';\nimport type { DeployTarget } from './contract.js';\nimport { finalizeVercelBuild } from './vercel/build.js';\n\n/** What a preset's {@link DeployPreset.finalize} is told about the build it is arranging. */\nexport interface DeployBuildContext {\n /** The project root — where `rshono build` ran, and what a platform config file is written next to. */\n rootDir: string;\n /** `<root>/dist`. */\n distDir: string;\n /** The hashed client bundle, `<root>/dist/static` — served at `/_static`. */\n staticDir: string;\n /** The copy of the app's `public/`, or `null` when it has none. Served at the web root. */\n publicDir: string | null;\n /** Prerendered pages, `<root>/dist/ssg` — empty when the app has no `render: 'static'` routes. */\n ssgDir: string;\n}\n\n/**\n * The build-time half of a deploy target: which runtime module the bundle gets, how the server\n * compiler has to change to produce something the platform can run, and how the output is arranged\n * once it exists.\n *\n * The runtime half is {@link DeployRuntime}, in its own file because it is compiled *into* the app\n * bundle — this side only ever runs in the CLI.\n */\nexport interface DeployPreset {\n readonly name: DeployTarget;\n /**\n * The module `@rshono/deploy` resolves to, as a path relative to the framework's own `dist/`.\n * Slash-separated and split on use, so it stays a valid path on Windows too.\n */\n readonly runtimeModule: string;\n /** How to run what was just built, completing the \"build complete —\" line. */\n readonly deployHint: string;\n /**\n * Extra resolve conditions for the server bundle, most specific first.\n *\n * This is what picks the right build of React and the RSC runtime: both ship one per runtime behind\n * `workerd` / `deno` / `edge-light` / `node` conditions. Omit it to accept whatever the Rspack\n * target implies, which is correct for Node.\n */\n readonly resolveConditions?: readonly string[];\n /** browserslist-style targets for the server bundle's swc pass. Defaults to Node. */\n readonly syntaxTargets?: readonly string[];\n /**\n * Adjusts the generated server Rspack config for this platform — target, externals policy, output\n * shape. Mutates in place, and runs *before* the user's `rspack` hook so that hook keeps the last\n * word.\n */\n configureServer?(config: RspackOptions): void;\n /**\n * Arranges the finished build for the platform: assembles whatever directory layout it expects,\n * emits its config file, and prints how to deploy.\n *\n * Runs last — after both bundles, the `public/` copy and the prerender pass — so everything it\n * needs to move is already on disk.\n */\n finalize?(ctx: DeployBuildContext): Promise<void> | void;\n}\n\n/**\n * Node: a long-lived server process. The generated config is already this shape, so the preset has\n * nothing to contribute — the settings in `builder/rspack-config.ts` (`target: 'node'`, the externals\n * policy, ESM chunk output) are the Node ones by default.\n */\nexport const NODE_PRESET: DeployPreset = {\n name: 'node',\n runtimeModule: 'deploy/node/runtime.js',\n deployHint: 'run `rshono start`',\n};\n\n/**\n * Cloudflare Workers: the host owns the process, the CDN owns the assets, and there is no filesystem.\n *\n * Every compiler setting here follows from `workerd` not being Node. Dependencies are bundled because\n * nothing resolves `node_modules` at runtime; `node:` and `cloudflare:` imports stay external because\n * the runtime provides them (`nodejs_compat`, which the scaffolded config enables for\n * `AsyncLocalStorage`); and async chunks are inlined because Wrangler's bundler cannot follow the\n * computed specifier Rspack's ESM chunk loader emits — a split bundle would deploy and then fail on\n * the first page render.\n */\nconst CLOUDFLARE_PRESET: DeployPreset = {\n name: 'cloudflare',\n runtimeModule: 'deploy/cloudflare/runtime.js',\n deployHint: 'deploy with `wrangler deploy`',\n resolveConditions: ['workerd'],\n syntaxTargets: ['chrome 120'],\n configureServer(config) {\n config.target = 'webworker';\n config.externalsType = 'module-import';\n config.externals = [/^(?:node|cloudflare):/];\n config.output = { ...config.output, asyncChunks: false };\n },\n finalize: finalizeCloudflareBuild,\n};\n\n/**\n * Vercel: one Node function behind the platform's CDN, which serves the assets and reaches the function\n * only for a page. `finalize` assembles the Build Output API layout the platform uploads — including the\n * `supportsResponseStreaming` flag, without which Vercel buffers the whole response and streamed SSR is\n * silently undone. That flag, and the exact path the bundle has to keep, are the reason this is a preset\n * rather than a snippet in the docs.\n */\nconst VERCEL_PRESET: DeployPreset = {\n name: 'vercel',\n runtimeModule: 'deploy/vercel/runtime.js',\n deployHint: 'deploy with `vercel deploy --prebuilt`',\n finalize: finalizeVercelBuild,\n};\n\n/**\n * AWS Lambda behind a Function URL in `RESPONSE_STREAM` mode — the AWS shape that keeps streaming.\n *\n * Same reasoning as Vercel: the runtime wraps the app in `awslambda.streamifyResponse`, and the buffered\n * alternative would deploy fine and then hold every page until its last byte rendered.\n */\nconst AWS_LAMBDA_PRESET: DeployPreset = {\n name: 'aws-lambda',\n runtimeModule: 'deploy/aws-lambda/runtime.js',\n deployHint: 'zip dist/ with the handler at dist/server/main.mjs',\n};\n\nconst PRESETS: Record<DeployTarget, DeployPreset> = {\n node: NODE_PRESET,\n cloudflare: CLOUDFLARE_PRESET,\n vercel: VERCEL_PRESET,\n 'aws-lambda': AWS_LAMBDA_PRESET,\n};\n\n/** Every target `deploy` accepts, for error messages and docs. */\nexport const DEPLOY_TARGETS = Object.keys(PRESETS) as DeployTarget[];\n\n/**\n * How to deploy what a given target built, or `null` for a name this rshono does not know — which a\n * `dist/` produced by a newer version can legitimately carry.\n */\nexport function deployHintFor(target: string): string | null {\n return (PRESETS as Record<string, DeployPreset | undefined>)[target]?.deployHint ?? null;\n}\n\n/** Where a deploy target can be named, in precedence order. */\nexport interface DeploySources {\n /** The `--deploy` flag. */\n flag?: string;\n /** The `RSHONO_DEPLOY` env var — for a CI job that deploys the same app to more than one place. */\n env?: string;\n /** {@link RshonoConfig.deploy} from `rshono.config.ts`. */\n config?: string;\n}\n\n/**\n * Resolves the preset to build with: the flag wins over the environment, which wins over the config\n * file, which wins over the `node` default.\n *\n * Blank values are ignored at every level, so an unset-but-present `RSHONO_DEPLOY=` in a CI\n * environment falls through to the config file instead of failing the build.\n */\nexport function resolveDeployPreset(sources: DeploySources = {}): DeployPreset {\n const target = sources.flag?.trim() || sources.env?.trim() || sources.config?.trim();\n if (!target) return NODE_PRESET;\n\n const preset = (PRESETS as Record<string, DeployPreset | undefined>)[target];\n if (!preset) {\n throw new Error(`[rshono] unknown deploy target ${JSON.stringify(target)} — expected one of: ${DEPLOY_TARGETS.join(', ')}.`);\n }\n return preset;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* - `@rshono/core/client` — hooks and components for `'use client'` modules
|
|
11
11
|
* (`useNavigation`, `AsyncBoundary`, `CatchBoundary`).
|
|
12
12
|
*
|
|
13
|
+
* @see {@link https://www.rshono.com/docs/api | Docs — API reference}
|
|
14
|
+
*
|
|
13
15
|
* @packageDocumentation
|
|
14
16
|
*/
|
|
15
17
|
export { defineRoutes, type EndpointRoute, type EndpointServerModule, type ErrorPageInfo, type ErrorPageProps, type FallbackPage, type HTTPMethod, type PageComponent, type PageProps, type PageRoute, type PathParams, type Route, type RouteConfig, } from './router.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEtF,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
* - `@rshono/core/client` — hooks and components for `'use client'` modules
|
|
11
11
|
* (`useNavigation`, `AsyncBoundary`, `CatchBoundary`).
|
|
12
12
|
*
|
|
13
|
+
* @see {@link https://www.rshono.com/docs/api | Docs — API reference}
|
|
14
|
+
*
|
|
13
15
|
* @packageDocumentation
|
|
14
16
|
*/
|
|
15
17
|
export { defineRoutes, } from './router.js';
|
|
16
18
|
export { defineConfig } from './config.js';
|
|
17
|
-
// Hono's
|
|
18
|
-
//
|
|
19
|
-
//
|
|
19
|
+
// Hono's `Context` and `Handler` are deliberately not re-exported: `hono` is a peer dependency every
|
|
20
|
+
// app already has, so an endpoint module imports them from there rather than choosing between two
|
|
21
|
+
// spellings of the same type.
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,YAAY,GAab,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAA6C,MAAM,aAAa,CAAC;AAItF,qGAAqG;AACrG,kGAAkG;AAClG,8BAA8B","sourcesContent":["/**\n * `@rshono/core` — the build-time surface: route and config declaration plus the types\n * your pages and endpoints are written against. Everything here is safe to\n * import from server code; none of it pulls in runtime machinery.\n *\n * The two companion entry points are runtime-only:\n * - `@rshono/core/server` — {@link https://hono.dev | Hono} request context inside\n * server components and actions (`getRequestContext`, `redirect`, `notFound`), plus\n * `onServerError` for reporting the errors the framework catches.\n * - `@rshono/core/client` — hooks and components for `'use client'` modules\n * (`useNavigation`, `AsyncBoundary`, `CatchBoundary`).\n *\n * @see {@link https://www.rshono.com/docs/api | Docs — API reference}\n *\n * @packageDocumentation\n */\n\nexport {\n defineRoutes,\n type EndpointRoute,\n type EndpointServerModule,\n type ErrorPageInfo,\n type ErrorPageProps,\n type FallbackPage,\n type HTTPMethod,\n type PageComponent,\n type PageProps,\n type PageRoute,\n type PathParams,\n type Route,\n type RouteConfig,\n} from './router.js';\n\nexport { defineConfig, type RshonoConfig, type RspackHookContext } from './config.js';\n\nexport type { DeployTarget } from './deploy/contract.js';\n\n// Hono's `Context` and `Handler` are deliberately not re-exported: `hono` is a peer dependency every\n// app already has, so an endpoint module imports them from there rather than choosing between two\n// spellings of the same type.\n"]}
|