@nifrajs/cli 5.3.0 → 5.4.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/docs/types.json CHANGED
@@ -2416,12 +2416,26 @@
2416
2416
  "signature": "export declare const CLIENT_ENTRY_PATH = \"/__nifra/client.js\";",
2417
2417
  "doc": "/**\n * The stable URL every SSR'd page points its client entry at.\n *\n * It has to be stable, and Bun's own URL is not: that one is a content hash over the entire client graph,\n * so it changes whenever anything the entry imports changes. This path redirects to whichever hashed\n * chunk Bun is serving at the moment the browser asks, which is the only formulation that stays correct\n * across a rebuild.\n */"
2418
2418
  },
2419
+ {
2420
+ "name": "CONTENT_TAG_MAX",
2421
+ "kind": "const",
2422
+ "package": "@nifrajs/core",
2423
+ "signature": "export declare const CONTENT_TAG_MAX: number;",
2424
+ "doc": "/**\n * Largest file tagged by its content. Its first request waits for one read of the whole file, ~0.1 s\n * per 256 MiB with hardware SHA-256 and several times that on a slow disk or CPU, so a larger file -\n * a long video that is only ever fetched by ranges, say - is tagged by its device, inode, size and\n * times. That tag is still strong and changes with any replacement, but differs between instances.\n */"
2425
+ },
2419
2426
  {
2420
2427
  "name": "CONTENT_TYPE",
2421
2428
  "kind": "const",
2422
2429
  "package": "@nifrajs/image",
2423
2430
  "signature": "export declare const CONTENT_TYPE: Record<OutputFormat, string>;"
2424
2431
  },
2432
+ {
2433
+ "name": "CONTENT_TYPES",
2434
+ "kind": "const",
2435
+ "package": "@nifrajs/core",
2436
+ "signature": "export declare const CONTENT_TYPES: Readonly<Record<string, string>>;",
2437
+ "doc": "/**\n * Media types by extension. A table rather than the runtime's own file typing, which Node and Deno\n * lack. Unknown extensions, and extensionless files such as ACME tokens, are\n * `application/octet-stream`, which together with `nosniff` keeps a browser from guessing a more\n * dangerous type.\n */"
2438
+ },
2425
2439
  {
2426
2440
  "name": "COPILOT_INSTRUCTIONS_PATH",
2427
2441
  "kind": "const",
@@ -3693,6 +3707,13 @@
3693
3707
  "signature": "export type ContentFieldKey<Frontmatter extends Record<string, unknown>> = Extract<keyof Frontmatter, string>;",
3694
3708
  "doc": "/** A string frontmatter field name accepted by the index APIs. */"
3695
3709
  },
3710
+ {
3711
+ "name": "ContentHash",
3712
+ "kind": "interface",
3713
+ "package": "@nifrajs/core",
3714
+ "signature": "export interface ContentHash {\n update(bytes: Uint8Array): unknown;\n digest(encoding: \"base64url\"): string;\n}",
3715
+ "doc": "/** What node:crypto's `createHash` returns; Bun, Node and Deno all provide it. */"
3716
+ },
3696
3717
  {
3697
3718
  "name": "ContentPreference",
3698
3719
  "kind": "interface",
@@ -3724,6 +3745,19 @@
3724
3745
  "signature": "export interface ContentProps {\n /** Trusted, pre-rendered HTML (e.g. `entry.html`). */\n html: TrustedHtml\n /** Wrapper element (default `\"div\"`). */\n as?: string\n /** DOM passthrough (`class`, `style`, `id`, `data-*`, …). */\n [key: string]: unknown\n}",
3725
3746
  "doc": "/**\n * Hand-written types for `Content.svelte` (svelte-package would generate this). Consumers resolve this\n * through the `./content` export's `types` condition.\n */"
3726
3747
  },
