@nifrajs/web 2.10.0 → 2.12.0
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/build-vite.d.ts.map +1 -1
- package/dist/build-vite.js +10 -0
- package/dist/build-vite.js.map +1 -1
- package/dist/build.d.ts +7 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +5 -2
- package/dist/build.js.map +1 -1
- package/dist/client.d.ts +12 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -7
- package/dist/client.js.map +1 -1
- package/dist/conformance.d.ts +1 -1
- package/dist/conformance.d.ts.map +1 -1
- package/dist/deferred.d.ts +1 -1
- package/dist/deferred.d.ts.map +1 -1
- package/dist/deferred.js +14 -3
- package/dist/deferred.js.map +1 -1
- package/dist/dev-ssr-graph.d.ts +33 -0
- package/dist/dev-ssr-graph.d.ts.map +1 -0
- package/dist/dev-ssr-graph.js +285 -0
- package/dist/dev-ssr-graph.js.map +1 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +88 -17
- package/dist/dev.js.map +1 -1
- package/dist/fonts-google.d.ts +2 -2
- package/dist/fonts-google.d.ts.map +1 -1
- package/dist/fonts-google.js +12 -3
- package/dist/fonts-google.js.map +1 -1
- package/dist/index.d.ts +68 -119
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -114
- package/dist/index.js.map +1 -1
- package/dist/internal/head-merge.d.ts +27 -0
- package/dist/internal/head-merge.d.ts.map +1 -0
- package/dist/internal/head-merge.js +65 -0
- package/dist/internal/head-merge.js.map +1 -0
- package/dist/internal/server-boundary.d.ts +1 -2
- package/dist/internal/server-boundary.d.ts.map +1 -1
- package/dist/internal/server-boundary.js +1 -2
- package/dist/internal/server-boundary.js.map +1 -1
- package/dist/isr.d.ts.map +1 -1
- package/dist/isr.js +4 -1
- package/dist/isr.js.map +1 -1
- package/dist/llms-txt.d.ts +3 -1
- package/dist/llms-txt.d.ts.map +1 -1
- package/dist/llms-txt.js +23 -20
- package/dist/llms-txt.js.map +1 -1
- package/dist/manifest.d.ts +5 -3
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js.map +1 -1
- package/dist/navigation.d.ts +9 -0
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +8 -1
- package/dist/navigation.js.map +1 -1
- package/dist/plugins/css-modules.d.ts +12 -0
- package/dist/plugins/css-modules.d.ts.map +1 -1
- package/dist/plugins/css-modules.js +0 -0
- package/dist/plugins/css-modules.js.map +1 -1
- package/dist/plugins/kit.d.ts +54 -0
- package/dist/plugins/kit.d.ts.map +1 -1
- package/dist/plugins/kit.js +66 -0
- package/dist/plugins/kit.js.map +1 -1
- package/dist/render-seam.d.ts +61 -0
- package/dist/render-seam.d.ts.map +1 -0
- package/dist/render-seam.js +22 -0
- package/dist/render-seam.js.map +1 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +27 -1
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
- package/src/build-vite.ts +11 -0
- package/src/build.ts +18 -1
- package/src/client.ts +41 -7
- package/src/conformance.ts +1 -1
- package/src/deferred.ts +14 -2
- package/src/dev-ssr-graph.ts +311 -0
- package/src/dev.ts +91 -19
- package/src/fonts-google.ts +14 -5
- package/src/index.ts +155 -189
- package/src/internal/head-merge.ts +80 -0
- package/src/internal/server-boundary.ts +1 -2
- package/src/isr.ts +4 -1
- package/src/llms-txt.ts +24 -20
- package/src/manifest.ts +5 -3
- package/src/navigation.ts +14 -1
- package/src/plugins/css-modules.ts +0 -0
- package/src/plugins/kit.ts +71 -0
- package/src/render-seam.ts +76 -0
- package/src/vite.ts +29 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,19 +7,20 @@
|
|
|
7
7
|
* the adapter interprets them. That keeps this package both framework-agnostic and free
|
|
8
8
|
* of DOM types: it is pure server orchestration + string building.
|
|
9
9
|
*/
|
|
10
|
-
import { server } from "@nifrajs/core/server";
|
|
10
|
+
import { type ServerOptions, server } from "@nifrajs/core/server";
|
|
11
11
|
import { type Deferred, defer } from "./deferred.js";
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
12
|
+
import { mergeHeads, resolveMeta } from "./internal/head-merge.js";
|
|
13
|
+
import type { LinkDescriptor, Manifest, Meta, MetaDescriptor, ScriptDescriptor, UnsafeScriptDescriptor } from "./manifest.js";
|
|
14
|
+
import type { RenderAdapter } from "./render-seam.js";
|
|
14
15
|
export { DRAFT_COOKIE, type DraftCookieControls, disableDraft, type EnableDraftOptions, enableDraft, isDraftEnabled, type PreviewEndpointOptions, previewEndpoint, } from "./draft.js";
|
|
15
16
|
export { type FontDisplay, type FontFace, type FontPreloadInput, type FontSource, fontFace, fontPreload, } from "./fonts.js";
|
|
16
17
|
export { type CachedResponse, type CacheStore, ISR_REVALIDATE_HEADER, ISR_REVALIDATE_TAGS_HEADER, ISR_STATUS_HEADER, type ISRApp, type ISROptions, type ISRPlatform, KVCacheStore, type KVCacheStoreOptions, type KVNamespaceLike, MemoryCacheStore, type MemoryCacheStoreOptions, type RevalidateEndpointOptions, revalidateEndpoint, withISR, } from "./isr.js";
|
|
17
|
-
export { type Action, buildManifest, enumerateStaticRoutes, filePathToPattern, filePathToPatterns, type GetStaticPaths, type InertScriptType, type LayoutEntry, type LinkDescriptor, type Loader, type LoaderContext, type Manifest, type Meta, type MetaArgs, type MetaInput, type RouteEntry, type RouteModule, type ScriptDescriptor, type StaticPath, type StaticPaths, type StaticRoutes, type UnsafeScriptDescriptor, } from "./manifest.js";
|
|
18
|
+
export { type Action, buildManifest, enumerateStaticRoutes, filePathToPattern, filePathToPatterns, type GetStaticPaths, type InertScriptType, type LayoutEntry, type LinkDescriptor, type Loader, type LoaderContext, type Manifest, type Meta, type MetaArgs, type MetaDescriptor, type MetaInput, type RouteEntry, type RouteModule, type ScriptDescriptor, type StaticPath, type StaticPaths, type StaticRoutes, type UnsafeScriptDescriptor, } from "./manifest.js";
|
|
18
19
|
export { type Blocker, type BlockerController, type BlockerFunction, type BlockerLocation, type BlockerState, type BrowserNavigate, getBrowserNavigate, IDLE_BLOCKER, type NavigateFunction, type NavigateOptions, type NavigateSearchOf, type NavigateTargetInput, type RouteSearch, registerBlocker, resolveNavigate, setBlockerController, setBrowserNavigate, } from "./navigation.js";
|
|
19
20
|
export { type PublicDirCache, resolvePublicPath, type ServePublicDirOptions, servePublicDir, } from "./public-dir.js";
|
|
20
21
|
export { createMutation, createQueryClient, type DehydratedState, hashQueryKey, type InfiniteData, type InfiniteQueryHandle, type InfiniteQueryOptions, type MutationCallbacks, type MutationHandle, type MutationState, type MutationStatus, type QueryClient, type QueryClientOptions, type QueryHandle, type QueryOptions, type QueryState, type QueryStatus, } from "./query.js";
|
|
21
22
|
export { type ClientRouter, type ClientRouterOptions, createClientRouter, createMatcher, DATA_HEADER, type Fetcher, type FetcherState, type FetchRouteData, type MountRouterOptions, NAV_FROM_HEADER, REDIRECT_HEADER, RETAIN_HEADER, REVALIDATE_HEADER, type RouteMatch, type RoutePattern, type RouterState, STATUS_HEADER, type Submission, type SubmitOptions, } from "./router.js";
|
|
22
|
-
export { type Deferred, defer };
|
|
23
|
+
export { type Deferred, defer, mergeHeads, resolveMeta };
|
|
23
24
|
/** Phantom brand key for {@link ServerOnly}. A unique symbol so the brand can't be forged by a plain
|
|
24
25
|
* object literal; `unique symbol` keys never appear in the emitted JS, so the brand is purely
|
|
25
26
|
* type-level (zero runtime cost). The property is optional + `never`-typed, so a `ServerOnly<T>`
|
|
@@ -50,97 +51,8 @@ export type ServerOnly<T> = T & {
|
|
|
50
51
|
readonly [SERVER_ONLY_BRAND]?: never;
|
|
51
52
|
};
|
|
52
53
|
export { assertRenderAdapterConformance, RenderAdapterConformanceError, type RenderAdapterConformanceFixture, } from "./conformance.js";
|
|
54
|
+
export { ACTION_GLOBAL, DATA_GLOBAL, LAYOUT_DATA_GLOBAL, type RenderAdapter, type RenderProps, ROOT_ATTRIBUTE, ROUTE_GLOBAL, type SsrModuleLoader, setSsrModuleLoader, ssrModuleLoader, } from "./render-seam.js";
|
|
53
55
|
export { type SearchOf, searchOf, searchOfChain, serializeSearch } from "./search.js";
|
|
54
|
-
/** The data handed to a route component. Opaque to the core. `actionData` is the return of a
|
|
55
|
-
* route `action` after a POST (absent on plain GETs). `pending` + `submission` are client-only
|
|
56
|
-
* (absent on SSR): they drive **optimistic UI** - render from `submission.formData` while `pending`. */
|
|
57
|
-
export interface RenderProps {
|
|
58
|
-
readonly data: unknown;
|
|
59
|
-
/**
|
|
60
|
-
* Per-layout loader data, aligned index-for-index with the layout prefix of `chain`.
|
|
61
|
-
*
|
|
62
|
-
* Absent when no layout in the chain exports a `loader`, so a page-only app is byte-identical to
|
|
63
|
-
* before. An adapter that does not read it renders exactly as it did; one that does passes
|
|
64
|
-
* `layoutData[i]` to `chain[i]`.
|
|
65
|
-
*/
|
|
66
|
-
readonly layoutData?: readonly unknown[];
|
|
67
|
-
readonly actionData?: unknown;
|
|
68
|
-
/** True while a client navigation or submit is in flight (client-only; absent/false on SSR). */
|
|
69
|
-
readonly pending?: boolean;
|
|
70
|
-
/** The path a client navigation is transitioning TO while `pending` (client-only; absent on SSR and
|
|
71
|
-
* when idle). Lets an adapter tell a `NavLink` whether its own target is the one loading. */
|
|
72
|
-
readonly pendingPath?: string;
|
|
73
|
-
/** The in-flight client submit, for optimistic UI (client-only; absent on SSR + when idle). */
|
|
74
|
-
readonly submission?: Submission;
|
|
75
|
-
/** The matched route's decoded path params (`/users/:id` → `{ id: "7" }`). Threaded identically on
|
|
76
|
-
* SSR (from the request match) and on client navigation (from router state) so an adapter's
|
|
77
|
-
* `useParams` reads the same value on both, with no hydration mismatch. Absent ⇒ no params (`{}`). */
|
|
78
|
-
readonly params?: Readonly<Record<string, string>>;
|
|
79
|
-
/** The current URL's `pathname + search` (no hash - the hash never reaches the server). Threaded on
|
|
80
|
-
* SSR and client alike so an adapter's `useLocation`/`useSearchParams` hydrate consistently. Absent
|
|
81
|
-
* on adapters/callers that don't supply it (treated as `""`). */
|
|
82
|
-
readonly path?: string;
|
|
83
|
-
/** The route's typed, validated search params (the value the loader also gets as `ctx.search`),
|
|
84
|
-
* threaded to the adapter's `useSearch`. Derived identically on SSR (from the request) and on client
|
|
85
|
-
* navigation (adapter mount) via the shared `searchOf`, so a component reading it hydrates with no
|
|
86
|
-
* drift. Absent ⇒ no search context (`{}`). */
|
|
87
|
-
readonly search?: Record<string, unknown>;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* The seam every render adapter implements. New adapters should prove these invariants with
|
|
91
|
-
* {@link assertRenderAdapterConformance}; framework-specific behavior remains locally tested.
|
|
92
|
-
*/
|
|
93
|
-
export interface RenderAdapter {
|
|
94
|
-
/**
|
|
95
|
-
* Server: render a route's layout `chain` (outermost layout → page) to a **stream** of HTML
|
|
96
|
-
* bytes, including the framework's hydration markers. The page (innermost) receives `props`
|
|
97
|
-
* (the loader data); each layout wraps the child via its `children`. Returns (or resolves to)
|
|
98
|
-
* a Web `ReadableStream<Uint8Array>`: a streaming renderer flushes the shell first and streams
|
|
99
|
-
* Suspense boundaries as they resolve; a non-streaming renderer may return a one-chunk stream.
|
|
100
|
-
* May be async - e.g. React resolves once the shell is renderable, so a shell-render throw can
|
|
101
|
-
* still map to an error status before any byte is sent.
|
|
102
|
-
*/
|
|
103
|
-
renderToStream(chain: readonly unknown[], props: RenderProps): ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;
|
|
104
|
-
/**
|
|
105
|
-
* Server (optional): render the chain to a complete HTML **string** in one pass, with the same
|
|
106
|
-
* hydration markers `renderToStream` produces. When provided, `renderPage` uses it for any page
|
|
107
|
-
* that does **not** `defer()` - buffering the document is faster than the streaming pipeline there,
|
|
108
|
-
* because the framework's synchronous renderer (React `renderToString`, Solid `renderToString`,
|
|
109
|
-
* Preact `render`, Vue `renderToString`, Svelte `render`) is markedly cheaper than its streaming
|
|
110
|
-
* renderer - most visibly on Bun, where React Fizz / Solid `renderToStream` are the heaviest. Pages
|
|
111
|
-
* that `defer()` keep the streaming path (progressive `<Await>` needs it). Markup MUST be
|
|
112
|
-
* hydration-equivalent to `renderToStream`; a throw surfaces like the streaming shell-readiness
|
|
113
|
-
* await (the `_error` boundary maps it to a status). Omit it to always stream.
|
|
114
|
-
*/
|
|
115
|
-
renderToString?(chain: readonly unknown[], props: RenderProps): string | Promise<string>;
|
|
116
|
-
/**
|
|
117
|
-
* Server: per-document bootstrap markup injected into `<head>` that the client
|
|
118
|
-
* `hydrate` requires (Solid: `generateHydrationScript()`). Empty string if none.
|
|
119
|
-
*/
|
|
120
|
-
hydrationHead(nonce?: string): string;
|
|
121
|
-
}
|
|
122
|
-
/** Global the server serializes loader data into; the client reads it to hydrate. */
|
|
123
|
-
export declare const DATA_GLOBAL = "__NIFRA_DATA__";
|
|
124
|
-
/** Per-layout loader data for hydration. Emitted ONLY when some layout in the chain has a loader, so
|
|
125
|
-
* a page-only app's HTML is byte-identical to before layout loaders existed. */
|
|
126
|
-
export declare const LAYOUT_DATA_GLOBAL = "__NIFRA_LAYOUT_DATA__";
|
|
127
|
-
/** Global the server writes the matched route id into; the client uses it to pick the chain. */
|
|
128
|
-
export declare const ROUTE_GLOBAL = "__NIFRA_ROUTE__";
|
|
129
|
-
/** Global the server serializes an action's data return into (absent on GETs); the client
|
|
130
|
-
* reads it so hydration after a native form POST matches the server-rendered markup. */
|
|
131
|
-
export declare const ACTION_GLOBAL = "__NIFRA_ACTION__";
|
|
132
|
-
/**
|
|
133
|
-
* Marker attribute on the app container, emitted ONLY when `rootId` is not the default.
|
|
134
|
-
*
|
|
135
|
-
* `rootId` is a per-RENDER option; the client entry is a per-BUILD artifact, so it cannot be
|
|
136
|
-
* generated knowing which id a given render will use. The container therefore announces itself, and
|
|
137
|
-
* the entry finds it by this attribute before falling back to `#root`. It has to be the DOM rather
|
|
138
|
-
* than another `window.__NIFRA_*` global: a second copy of the id can drift from the markup, while
|
|
139
|
-
* this is written by the same expression that writes the id and cannot.
|
|
140
|
-
*
|
|
141
|
-
* Absent on a default render, so an app that never sets `rootId` emits the same bytes it always has.
|
|
142
|
-
*/
|
|
143
|
-
export declare const ROOT_ATTRIBUTE = "data-nifra-root";
|
|
144
56
|
/**
|
|
145
57
|
* Pre-hydration form guard - a tiny inline script flushed in `<head>` (it runs in the window between
|
|
146
58
|
* first paint and the island bundle taking over). It neutralizes the one real hydration footgun: a
|
|
@@ -406,8 +318,6 @@ export declare function revalidate<T>(paths: readonly string[], data: T): Revali
|
|
|
406
318
|
* separators.
|
|
407
319
|
*/
|
|
408
320
|
export declare function serializeData(data: unknown): string;
|
|
409
|
-
/** Resolve a route's `meta` (static or a function of the loader data + params) to a {@link Meta}. */
|
|
410
|
-
export declare function resolveMeta(meta: MetaInput | undefined, args: MetaArgs): Meta;
|
|
411
321
|
/**
|
|
412
322
|
* A `<link rel="canonical">` descriptor for a route's `meta.link`. The canonical URL tells search
|
|
413
323
|
* engines which URL is authoritative for a page (deduping query-string / tracking variants).
|
|
@@ -458,33 +368,67 @@ export declare function unsafeInlineScript(content: string, options: {
|
|
|
458
368
|
readonly nonce: string;
|
|
459
369
|
readonly type?: "module" | "text/javascript";
|
|
460
370
|
}): UnsafeScriptDescriptor;
|
|
461
|
-
|
|
462
|
-
* Merge a route's `<head>` contributions from its layout chain + the page into one {@link Meta}.
|
|
463
|
-
*
|
|
464
|
-
* The head contract (see {@link CreateWebAppOptions} and `LayoutEntry`): a `_layout.tsx` may export
|
|
465
|
-
* `meta` to put sitewide tags (`hreflang`, `preconnect`, a default `<title>`, …) on every page below
|
|
466
|
-
* it. `heads` is passed **outermost layout → … → innermost layout → page** (the same order as the
|
|
467
|
-
* render chain), and merges:
|
|
468
|
-
* - **`title`** - *nearest-wins*: the last defined value across the list, so the page overrides an
|
|
469
|
-
* inner layout, which overrides an outer one. A layout `title` is the section default; an undefined
|
|
470
|
-
* page `title` keeps it.
|
|
471
|
-
* - **`meta` / `link`** - *concatenated* in list order (outermost first, page last). Duplicate-tag
|
|
472
|
-
* de-duplication is the caller's concern; the framework emits exactly what's declared so a layout
|
|
473
|
-
* can ship N `<link rel="alternate" hreflang>` tags and a page can add its own canonical.
|
|
474
|
-
*
|
|
475
|
-
* Returns a fresh object whose identity is stable per `heads` *content* only when every entry is a
|
|
476
|
-
* static (by-reference) `Meta` and there is exactly one - otherwise a new object each call. That is
|
|
477
|
-
* fine: {@link headTags}'s memo is keyed on identity, so a per-request merge simply recomputes (its
|
|
478
|
-
* content can vary with loader data anyway).
|
|
479
|
-
*/
|
|
480
|
-
export declare function mergeHeads(heads: readonly Meta[]): Meta;
|
|
481
|
-
export interface CreateWebAppOptions {
|
|
371
|
+
export interface CreateWebAppOptions<Env = unknown> {
|
|
482
372
|
readonly adapter: RenderAdapter;
|
|
483
373
|
readonly manifest: Manifest;
|
|
484
374
|
/** URL of the built client entry (module script) injected into every page. */
|
|
485
375
|
readonly clientEntry: string;
|
|
486
376
|
/** Default document title for all pages. */
|
|
487
377
|
readonly title?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Options for the underlying `server()` - `requestTimeoutMs`, `admission`, `gracefulSignals`, and
|
|
380
|
+
* the rest of {@link ServerOptions}.
|
|
381
|
+
*
|
|
382
|
+
* Needed because the `Server` is constructed in here, so a caller has no other way to reach its
|
|
383
|
+
* constructor: a page app could set no request timeout and no capacity gate, which are exactly the
|
|
384
|
+
* two knobs a production readiness check looks for. An SSR app wants them MORE than a backend does -
|
|
385
|
+
* a render is slow and allocation-heavy, so a burst that a JSON API would absorb is the one that
|
|
386
|
+
* exhausts the pod.
|
|
387
|
+
*
|
|
388
|
+
* Applies to the whole app, {@link mounts} and the {@link api} auto-mount included: the capacity gate
|
|
389
|
+
* sits at the fetch entry, ahead of the request hooks those are dispatched from.
|
|
390
|
+
*/
|
|
391
|
+
readonly server?: ServerOptions;
|
|
392
|
+
/**
|
|
393
|
+
* Runs against the app BEFORE any page route is registered - the seam for `securityHeaders()`,
|
|
394
|
+
* `requestId()`, `logger()`, a rate limit, or anything else applied with `use`.
|
|
395
|
+
*
|
|
396
|
+
* ```ts
|
|
397
|
+
* createWebApp({
|
|
398
|
+
* …,
|
|
399
|
+
* use: (app) => {
|
|
400
|
+
* app.use(securityHeaders())
|
|
401
|
+
* app.use(requestId())
|
|
402
|
+
* },
|
|
403
|
+
* })
|
|
404
|
+
* ```
|
|
405
|
+
*
|
|
406
|
+
* A callback rather than an array because `use` is overloaded - `Middleware`, `IdentityPlugin`,
|
|
407
|
+
* `ContextPlugin` - and only the real call site instantiates the right overload. The return value
|
|
408
|
+
* is ignored: this is for cross-cutting concerns, not for declaring routes (declare those on the
|
|
409
|
+
* returned app, where they get their types).
|
|
410
|
+
*
|
|
411
|
+
* **Why the timing matters.** `beforeHandle`, `afterHandle`, `around`, `derive`/`decorate`, and
|
|
412
|
+
* `onError` are snapshotted into each route AS IT IS DECLARED, and `createWebApp` declares every
|
|
413
|
+
* page (plus the `/*` catch-all) before it returns - so a caller's `app.use(…)` afterwards binds
|
|
414
|
+
* them to nothing, silently. `requestId()` is exactly that case: it is a `derive`, so applied late
|
|
415
|
+
* it leaves every page without `c.requestId`. Route assurance evidence is order-scoped the same
|
|
416
|
+
* way, so a late `securityHeaders()` leaves the pages unable to PROVE the header to `nifra assure`
|
|
417
|
+
* even though it does still set it.
|
|
418
|
+
*
|
|
419
|
+
* `onRequest`/`onResponse` (and the response header/body hooks) are app-global arrays read at
|
|
420
|
+
* request time, so those alone DO work when added late. Using this seam for everything avoids
|
|
421
|
+
* having to remember which is which.
|
|
422
|
+
*
|
|
423
|
+
* Runs ahead of the {@link mounts} / {@link api} request hooks, so an `onRequest` middleware guards
|
|
424
|
+
* a mounted auth handler too.
|
|
425
|
+
*
|
|
426
|
+
* A `ContextPlugin` applied here takes runtime effect but cannot widen the declared return type of
|
|
427
|
+
* this function, so `c.requestId` is not typed on routes you declare afterwards. Named plugins are
|
|
428
|
+
* idempotent, so `app.use(requestId())` on the returned app recovers the TYPE without applying the
|
|
429
|
+
* plugin a second time.
|
|
430
|
+
*/
|
|
431
|
+
readonly use?: (app: ReturnType<typeof server<Env>>) => void;
|
|
488
432
|
/** Injected into each loader's `ctx.api` - typically an `inProcessClient(app)` (typed
|
|
489
433
|
* per-route via `@nifrajs/client`'s `createRoutes`). Opaque to the core.
|
|
490
434
|
*
|
|
@@ -551,6 +495,11 @@ export interface CreateWebAppOptions {
|
|
|
551
495
|
* `prerendered.json`). Injected as `window.__NIFRA_PRERENDERED__` on every page so a client soft-nav
|
|
552
496
|
* into a prerendered route fetches its static `_data.json` instead of hitting the worker. */
|
|
553
497
|
readonly prerenderedPaths?: readonly string[];
|
|
498
|
+
/** Publish the project's `AGENTS.md` inside `/llms.txt` and `/llms-full.txt`. **Off by default**:
|
|
499
|
+
* those endpoints are public and unauthenticated, while `AGENTS.md` is a repo file written for the
|
|
500
|
+
* team - unreleased feature names, internal hostnames, and "don't touch X yet" notes live there
|
|
501
|
+
* routinely. Turn it on only for a repo whose guidelines you would publish as a page. */
|
|
502
|
+
readonly publishLocalGuidelines?: boolean;
|
|
554
503
|
/** SSG: per dynamic route pattern, its `getStaticPaths` `fallback` (from `enumerateStaticRoutes` or
|
|
555
504
|
* the build's `prerendered.json`). A route mapped to `"404"` rejects any path NOT in
|
|
556
505
|
* `prerenderedPaths` with the 404 page - the unlisted path simply doesn't exist. `"ssr"` (the
|
|
@@ -582,7 +531,7 @@ export interface CreateWebAppOptions {
|
|
|
582
531
|
* (same `Env`) so `ctx.env.MY_KV` is typed there too. Omit the parameter and `Env` is `unknown` - the
|
|
583
532
|
* secure default; validate at the trust boundary before use.
|
|
584
533
|
*/
|
|
585
|
-
export declare function createWebApp<Env = unknown>(options: CreateWebAppOptions): ReturnType<typeof server<Env>>;
|
|
534
|
+
export declare function createWebApp<Env = unknown>(options: CreateWebAppOptions<Env>): ReturnType<typeof server<Env>>;
|
|
586
535
|
export interface GenerateClientEntryOptions {
|
|
587
536
|
/**
|
|
588
537
|
* Module specifier for the adapter's client runtime, e.g. `"@nifrajs/web-solid/client"`.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,MAAM,EAA6B,MAAM,sBAAsB,CAAA;AACxE,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,EAIN,MAAM,eAAe,CAAA;AAOtB,OAAO,KAAK,EAGV,cAAc,EAEd,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,SAAS,EAGT,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,eAAe,CAAA;AACtB,OAAO,EASL,KAAK,UAAU,EAChB,MAAM,aAAa,CAAA;AAIpB,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,YAAY,EACZ,KAAK,kBAAkB,EACvB,WAAW,EACX,cAAc,EACd,KAAK,sBAAsB,EAC3B,eAAe,GAChB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,QAAQ,EACR,WAAW,GACZ,MAAM,YAAY,CAAA;AAGnB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,kBAAkB,EAClB,OAAO,GACR,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,KAAK,MAAM,EACX,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,aAAa,EACl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,CAAA;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,6BAA6B,GACrC,MAAM,CAwDR;AAED;;;;;;;;;GASG;AACH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -12,10 +12,15 @@ import { server, urlPartsOf } from "@nifrajs/core/server";
|
|
|
12
12
|
import { DEFERRED_ERROR_CODE, DEFERRED_RUNTIME, defer, MAP_DEFERRED_SOURCE, ndjsonStream, prepareDeferred, } from "./deferred.js";
|
|
13
13
|
import { isDraftEnabled } from "./draft.js";
|
|
14
14
|
import { trustedHeadAttributes } from "./internal/head-attributes.js";
|
|
15
|
+
// Head resolution/merging. Defined in an internal module so `@nifrajs/web/client` can export the same
|
|
16
|
+
// two functions to the generated client entry without dragging THIS module (and its server code) into
|
|
17
|
+
// the browser graph - see internal/head-merge.ts. Re-exported here so the public API is unchanged.
|
|
18
|
+
import { mergeHeads, resolveMeta } from "./internal/head-merge.js";
|
|
15
19
|
import { jsStringLiteral } from "./internal/js-string.js";
|
|
16
20
|
import { EXECUTABLE_SCRIPT_TYPES, INERT_SCRIPT_TYPES } from "./internal/script-types.js";
|
|
17
21
|
import { ISR_REVALIDATE_HEADER, ISR_REVALIDATE_TAGS_HEADER, serializeISRTags } from "./isr.js";
|
|
18
22
|
import { generateLlmsTxt } from "./llms-txt.js";
|
|
23
|
+
import { ACTION_GLOBAL, DATA_GLOBAL, LAYOUT_DATA_GLOBAL, ROOT_ATTRIBUTE, ROUTE_GLOBAL, } from "./render-seam.js";
|
|
19
24
|
import { createMatcher, DATA_HEADER, NAV_FROM_HEADER, PRERENDERED_GLOBAL, REDIRECT_HEADER, RETAIN_HEADER, REVALIDATE_HEADER, STATUS_HEADER, } from "./router.js";
|
|
20
25
|
import { searchOf, searchOfChain } from "./search.js";
|
|
21
26
|
// Draft / preview mode - a signed cookie that flips `ctx.draft` for loaders + bypasses ISR for editors.
|
|
@@ -39,35 +44,14 @@ export { createMutation, createQueryClient, hashQueryKey, } from "./query.js";
|
|
|
39
44
|
// `DATA_HEADER` marks a navigation's data-only GET; `createWebApp` answers it with loader JSON.
|
|
40
45
|
export { createClientRouter, createMatcher, DATA_HEADER, NAV_FROM_HEADER, REDIRECT_HEADER, RETAIN_HEADER, REVALIDATE_HEADER, STATUS_HEADER, } from "./router.js";
|
|
41
46
|
// Deferred loader data (`defer()` + the `Deferred<T>` type) - consumed by the adapter's `<Await>`.
|
|
42
|
-
export { defer };
|
|
47
|
+
export { defer, mergeHeads, resolveMeta };
|
|
43
48
|
export { assertRenderAdapterConformance, RenderAdapterConformanceError, } from "./conformance.js";
|
|
49
|
+
export { ACTION_GLOBAL, DATA_GLOBAL, LAYOUT_DATA_GLOBAL, ROOT_ATTRIBUTE, ROUTE_GLOBAL, setSsrModuleLoader, ssrModuleLoader, } from "./render-seam.js";
|
|
44
50
|
// The search-derivation primitive: parse a URL query, validate it against a route's `searchSchema`
|
|
45
51
|
// (fail-closed to defaults), or return the raw parsed query when there is none. Both the server (loader
|
|
46
52
|
// ctx + `renderPage`) and a client adapter mount call this with the same URL + schema, so the two sides
|
|
47
53
|
// produce the identical value by construction. An adapter's `useSearch` binding reads its result.
|
|
48
54
|
export { searchOf, searchOfChain, serializeSearch } from "./search.js";
|
|
49
|
-
/** Global the server serializes loader data into; the client reads it to hydrate. */
|
|
50
|
-
export const DATA_GLOBAL = "__NIFRA_DATA__";
|
|
51
|
-
/** Per-layout loader data for hydration. Emitted ONLY when some layout in the chain has a loader, so
|
|
52
|
-
* a page-only app's HTML is byte-identical to before layout loaders existed. */
|
|
53
|
-
export const LAYOUT_DATA_GLOBAL = "__NIFRA_LAYOUT_DATA__";
|
|
54
|
-
/** Global the server writes the matched route id into; the client uses it to pick the chain. */
|
|
55
|
-
export const ROUTE_GLOBAL = "__NIFRA_ROUTE__";
|
|
56
|
-
/** Global the server serializes an action's data return into (absent on GETs); the client
|
|
57
|
-
* reads it so hydration after a native form POST matches the server-rendered markup. */
|
|
58
|
-
export const ACTION_GLOBAL = "__NIFRA_ACTION__";
|
|
59
|
-
/**
|
|
60
|
-
* Marker attribute on the app container, emitted ONLY when `rootId` is not the default.
|
|
61
|
-
*
|
|
62
|
-
* `rootId` is a per-RENDER option; the client entry is a per-BUILD artifact, so it cannot be
|
|
63
|
-
* generated knowing which id a given render will use. The container therefore announces itself, and
|
|
64
|
-
* the entry finds it by this attribute before falling back to `#root`. It has to be the DOM rather
|
|
65
|
-
* than another `window.__NIFRA_*` global: a second copy of the id can drift from the markup, while
|
|
66
|
-
* this is written by the same expression that writes the id and cannot.
|
|
67
|
-
*
|
|
68
|
-
* Absent on a default render, so an app that never sets `rootId` emits the same bytes it always has.
|
|
69
|
-
*/
|
|
70
|
-
export const ROOT_ATTRIBUTE = "data-nifra-root";
|
|
71
55
|
/**
|
|
72
56
|
* Pre-hydration form guard - a tiny inline script flushed in `<head>` (it runs in the window between
|
|
73
57
|
* first paint and the island bundle taking over). It neutralizes the one real hydration footgun: a
|
|
@@ -458,6 +442,19 @@ function withDuplicateInstanceHint(err) {
|
|
|
458
442
|
augmented.stack = err.stack;
|
|
459
443
|
return augmented;
|
|
460
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* An action's `Response` passes straight through - except a redirect on a client-submit data
|
|
447
|
+
* request: fetch would follow the 3xx into HTML the client can't use, so the redirect rides the
|
|
448
|
+
* X-Nifra-Redirect header on a 204 and the client navigates. One conversion shared by the
|
|
449
|
+
* returned- and thrown-Response paths, so `return redirect()` and `throw redirect()` agree.
|
|
450
|
+
*/
|
|
451
|
+
function actionResponse(response, isDataRequest) {
|
|
452
|
+
if (isDataRequest && response.status >= 300 && response.status < 400) {
|
|
453
|
+
const location = response.headers.get("location") ?? "/";
|
|
454
|
+
return new Response(null, { status: 204, headers: { [REDIRECT_HEADER]: location } });
|
|
455
|
+
}
|
|
456
|
+
return response;
|
|
457
|
+
}
|
|
461
458
|
/**
|
|
462
459
|
* Narrow the route's params to the ones a layout owns.
|
|
463
460
|
*
|
|
@@ -696,12 +693,6 @@ function headTags(head) {
|
|
|
696
693
|
headTagsCache.set(head, out);
|
|
697
694
|
return out;
|
|
698
695
|
}
|
|
699
|
-
/** Resolve a route's `meta` (static or a function of the loader data + params) to a {@link Meta}. */
|
|
700
|
-
export function resolveMeta(meta, args) {
|
|
701
|
-
if (meta === undefined)
|
|
702
|
-
return {};
|
|
703
|
-
return typeof meta === "function" ? meta(args) : meta;
|
|
704
|
-
}
|
|
705
696
|
/**
|
|
706
697
|
* A `<link rel="canonical">` descriptor for a route's `meta.link`. The canonical URL tells search
|
|
707
698
|
* engines which URL is authoritative for a page (deduping query-string / tracking variants).
|
|
@@ -769,74 +760,6 @@ export function unsafeInlineScript(content, options) {
|
|
|
769
760
|
content,
|
|
770
761
|
};
|
|
771
762
|
}
|
|
772
|
-
/**
|
|
773
|
-
* Merge a route's `<head>` contributions from its layout chain + the page into one {@link Meta}.
|
|
774
|
-
*
|
|
775
|
-
* The head contract (see {@link CreateWebAppOptions} and `LayoutEntry`): a `_layout.tsx` may export
|
|
776
|
-
* `meta` to put sitewide tags (`hreflang`, `preconnect`, a default `<title>`, …) on every page below
|
|
777
|
-
* it. `heads` is passed **outermost layout → … → innermost layout → page** (the same order as the
|
|
778
|
-
* render chain), and merges:
|
|
779
|
-
* - **`title`** - *nearest-wins*: the last defined value across the list, so the page overrides an
|
|
780
|
-
* inner layout, which overrides an outer one. A layout `title` is the section default; an undefined
|
|
781
|
-
* page `title` keeps it.
|
|
782
|
-
* - **`meta` / `link`** - *concatenated* in list order (outermost first, page last). Duplicate-tag
|
|
783
|
-
* de-duplication is the caller's concern; the framework emits exactly what's declared so a layout
|
|
784
|
-
* can ship N `<link rel="alternate" hreflang>` tags and a page can add its own canonical.
|
|
785
|
-
*
|
|
786
|
-
* Returns a fresh object whose identity is stable per `heads` *content* only when every entry is a
|
|
787
|
-
* static (by-reference) `Meta` and there is exactly one - otherwise a new object each call. That is
|
|
788
|
-
* fine: {@link headTags}'s memo is keyed on identity, so a per-request merge simply recomputes (its
|
|
789
|
-
* content can vary with loader data anyway).
|
|
790
|
-
*/
|
|
791
|
-
export function mergeHeads(heads) {
|
|
792
|
-
// Single-head fast path (a route with no layout `meta`, by far the common case) - return the
|
|
793
|
-
// resolved object by reference so headTags' identity-keyed memo hits across requests for static meta.
|
|
794
|
-
if (heads.length === 1)
|
|
795
|
-
return heads[0];
|
|
796
|
-
let title;
|
|
797
|
-
let lang;
|
|
798
|
-
let dir;
|
|
799
|
-
const meta = [];
|
|
800
|
-
const link = [];
|
|
801
|
-
const script = [];
|
|
802
|
-
const unsafeScript = [];
|
|
803
|
-
for (const h of heads) {
|
|
804
|
-
if (h.title !== undefined)
|
|
805
|
-
title = h.title; // nearest-wins: later (more specific) overrides
|
|
806
|
-
if (h.lang !== undefined)
|
|
807
|
-
lang = h.lang; // nearest-wins, like title
|
|
808
|
-
if (h.dir !== undefined)
|
|
809
|
-
dir = h.dir;
|
|
810
|
-
if (h.meta !== undefined)
|
|
811
|
-
meta.push(...h.meta);
|
|
812
|
-
if (h.link !== undefined)
|
|
813
|
-
link.push(...h.link);
|
|
814
|
-
if (h.script !== undefined)
|
|
815
|
-
script.push(...h.script); // concatenated like meta/link (outermost first)
|
|
816
|
-
if (h.unsafeScript !== undefined)
|
|
817
|
-
unsafeScript.push(...h.unsafeScript);
|
|
818
|
-
}
|
|
819
|
-
// Build the result with only the fields that were actually contributed - an empty `meta`/`link`/
|
|
820
|
-
// `script` array would otherwise be a spurious (if harmless) key. A mutable local; the cast to `Meta`
|
|
821
|
-
// is sound because a key is assigned only when defined (so `exactOptionalPropertyTypes` never sees
|
|
822
|
-
// `undefined`).
|
|
823
|
-
const merged = {};
|
|
824
|
-
if (title !== undefined)
|
|
825
|
-
merged.title = title;
|
|
826
|
-
if (meta.length > 0)
|
|
827
|
-
merged.meta = meta;
|
|
828
|
-
if (link.length > 0)
|
|
829
|
-
merged.link = link;
|
|
830
|
-
if (script.length > 0)
|
|
831
|
-
merged.script = script;
|
|
832
|
-
if (unsafeScript.length > 0)
|
|
833
|
-
merged.unsafeScript = unsafeScript;
|
|
834
|
-
if (lang !== undefined)
|
|
835
|
-
merged.lang = lang;
|
|
836
|
-
if (dir !== undefined)
|
|
837
|
-
merged.dir = dir;
|
|
838
|
-
return merged;
|
|
839
|
-
}
|
|
840
763
|
/**
|
|
841
764
|
* Re-issue `request` with `prefix` removed from its pathname.
|
|
842
765
|
*
|
|
@@ -920,7 +843,11 @@ export function createWebApp(options) {
|
|
|
920
843
|
// Seed the context with the declared `Env` so `app.fetch(req, { env })` / `toFetchHandler(app)` type
|
|
921
844
|
// the platform bindings (see the `createWebApp` doc). The runtime `env` still arrives per-request via
|
|
922
845
|
// `app.fetch(req, { env })`; this is a compile-time-only seed (`server<Env>()` casts, doesn't store).
|
|
923
|
-
const app = server();
|
|
846
|
+
const app = server(options.server);
|
|
847
|
+
// Before the mount hooks and before every page route, so the order-scoped hooks (`derive`,
|
|
848
|
+
// `beforeHandle`, assurance evidence) actually bind to them - see the `use` option. A caller
|
|
849
|
+
// cannot do this after the fact: by the time this function returns, the routes are declared.
|
|
850
|
+
options.use?.(app);
|
|
924
851
|
// Auto-mount the in-process backend over HTTP at `apiPrefix` (default `/api`), BEFORE page routing.
|
|
925
852
|
// `onRequest` runs on the raw request ahead of the router, so this wins over the page wildcard `/*`
|
|
926
853
|
// for every method (POST/GET/PUT/…) - not just the GET page routes - and a backend 404 (`/api/none`)
|
|
@@ -1403,6 +1330,15 @@ export function createWebApp(options) {
|
|
|
1403
1330
|
}
|
|
1404
1331
|
return renderError(route, errorId, withDuplicateInstanceHint(err));
|
|
1405
1332
|
}
|
|
1333
|
+
// A loader may RETURN its control-flow signal instead of throwing it - `return redirect(...)`
|
|
1334
|
+
// reads naturally and must not silently serialize the `Response` as loader data. Mirror the
|
|
1335
|
+
// catch above exactly: a status signal renders its boundary, any other `Response` (a
|
|
1336
|
+
// redirect, a hand-rolled response) passes through to core verbatim - so return and throw
|
|
1337
|
+
// are interchangeable.
|
|
1338
|
+
if (isStatusSignal(data))
|
|
1339
|
+
return renderStatusSignal(c.req, data);
|
|
1340
|
+
if (data instanceof Response)
|
|
1341
|
+
return data;
|
|
1406
1342
|
// Client-side navigation asks (via the X-Nifra-Data header) for just the loader data - no full
|
|
1407
1343
|
// document, no layout chain. A route with deferred data streams NDJSON (critical data first,
|
|
1408
1344
|
// then each deferred value as it settles); otherwise one JSON (the fast path). Same loader,
|
|
@@ -1512,11 +1448,23 @@ export function createWebApp(options) {
|
|
|
1512
1448
|
draft,
|
|
1513
1449
|
search: loaderSearch(mod.searchSchema, c.req),
|
|
1514
1450
|
};
|
|
1515
|
-
// A gate is an authorization boundary for everything beneath its layout, mutations included.
|
|
1516
|
-
// Run only gates before the action; ordinary layout data loaders run after a native mutation.
|
|
1517
|
-
const layoutModules = await runLayoutGates(route, actionContext);
|
|
1518
|
-
const result = await mod.action(actionContext);
|
|
1519
1451
|
const isDataRequest = c.req.headers.get(DATA_HEADER) !== null;
|
|
1452
|
+
let layoutModules;
|
|
1453
|
+
let result;
|
|
1454
|
+
try {
|
|
1455
|
+
// A gate is an authorization boundary for everything beneath its layout, mutations included.
|
|
1456
|
+
// Run only gates before the action; ordinary layout data loaders run after a native mutation.
|
|
1457
|
+
layoutModules = await runLayoutGates(route, actionContext);
|
|
1458
|
+
result = await mod.action(actionContext);
|
|
1459
|
+
}
|
|
1460
|
+
catch (err) {
|
|
1461
|
+
// A THROWN Response is the same control-flow signal as a returned one (`throw redirect()`
|
|
1462
|
+
// in a gate or an action) - route it through the same conversion as the returned-Response
|
|
1463
|
+
// branch below, so throw and return are interchangeable on the mutation path too.
|
|
1464
|
+
if (err instanceof Response)
|
|
1465
|
+
return actionResponse(err, isDataRequest);
|
|
1466
|
+
throw err;
|
|
1467
|
+
}
|
|
1520
1468
|
// An action may wrap its data in `revalidate(paths, data)` to declare which routes it changed.
|
|
1521
1469
|
// Unwrap to the inner data; the paths ride the `X-Nifra-Revalidate` header on the data-mode
|
|
1522
1470
|
// responses (the client acts on them - a full-page POST re-runs loaders inline, so no header).
|
|
@@ -1525,15 +1473,8 @@ export function createWebApp(options) {
|
|
|
1525
1473
|
const revalidateHeader = isRevalidate
|
|
1526
1474
|
? { [REVALIDATE_HEADER]: result.__nifraRevalidate.join(",") }
|
|
1527
1475
|
: {};
|
|
1528
|
-
if (actionResult instanceof Response)
|
|
1529
|
-
|
|
1530
|
-
// redirect via a header on a 204 and let the client navigate. Native forms get the 3xx.
|
|
1531
|
-
if (isDataRequest && actionResult.status >= 300 && actionResult.status < 400) {
|
|
1532
|
-
const location = actionResult.headers.get("location") ?? "/";
|
|
1533
|
-
return new Response(null, { status: 204, headers: { [REDIRECT_HEADER]: location } });
|
|
1534
|
-
}
|
|
1535
|
-
return actionResult;
|
|
1536
|
-
}
|
|
1476
|
+
if (actionResult instanceof Response)
|
|
1477
|
+
return actionResponse(actionResult, isDataRequest);
|
|
1537
1478
|
// Client submit wants just the action's data (it revalidates the loader itself); a native
|
|
1538
1479
|
// form POST re-renders the full page (loader re-runs) with the action data.
|
|
1539
1480
|
if (isDataRequest) {
|
|
@@ -1589,14 +1530,15 @@ export function createWebApp(options) {
|
|
|
1589
1530
|
});
|
|
1590
1531
|
}
|
|
1591
1532
|
// Register llms.txt & llms-full.txt
|
|
1533
|
+
const llmsOptions = { includeLocalGuidelines: options.publishLocalGuidelines === true };
|
|
1592
1534
|
app.register("GET", "/llms.txt", undefined, async () => {
|
|
1593
|
-
const text = await generateLlmsTxt(false, manifest.routes, api);
|
|
1535
|
+
const text = await generateLlmsTxt(false, manifest.routes, api, llmsOptions);
|
|
1594
1536
|
return new Response(text, {
|
|
1595
1537
|
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
1596
1538
|
});
|
|
1597
1539
|
});
|
|
1598
1540
|
app.register("GET", "/llms-full.txt", undefined, async () => {
|
|
1599
|
-
const text = await generateLlmsTxt(true, manifest.routes, api);
|
|
1541
|
+
const text = await generateLlmsTxt(true, manifest.routes, api, llmsOptions);
|
|
1600
1542
|
return new Response(text, {
|
|
1601
1543
|
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
1602
1544
|
});
|
|
@@ -1654,12 +1596,24 @@ export function generateClientEntry(manifest, options) {
|
|
|
1654
1596
|
statusRoutes[Number(status)] = routeId;
|
|
1655
1597
|
}
|
|
1656
1598
|
return `${[
|
|
1657
|
-
|
|
1599
|
+
// `/client`, never the root: the root's graph carries the server (renderPage, the static-file
|
|
1600
|
+
// server), and Vite's dev server evaluates what it is given instead of tree-shaking it.
|
|
1601
|
+
'import { createClientRouter, createMatcher, mergeHeads, resolveMeta } from "@nifrajs/web/client"',
|
|
1658
1602
|
'import { applyHead, installForms, installHistory, signalHydrated } from "@nifrajs/web/client"',
|
|
1659
1603
|
// Namespace import: `errorBoundary` is optional (an adapter may not export it). A namespace member
|
|
1660
1604
|
// access yields `undefined` if absent - unlike a named import, which would be a link error.
|
|
1661
1605
|
`import * as __adapter from ${JSON.stringify(clientModule)}`,
|
|
1662
1606
|
"const { mountRouter } = __adapter",
|
|
1607
|
+
// The assurance hook is optional: ordinary client entries pay only for the namespace lookup, while
|
|
1608
|
+
// hydration runners get a runtime identity from the exact adapter module that mounted the page. The
|
|
1609
|
+
// registry is token-only and lives on a Symbol.for key so it cannot collide with app data.
|
|
1610
|
+
"const __hydrationHook = __adapter.hydrationAssuranceHook",
|
|
1611
|
+
'if (__hydrationHook && typeof __hydrationHook.runtimeIdentity === "function") {',
|
|
1612
|
+
' const __runtimeKey = Symbol.for("nifra.hydration.runtime")',
|
|
1613
|
+
" const __runtimeState = globalThis[__runtimeKey]",
|
|
1614
|
+
" const __identities = __runtimeState && Array.isArray(__runtimeState.identities) ? __runtimeState.identities : []",
|
|
1615
|
+
" globalThis[__runtimeKey] = { framework: __hydrationHook.framework, identities: [...__identities, __hydrationHook.runtimeIdentity()] }",
|
|
1616
|
+
"}",
|
|
1663
1617
|
// The `clientModule` contract is a string specifier, so nothing type-checks that the module it
|
|
1664
1618
|
// names actually exports `mountRouter`. Without this the miss surfaces as
|
|
1665
1619
|
// "mountRouter is not a function" from inside a bundled chunk, at first paint, naming neither the
|
|
@@ -1669,6 +1623,16 @@ export function generateClientEntry(manifest, options) {
|
|
|
1669
1623
|
"the generated bootstrap, so a self-executing entry will not work. Use your adapter's " +
|
|
1670
1624
|
'`/client` entry (e.g. "@nifrajs/web-react/client"), or re-export mountRouter from it.')})`,
|
|
1671
1625
|
"const errorBoundary = __adapter.errorBoundary",
|
|
1626
|
+
// A hot update that the framework cannot actually apply must end in a reload, not in nothing.
|
|
1627
|
+
//
|
|
1628
|
+
// Bun's dev server applies React Fast Refresh to JSX modules. For React that patches the component
|
|
1629
|
+
// and preserves state. For Preact it does not - the module still LOOKS Fast-Refresh-able, so the
|
|
1630
|
+
// update is accepted and then swallowed: `bun:beforeUpdate`/`bun:afterUpdate` both fire, the server
|
|
1631
|
+
// logs a rebuild, and the page silently keeps rendering the old code. An edit that appears to do
|
|
1632
|
+
// nothing is the worst failure mode in a dev loop - worse than a reload, because there is no signal
|
|
1633
|
+
// to act on. An adapter that knows its framework is in that position says so, and the entry turns
|
|
1634
|
+
// the swallowed update into an honest full reload.
|
|
1635
|
+
'if (import.meta.hot && __adapter.hotUpdateNeedsReload) import.meta.hot.on("bun:afterUpdate", () => location.reload())',
|
|
1672
1636
|
`const errorRouteIds = new Set(${JSON.stringify(errorRouteIds)})`,
|
|
1673
1637
|
// Each route is a lazy loader: dynamic imports → Bun.build (splitting) emits one chunk per
|
|
1674
1638
|
// route, shared layouts/deps deduped into shared chunks, so a route's code loads only when
|