3748
+ {
3749
+ "name": "ContentTagOptions",
3750
+ "kind": "interface",
3751
+ "package": "@nifrajs/core",
3752
+ "signature": "export interface ContentTagOptions {\n /** Most tags remembered at once (default 8192); past it the earliest is forgotten. */\n readonly limit?: number;\n /** The clock compared with a file's ctime (default `Date.now`). */\n readonly now?: () => number;\n}"
3753
+ },
3754
+ {
3755
+ "name": "ContentTags",
3756
+ "kind": "interface",
3757
+ "package": "@nifrajs/core",
3758
+ "signature": "export interface ContentTags {\n /** The tag remembered for this version of the file at `path`, if any. */\n cached(path: string, version: FileVersion): string | undefined;\n /** The tag of `bytes`, read whole from this version of the file at `path`. */\n ofBytes(path: string, version: FileVersion, bytes: Uint8Array): string;\n /**\n * The tag of this version of the file at `path`, read whole through `read`; requests for a version\n * already being read wait for that read. A file over {@link CONTENT_TAG_MAX} is not read: its tag\n * names its identity on this host instead, or is `undefined` where the runtime reports none.\n */\n ofFile(path: string, version: FileVersion, read: ReadAt): Promise<string | undefined>;\n}",
3759
+ "doc": "/**\n * Strong entity tags from what a file holds, the same for the same bytes on every instance and\n * runtime, so a replacement that keeps a file's size and timestamps still changes its tag. A tag is\n * remembered per real path for the version it was computed from, so serving a known file reads no\n * more than before.\n */"
3760
+ },
3727
3761
  {
3728
3762
  "name": "Context",
3729
3763
  "kind": "interface",
@@ -6274,6 +6308,13 @@
6274
6308
  "signature": "export interface FileType {\n /** Detected MIME type, e.g. `\"image/png\"`. */\n readonly mime: string;\n /** Canonical extension (no dot), e.g. `\"png\"`. */\n readonly ext: string;\n}",
6275
6309
  "doc": "/**\n * Magic-byte file-type detection - trust the bytes, not the `Content-Type` header (which a client\n * sets freely). Reads only the leading bytes; dependency-free + edge-safe. Covers the common upload\n * types; returns `null` for anything unrecognized (incl. text formats like SVG/CSV that have no magic\n * number - handle those explicitly if you accept them).\n */"
6276
6310
  },
6311
+ {
6312
+ "name": "FileVersion",
6313
+ "kind": "interface",
6314
+ "package": "@nifrajs/core",
6315
+ "signature": "export interface FileVersion {\n readonly dev: number;\n readonly ino: number;\n readonly size: number;\n readonly mtimeMs: number;\n readonly ctimeMs: number;\n}",
6316
+ "doc": "/**\n * The stat fields that tell one version of a file from another on one host: node:fs `Stats` as it is,\n * or Deno's `FileInfo` with its dates as epoch milliseconds and a field it lacks as `NaN`.\n */"
6317
+ },
6277
6318
  {
6278
6319
  "name": "FixOption",
6279
6320
  "kind": "interface",
@@ -11557,6 +11598,13 @@
11557
11598
  "package": "@nifrajs/mcp",
11558
11599
  "signature": "export interface ReactWidgetOptions {\n /** The widget's `ui://` resource URI, e.g. `ui://orders/table`. */\n readonly uri: string;\n readonly name: string;\n readonly description?: string;\n readonly title?: string;\n /** Absolute path to a `.tsx`/`.jsx` module whose DEFAULT export is a React component. It receives the\n * tool's `structuredContent` as props. */\n readonly component: string;\n /** Extra `<head>` content (styles, fonts). The bridge + component bundle are injected for you. */\n readonly head?: string;\n /** Minify the client bundle (default true). */\n readonly minify?: boolean;\n}"
11559
11600
  },
11601
+ {
11602
+ "name": "ReadAt",
11603
+ "kind": "type",
11604
+ "package": "@nifrajs/core",
11605
+ "signature": "export type ReadAt = (bytes: Uint8Array, position: number) => Promise<number>;",
11606
+ "doc": "/** Reads into `bytes` from byte `position` of a file, resolving to the count read (0 at its end). */"
11607
+ },
11560
11608
  {
11561
11609
  "name": "Readable",
11562
11610
  "kind": "interface",
@@ -14008,7 +14056,7 @@
14008
14056
  "name": "ServeOptions",
14009
14057
  "kind": "interface",
14010
14058
  "package": "@nifrajs/node",
14011
- "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * The default is `\"https\"` when {@link ServeOptions.tls} is set and `\"http\"` otherwise. Deployments\n * behind TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /**\n * Serve HTTPS directly, with no proxy in front: `{ cert, key }` as PEM text or the files' bytes\n * (`readFileSync(\"cert.pem\")`), plus any other `node:tls` server option (`passphrase`, `ca`,\n * `requestCert` for client certificates, `minVersion`, `SNICallback`, ...). Unset, the server speaks\n * plain HTTP, which is what a proxy or platform that terminates TLS expects.\n */\n readonly tls?: TlsOptions;\n /** Reject requests whose normalized Host authority is not in this allowlist or callback result. */\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n /** Use this validated authority when constructing Request.url, ignoring the inbound Host value. */\n readonly canonicalHost?: string;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in,\n * mirroring nifra's Bun `listen({ gracefulSignals })`.\n * `{ drainMs }` sets how long in-flight requests get before the stop forces them closed\n * (default 10_000).\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly signals?: boolean | {\n readonly drainMs?: number;\n };\n /**\n * Serve static files from disk for matching GET/HEAD requests *before* the app runs - non-matching\n * requests fall through to `app.fetch` with the node-direct fast path intact (no perf regression on\n * SSR/API routes). Replaces the hand-rolled `/assets/*` reader in self-hosted entries.\n */\n readonly static?: ServeStaticOptions;\n /**\n * Make a hand-rolled `return new Response(body)` ride the direct-write lane, by swapping\n * `globalThis.Response` for a stand-in that defers a *simple* construction (a string body, no\n * `statusText`, no headers or a plain header record) the way `c.text` / `c.json` already do.\n *\n * Off by default: prefer `c.text` / `c.json`, which get this without a global swap. Reach for the\n * flag only when handlers construct `Response` by hand on the hot path. It patches a process-global\n * builtin, so every `new Response(...)` anywhere in the process goes through the stand-in -\n * transparent (non-simple bodies build a real `Response`, and simple ones stay `instanceof\n * Response`), but a broad enough change to be opt-in.\n */\n readonly fastResponse?: boolean;\n}"
14059
+ "signature": "export interface ServeOptions {\n readonly port: number;\n readonly hostname?: string;\n /**\n * Protocol used when the adapter constructs `Request.url`.\n *\n * The default is `\"https\"` when {@link ServeOptions.tls} is set and `\"http\"` otherwise. Deployments\n * behind TLS termination can set `\"https\"` (or a trusted infra-aware function) so app code that reads\n * `request.url` sees the public scheme. Forwarded headers are not trusted implicitly.\n */\n readonly protocol?: RequestProtocolOption;\n /**\n * Serve HTTPS directly, with no proxy in front: `{ cert, key }` as PEM text or the files' bytes\n * (`readFileSync(\"cert.pem\")`), plus any other `node:tls` server option (`passphrase`, `ca`,\n * `requestCert` for client certificates, `minVersion`, `SNICallback`, ...). Unset, the server speaks\n * plain HTTP, which is what a proxy or platform that terminates TLS expects.\n */\n readonly tls?: TlsOptions;\n /** Reject requests whose normalized Host authority is not in this allowlist or callback result. */\n readonly allowedHosts?: readonly string[] | ((host: string) => boolean);\n /** Use this validated authority when constructing Request.url, ignoring the inbound Host value. */\n readonly canonicalHost?: string;\n /**\n * Install SIGTERM/SIGINT handlers that call `stop()` for a graceful drain on\n * `docker stop` / Ctrl-C. Off by default - taking over process signals is opt-in,\n * mirroring nifra's Bun `listen({ gracefulSignals })`.\n * `{ drainMs }` sets how long in-flight requests get before the stop forces them closed\n * (default 10_000).\n *\n * The app-level request timeout (`server({ requestTimeoutMs })` → 503) and body cap\n * are *not* set here - they live inside `app.fetch`, so they already apply through\n * this adapter. Slow-client protection is Node's built-in `requestTimeout` (300s) /\n * `headersTimeout` (60s) defaults.\n */\n readonly signals?: boolean | {\n readonly drainMs?: number;\n };\n /**\n * Serve static files from disk for matching GET/HEAD requests *before* the app runs - non-matching\n * requests fall through to `app.fetch` with the node-direct fast path intact (no perf regression on\n * SSR/API routes). Replaces the hand-rolled `/assets/*` reader in self-hosted entries. An array\n * serves several directories; the first mount whose prefix (and `files`, when set) takes a path\n * answers it.\n */\n readonly static?: ServeStaticOptions | readonly ServeStaticOptions[];\n /**\n * Make a hand-rolled `return new Response(body)` ride the direct-write lane, by swapping\n * `globalThis.Response` for a stand-in that defers a *simple* construction (a string body, no\n * `statusText`, no headers or a plain header record) the way `c.text` / `c.json` already do.\n *\n * Off by default: prefer `c.text` / `c.json`, which get this without a global swap. Reach for the\n * flag only when handlers construct `Response` by hand on the hot path. It patches a process-global\n * builtin, so every `new Response(...)` anywhere in the process goes through the stand-in -\n * transparent (non-simple bodies build a real `Response`, and simple ones stay `instanceof\n * Response`), but a broad enough change to be opt-in.\n */\n readonly fastResponse?: boolean;\n}"
14012
14060
  },
14013
14061
  {
14014
14062
  "name": "ServePublicDirOptions",
@@ -14020,7 +14068,7 @@
14020
14068
  "name": "ServeStaticOptions",
14021
14069
  "kind": "interface",
14022
14070
  "package": "@nifrajs/node",
14023
- "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * URL paths of the content-hashed files, such as a client build manifest's `assets`. When set,\n * `immutable` applies only to these; any other file is sent with its validators and no\n * `cache-control`, so a file that keeps its name across deploys still revalidates.\n */\n readonly hashedFiles?: Iterable<string>;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered `404` - the same response as a missing file, so probing\n * can't distinguish \"hidden\" from \"absent\". Dotfiles land in build output by accident, not by\n * design (`.env` next to the bundle, a `.git` dir in a copied tree), so serving them is opt-in.\n * Set `\"allow\"` if the directory deliberately contains them (e.g. `/.well-known`).\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n}",
14071
+ "signature": "export interface ServeStaticOptions {\n /** Directory to read files from - an absolute path or a `file://` URL (`new URL(\"./assets/\", import.meta.url)`). */\n readonly dir: string | URL;\n /** URL prefix these files are served under. Default `\"/assets\"`. Use `\"/\"` to serve the whole dir. */\n readonly prefix?: string;\n /** Emit `cache-control: public, max-age=31536000, immutable` - correct for content-hashed files. Default `true`. */\n readonly immutable?: boolean;\n /**\n * URL paths of the content-hashed files, such as a client build manifest's `assets`. When set,\n * `immutable` applies only to these; any other file is sent with its validators and no\n * `cache-control`, so a file that keeps its name across deploys still revalidates.\n */\n readonly hashedFiles?: Iterable<string>;\n /**\n * `cache-control` for a file that is not served immutable (`immutable: false`, or a file outside\n * `hashedFiles`). Unset, such a file carries only its validators.\n */\n readonly cacheControl?: string;\n /**\n * URL paths (as sent, percent-encoded) of the only files this mount serves. Any other path under\n * `prefix` passes to the next mount, then the app, without this mount touching the filesystem - so\n * a mount over a directory that also holds the server bundle can expose just the build's listed\n * files. A later mount over the same paths can still serve the rest.\n */\n readonly files?: Iterable<string>;\n /** Extra headers merged onto every served file. */\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Whether a path with a dot-leading segment (`/.env`, `/.git/config`, `/.hidden/app.js`) is\n * served. Default `\"deny\"`: answered `404` - the same response as a missing file, so probing\n * can't distinguish \"hidden\" from \"absent\". Dotfiles land in build output by accident, not by\n * design (`.env` next to the bundle, a `.git` dir in a copied tree), so serving them is opt-in.\n * `/.well-known` is public by definition (RFC 8615) and always served, as `servePublicDir` does.\n * The rule applies to the requested path and again to the file it resolves to, so a visible name\n * linking to `.env` is denied too. Set `\"allow\"` if the directory deliberately holds dotfiles.\n */\n readonly dotfiles?: \"deny\" | \"allow\";\n}",
14024
14072
  "doc": "/**\n * Serve static files from a directory (e.g. the client build) under a URL prefix - so a self-hosted\n * Node deploy doesn't need a CDN or a hand-rolled `/assets/*` handler. (On Cloudflare/Vercel the\n * platform serves assets; this is for `node server.js`.)\n */"
14025
14073
  },
14026
14074
  {
@@ -15961,14 +16009,14 @@
15961
16009
  "name": "VERSION",
15962
16010
  "kind": "const",
15963
16011
  "package": "@nifrajs/core",
15964
- "signature": "export declare const VERSION: \"5.3.0\";",
16012
+ "signature": "export declare const VERSION: \"5.4.0\";",
15965
16013
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
15966
16014
  },
15967
16015
  {
15968
16016
  "name": "VERSION",
15969
16017
  "kind": "const",
15970
16018
  "package": "nifra",
15971
- "signature": "export declare const VERSION: \"5.3.0\";",
16019
+ "signature": "export declare const VERSION: \"5.4.0\";",
15972
16020
  "doc": "/**\n * Current package version. A hardcoded literal on purpose - core runs on the edge (no fs), so it can't\n * read its own package.json at runtime. `scripts/version.ts` rewrites it on every release bump and\n * `check:publish` asserts it equals `@nifrajs/core`'s package version.\n */"
15973
16021
  },
15974
16022
  {
@@ -17630,6 +17678,20 @@
17630
17678
  "signature": "export declare function constrainedParts(parts: readonly MixedPart[]): readonly MixedPart[] | undefined;",
17631
17679
  "doc": "/**\n * The parts of a mixed segment when at least one of its parameters has a constraint, else\n * `undefined`. It is the fourth argument to {@link matchMixedSegment}; done once, at registration.\n */"
17632
17680
  },
17681
+ {
17682
+ "name": "contentTags",
17683
+ "kind": "function",
17684
+ "package": "@nifrajs/core",
17685
+ "signature": "export declare function contentTags(createHash: (algorithm: \"sha256\") => ContentHash, options?: ContentTagOptions): ContentTags;",
17686
+ "doc": "/** Tags from `createHash` - node:crypto's, which every runtime nifra serves files on provides. */"
17687
+ },
17688
+ {
17689
+ "name": "contentTypeOf",
17690
+ "kind": "function",
17691
+ "package": "@nifrajs/core",
17692
+ "signature": "export declare function contentTypeOf(path: string): string;",
17693
+ "doc": "/** The media type for a file path or name by its extension, case-insensitively. */"
17694
+ },
17633
17695
  {
17634
17696
  "name": "contextStorage",
17635
17697
  "kind": "function",
@@ -19760,6 +19822,13 @@
19760
19822
  "signature": "export declare function idleServerFnState<Output>(): ServerFnState<Output>;",
19761
19823
  "doc": "/** The idle state, shared so a server render and the first client render agree by reference. */"
19762
19824
  },
19825
+ {
19826
+ "name": "ifRangeAllowsPartial",
19827
+ "kind": "function",
19828
+ "package": "@nifrajs/core",
19829
+ "signature": "export declare function ifRangeAllowsPartial(ifRange: string | null, etag: string | undefined, lastModified: number | undefined): boolean;",
19830
+ "doc": "/**\n * Whether `If-Range` (the header, or `null`) lets a range request be answered partially; otherwise the\n * whole file is the conformant answer, not a fallback. An entity tag must equal the file's strong\n * `etag` (RFC 9110 section 13.1.5). A date must equal `lastModified` to the second, and counts only\n * for a file with no strong tag: a client holding the tag sends it, and a date cannot tell apart two\n * versions dated in the same second - here or on another instance - so resuming by one could splice\n * them.\n */"
19831
+ },
19763
19832
  {
19764
19833
  "name": "imageDimensions",
19765
19834
  "kind": "function",
@@ -19985,6 +20054,13 @@
19985
20054
  "signature": "export declare function isDraftEnabled(request: Request, secret: string): Promise<boolean>;",
19986
20055
  "doc": "/**\n * Whether `request` carries a **valid**, unexpired signed draft cookie (constant-time verify via\n * `unsignValue`). `createWebApp` uses it to set `ctx.draft`; `withISR` uses it to bypass the cache for\n * editors. A missing, forged, tampered, or expired cookie returns `false`.\n */"
19987
20056
  },
20057
+ {
20058
+ "name": "isHiddenPath",
20059
+ "kind": "function",
20060
+ "package": "@nifrajs/core",
20061
+ "signature": "export declare function isHiddenPath(rel: string): boolean;",
20062
+ "doc": "/**\n * Whether a relative path crosses a dot-segment other than `.well-known` (RFC 8615, public by\n * definition). Serving, the build's `public/` copy and the parity listing all apply it, so an editor\n * or VCS artifact (`.env`, `.git/`, `.DS_Store`) is neither served nor shipped. Both separators split:\n * a request path uses `/`, a relative file path the OS separator.\n */"
20063
+ },
19988
20064
  {
19989
20065
  "name": "isHydrationMismatch",
19990
20066
  "kind": "function",
@@ -20032,6 +20108,13 @@
20032
20108
  "package": "@nifrajs/web",
20033
20109
  "signature": "export declare function isNativeServerView(value: unknown): value is NativeServerView;"
20034
20110
  },
20111
+ {
20112
+ "name": "isNotModified",
20113
+ "kind": "function",
20114
+ "package": "@nifrajs/core",
20115
+ "signature": "export declare function isNotModified(ifNoneMatch: string | null, ifModifiedSince: string | null, etag: string | undefined, lastModified: number | undefined): boolean;",
20116
+ "doc": "/**\n * Whether the client's copy is current, so the answer is a bodyless 304. `If-None-Match` (the header,\n * or `null`) decides whenever it is sent (RFC 9110 section 13.2.2), by weak comparison with `etag`, and\n * `*` matches any file. Otherwise an `If-Modified-Since` at or after `lastModified` (epoch\n * milliseconds), compared at the whole seconds an HTTP date carries; an unparseable date, or a file\n * with no date, is never current.\n */"
20117
+ },
20035
20118
  {
20036
20119
  "name": "isProcessAlive",
20037
20120
  "kind": "function",
@@ -20241,6 +20324,13 @@
20241
20324
  "signature": "export declare function language<const L extends readonly string[]>(options: LanguageOptions<L>): ContextPlugin<{\n language: L[number];\n languageMatch: LanguageMatch;\n}>;",
20242
20325
  "doc": "/**\n * Derives `c.language` from `Accept-Language` and emits `Content-Language` by default.\n *\n * Header-only by design. For the full detector - `?lang=` query parameter → cookie →\n * `Accept-Language`, with optional cookie persistence - use `localeDetector()` from\n * `@nifrajs/i18n/detector`; use one or the other, not both.\n */"
20243
20326
  },
20327
+ {
20328
+ "name": "lastModifiedOf",
20329
+ "kind": "function",
20330
+ "package": "@nifrajs/core",
20331
+ "signature": "export declare function lastModifiedOf(version: FileVersion): number | undefined;",
20332
+ "doc": "/**\n * The time a file can be dated by in Last-Modified, or `undefined`: its mtime, only while that is\n * the time of its own last change. A copy or build that keeps or normalizes timestamps - `cp -p`,\n * `rsync -a`, tar, a container image layer, SOURCE_DATE_EPOCH, the Nix store's 1 s - gives a\n * same-size replacement the old file's date, so its files are left undated and their content tag\n * validates them alone.\n */"
20333
+ },
20244
20334
  {
20245
20335
  "name": "lintPostgresStatement",
20246
20336
  "kind": "function",
@@ -22794,7 +22884,7 @@
22794
22884
  "kind": "function",
22795
22885
  "package": "@nifrajs/web",
22796
22886
  "signature": "export declare function servePublicDir(options: ServePublicDirOptions): (request: Request) => Promise<Response | undefined>;",
22797
- "doc": "/**\n * Build a static-file handler for `dir`.\n *\n * Returns `undefined` on any miss so the caller **falls through to routing** - a static probe must\n * never shadow a route. That ordering is also why a `routes/robots.txt.tsx` beats a\n * `public/robots.txt` only if the caller checks routes first; the documented precedence is that the\n * static probe runs first, so `public/` wins, and an app wanting the route should not ship both.\n */"
22887
+ "doc": "/**\n * Build a static-file handler for `dir`.\n *\n * Returns `undefined` on any miss so the caller **falls through to routing** - a static probe must\n * never shadow a route. That ordering is also why a `routes/robots.txt.tsx` beats a\n * `public/robots.txt` only if the caller checks routes first; the documented precedence is that the\n * static probe runs first, so `public/` wins, and an app wanting the route should not ship both.\n *\n * A file is sent with a strong `ETag` from its bytes, the tag `@nifrajs/node`'s `static` reader and\n * the Deno entry send, and with `Last-Modified` only while its mtime is that of its own last change,\n * so a replacement that keeps a file's size and timestamps is never judged current or resumed into.\n */"
22798
22888
  },
22799
22889
  {
22800
22890
  "name": "serveTestApp",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nifrajs/cli",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "description": "The nifra CLI - zero-config dev/build/start for a nifra app (`nifra dev`, `nifra build`, `nifra start`).",
5
5
  "keywords": [
6
6
  "bun",
@@ -70,16 +70,16 @@
70
70
  "access": "public"
71
71
  },
72
72
  "dependencies": {
73
- "@nifrajs/client": "5.3.0",
74
- "@nifrajs/core": "5.3.0",
75
- "@nifrajs/agent-review": "5.3.0",
76
- "@nifrajs/i18n": "5.3.0",
77
- "@nifrajs/mcp": "5.3.0",
78
- "@nifrajs/mcp-db": "5.3.0",
79
- "@nifrajs/runner": "5.3.0",
80
- "@nifrajs/schema": "5.3.0",
81
- "@nifrajs/testing": "5.3.0",
82
- "@nifrajs/web": "5.3.0"
73
+ "@nifrajs/client": "5.4.0",
74
+ "@nifrajs/core": "5.4.0",
75
+ "@nifrajs/agent-review": "5.4.0",
76
+ "@nifrajs/i18n": "5.4.0",
77
+ "@nifrajs/mcp": "5.4.0",
78
+ "@nifrajs/mcp-db": "5.4.0",
79
+ "@nifrajs/runner": "5.4.0",
80
+ "@nifrajs/schema": "5.4.0",
81
+ "@nifrajs/testing": "5.4.0",
82
+ "@nifrajs/web": "5.4.0"
83
83
  },
84
84
  "repository": {
85
85
  "type": "git",
package/src/cli.ts CHANGED
@@ -334,7 +334,7 @@ set in the process environment is never overwritten by a file.
334
334
  ${renderCommandCatalogHelp()}`
335
335
 
336
336
  // Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
337
- const CLI_VERSION = "5.3.0"
337
+ const CLI_VERSION = "5.4.0"
338
338
 
339
339
  // A render adapter + nifra server are opaque to the CLI (it just forwards them); cast at the seam.
340
340
  const asAdapter = (v: unknown): RenderAdapter => v as RenderAdapter
package/src/mcp-http.ts CHANGED
@@ -29,7 +29,7 @@ export { docsTools } from "./mcp-docs-tools.ts"
29
29
  export type { TypeEntry } from "./types-search.ts"
30
30
 
31
31
  // Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
32
- const VERSION = "5.3.0"
32
+ const VERSION = "5.4.0"
33
33
  const SERVER_INFO = { name: "nifra-docs", version: VERSION }
34
34
  // Derive the GET/health tool list from the tools actually served, so the line can never drift from them.
35
35
  const docsHealth = (tools: McpTool[]): string =>
@@ -0,0 +1,26 @@
1
+ import type { UpgradeRecipe } from "./index.ts"
2
+
3
+ /**
4
+ * Upgrade recipe for Nifra 5.4.
5
+ *
6
+ * No import or dependency moves. A `node` build needs the adapter of the same release, and static
7
+ * files answer validators, ranges and types the same way on every runtime; each note says what an
8
+ * app or a client sees differently.
9
+ */
10
+ export const recipe: UpgradeRecipe = {
11
+ version: "5.4.0",
12
+ pins: [
13
+ { match: "@nifrajs/", to: "5.4.0" },
14
+ { match: "create-nifra", to: "5.4.0" },
15
+ { match: "nifra", to: "5.4.0" },
16
+ ],
17
+ importMoves: [],
18
+ notes: [
19
+ "The server entry a `node` build generates passes the app itself to `@nifrajs/node`'s `serve` and serves files with the adapter's own reader, so it needs the `@nifrajs/node` of the same release. With an older adapter installed the build stops before bundling, names both versions and leaves the last deploy dir in place, where a 5.3 adapter used to build and then throw when the server started. Upgrade `@nifrajs/node` with the rest.",
20
+ "Static files carry a strong `ETag` from their content (128 bits of SHA-256) on the Bun entry and `nifra dev` (`servePublicDir`), `@nifrajs/node`'s `static` reader and the generated Deno entry, the same for the same bytes on every instance. The Node reader's `\"<mtime>-<size>\"` tag is gone, so clients and caches revalidate each file once after the upgrade. `Last-Modified` is sent only while a file's mtime is its own last change, so a file whose mtime a copy or build set (every file in a container image) is sent without one and `If-Modified-Since` cannot validate it. An `If-Range` date no longer keeps a range for a tagged file; a client resumes by the tag.",
21
+ "The generated Deno entry answers static files with `etag` and `last-modified`, a `304` with no body for a current copy (HEAD included), and honors `Range` only when `If-Range` is absent or names the file's current validator, as the Bun and Node entries do. On Bun and Deno `If-None-Match` is evaluated before `If-Modified-Since`, so a stale entity tag no longer gets a `304` from the date beside it.",
22
+ "`@nifrajs/node`'s `serve({ static })` types files from the same table as `servePublicDir`, so `.pdf`, `.mp4`, `.xml`, `.csv` and other common types are no longer sent as `application/octet-stream`. It serves `/.well-known` by default, refuses a visible name that links to a dotfile, and answers a link that leaves the directory with `404` where it answered `403`. `static` also takes an array of mounts, a `files` list a mount is limited to, and `cacheControl`.",
23
+ "`@nifrajs/node`'s `static` reader parses `Range` with `@nifrajs/core/range`, like the other runtimes: overlapping or adjacent ranges are served as the one range they cover, a satisfiable range listed with unsatisfiable ones is served, an inverted range (`bytes=9-0`) answers `416` where it was ignored, a zero-length suffix (`bytes=-0`) sends the whole file where it answered `416`, and a `Range` longer than 16 KiB is ignored.",
24
+ "On Bun, `servePublicDir` (the Bun entry and `nifra dev`) sends `content-length` for files up to 1 MiB, whole or ranged, where Bun used to send them chunked with no length. Files above 1 MiB are still sent chunked.",
25
+ ],
26
+ }
@@ -15,6 +15,7 @@ import { recipe as v5_0_0 } from "./5.0.0.ts"
15
15
  import { recipe as v5_1_0 } from "./5.1.0.ts"
16
16
  import { recipe as v5_2_0 } from "./5.2.0.ts"
17
17
  import { recipe as v5_3_0 } from "./5.3.0.ts"
18
+ import { recipe as v5_4_0 } from "./5.4.0.ts"
18
19
 
19
20
  /** A pin rule: every dependency whose name starts with `match` is set to version `to`. */
20
21
  export interface PinRule {
@@ -63,6 +64,7 @@ const RECIPES: Record<string, UpgradeRecipe> = {
63
64
  [v5_1_0.version]: v5_1_0,
64
65
  [v5_2_0.version]: v5_2_0,
65
66
  [v5_3_0.version]: v5_3_0,
67
+ [v5_4_0.version]: v5_4_0,
66
68
  }
67
69
 
68
70
  export function getRecipe(version: string): UpgradeRecipe | undefined {