@nifrajs/cli 5.14.0 → 5.15.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/CHANGELOG.md +25 -0
- package/dist/check-diagnostics.d.ts.map +1 -1
- package/dist/check-diagnostics.js +22 -2
- package/dist/check-diagnostics.js.map +1 -1
- package/dist/check-scan.d.ts.map +1 -1
- package/dist/check-scan.js +7 -1
- package/dist/check-scan.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/frontend-guidance.js +12 -12
- package/dist/frontend-guidance.js.map +1 -1
- package/dist/mcp-http.js +1 -1
- package/dist/recipes/5.15.0.d.ts +12 -0
- package/dist/recipes/5.15.0.d.ts.map +1 -0
- package/dist/recipes/5.15.0.js +30 -0
- package/dist/recipes/5.15.0.js.map +1 -0
- package/dist/recipes/index.d.ts.map +1 -1
- package/dist/recipes/index.js +2 -0
- package/dist/recipes/index.js.map +1 -1
- package/docs/examples.json +7 -1
- package/docs/llms-full.txt +72 -33
- package/docs/types.json +43 -15
- package/package.json +12 -12
- package/src/check-diagnostics.ts +26 -2
- package/src/check-scan.ts +8 -1
- package/src/cli.ts +1 -1
- package/src/frontend-guidance.ts +12 -12
- package/src/mcp-http.ts +1 -1
- package/src/recipes/5.15.0.ts +40 -0
- package/src/recipes/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nifrajs/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.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,17 +70,17 @@
|
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@nifrajs/agent-review": "5.
|
|
74
|
-
"@nifrajs/client": "5.
|
|
75
|
-
"@nifrajs/core": "5.
|
|
76
|
-
"@nifrajs/i18n": "5.
|
|
77
|
-
"@nifrajs/mcp": "5.
|
|
78
|
-
"@nifrajs/mcp-db": "5.
|
|
79
|
-
"@nifrajs/runner": "5.
|
|
80
|
-
"@nifrajs/schema": "5.
|
|
81
|
-
"@nifrajs/testing": "5.
|
|
82
|
-
"@nifrajs/utils": "5.
|
|
83
|
-
"@nifrajs/web": "5.
|
|
73
|
+
"@nifrajs/agent-review": "5.15.0",
|
|
74
|
+
"@nifrajs/client": "5.15.0",
|
|
75
|
+
"@nifrajs/core": "5.15.0",
|
|
76
|
+
"@nifrajs/i18n": "5.15.0",
|
|
77
|
+
"@nifrajs/mcp": "5.15.0",
|
|
78
|
+
"@nifrajs/mcp-db": "5.15.0",
|
|
79
|
+
"@nifrajs/runner": "5.15.0",
|
|
80
|
+
"@nifrajs/schema": "5.15.0",
|
|
81
|
+
"@nifrajs/testing": "5.15.0",
|
|
82
|
+
"@nifrajs/utils": "5.15.0",
|
|
83
|
+
"@nifrajs/web": "5.15.0"
|
|
84
84
|
},
|
|
85
85
|
"repository": {
|
|
86
86
|
"type": "git",
|
package/src/check-diagnostics.ts
CHANGED
|
@@ -648,11 +648,33 @@ export async function collectCheckDiagnostics(
|
|
|
648
648
|
return [Object.freeze({ ...value, severity: override.severity })]
|
|
649
649
|
})
|
|
650
650
|
|
|
651
|
+
// A promoted contract note must also appear in the human report when it fails the gate.
|
|
652
|
+
for (const value of finalStructured) {
|
|
653
|
+
if (
|
|
654
|
+
value.severity === "error" &&
|
|
655
|
+
knownLegacyCodes.has(value.code) &&
|
|
656
|
+
diagnosticCompatibilityOf(value) === undefined
|
|
657
|
+
) {
|
|
658
|
+
const row: { -readonly [Key in keyof CheckDiagnostic]: CheckDiagnostic[Key] } = {
|
|
659
|
+
rule: value.code,
|
|
660
|
+
code: value.code,
|
|
661
|
+
severity: "error",
|
|
662
|
+
message: value.message,
|
|
663
|
+
}
|
|
664
|
+
if (value.file !== undefined) row.file = value.file
|
|
665
|
+
if (value.line !== undefined) row.line = value.line
|
|
666
|
+
finalDiagnostics.push(row)
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
651
670
|
const total = finalDiagnostics.length
|
|
652
671
|
const max = opts.maxDiagnostics
|
|
653
672
|
const shown = max !== undefined && total > max ? finalDiagnostics.slice(0, max) : finalDiagnostics
|
|
654
673
|
const nonLegacyStructuredCount = finalStructured.filter(
|
|
655
|
-
(value) =>
|
|
674
|
+
(value) =>
|
|
675
|
+
value.severity !== "error" &&
|
|
676
|
+
knownLegacyCodes.has(value.code) &&
|
|
677
|
+
diagnosticCompatibilityOf(value) === undefined,
|
|
656
678
|
).length
|
|
657
679
|
const structuredLimit =
|
|
658
680
|
shown.length < total ? shown.length + nonLegacyStructuredCount : finalStructured.length
|
|
@@ -666,7 +688,9 @@ export async function collectCheckDiagnostics(
|
|
|
666
688
|
? undefined
|
|
667
689
|
: (await import("@nifrajs/core/reflection")).reflectHooks(hookSource)
|
|
668
690
|
const result: CheckResult = {
|
|
669
|
-
ok:
|
|
691
|
+
ok:
|
|
692
|
+
!finalDiagnostics.some((value) => value.severity === "error") &&
|
|
693
|
+
!finalStructured.some((value) => value.severity === "error"),
|
|
670
694
|
typecheck: !projectFacts.check.typecheck.ran
|
|
671
695
|
? "skipped"
|
|
672
696
|
: projectFacts.check.typecheck.ok && outsideProgram === 0
|
package/src/check-scan.ts
CHANGED
|
@@ -3597,9 +3597,16 @@ export async function scanServerManifestDrift(cwd: string): Promise<ManifestDrif
|
|
|
3597
3597
|
"@nifrajs/web/build"
|
|
3598
3598
|
)
|
|
3599
3599
|
const findings: ManifestDriftFinding[] = []
|
|
3600
|
+
const manifests: string[] = []
|
|
3600
3601
|
for await (const rawRel of new Glob("**/server-manifest.ts").scan({ cwd, dot: false })) {
|
|
3601
3602
|
const rel = normalizeProjectPath(rawRel)
|
|
3602
|
-
if (IGNORED.test(rel))
|
|
3603
|
+
if (!IGNORED.test(rel)) manifests.push(rel)
|
|
3604
|
+
}
|
|
3605
|
+
// A gitignored manifest is a disposable build output the build regenerates (the ISR template), so
|
|
3606
|
+
// it cannot be stale in any way that matters - and flagging it would block the build that fixes it.
|
|
3607
|
+
const ignored = await gitIgnored(cwd, manifests)
|
|
3608
|
+
for (const rel of manifests) {
|
|
3609
|
+
if (ignored.has(rel)) continue
|
|
3603
3610
|
const source = await Bun.file(join(cwd, rel)).text()
|
|
3604
3611
|
if (!source.includes(GENERATED_MARKER)) continue // not a generated manifest - skip
|
|
3605
3612
|
const prefixMatch = ROUTES_PREFIX.exec(source)
|
package/src/cli.ts
CHANGED
|
@@ -368,7 +368,7 @@ set in the process environment is never overwritten by a file.
|
|
|
368
368
|
${renderCommandCatalogHelp()}`
|
|
369
369
|
|
|
370
370
|
// Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
|
|
371
|
-
const CLI_VERSION = "5.
|
|
371
|
+
const CLI_VERSION = "5.15.0"
|
|
372
372
|
|
|
373
373
|
// A render adapter + nifra server are opaque to the CLI (it just forwards them); cast at the seam.
|
|
374
374
|
const asAdapter = (v: unknown): RenderAdapter => v as RenderAdapter
|
package/src/frontend-guidance.ts
CHANGED
|
@@ -150,11 +150,11 @@ export const FRONTEND_GUIDANCE: readonly GuidanceEntry[] = [
|
|
|
150
150
|
symptom: "A prop or store value renders once and never tracks updates in a Solid component.",
|
|
151
151
|
cause:
|
|
152
152
|
"Solid props are getters, evaluated where you read them. Destructuring props (or reading them outside JSX/an effect) reads once and loses tracking.",
|
|
153
|
-
fix: "Access `props.x` at the point of use inside JSX, or `
|
|
153
|
+
fix: "Access `props.x` at the point of use inside JSX, or use `omit`/`merge` when you need to pass a subset on or add defaults. Never destructure props in the function signature.",
|
|
154
154
|
verify:
|
|
155
155
|
"eslint-plugin-solid - the authority on Solid reactivity; nifra routes you to it, not around it.",
|
|
156
|
-
seeAlso: "eslint-plugin-solid
|
|
157
|
-
versions: ["Solid
|
|
156
|
+
seeAlso: "eslint-plugin-solid omit merge props getters",
|
|
157
|
+
versions: ["Solid 2.0"],
|
|
158
158
|
source: "https://docs.solidjs.com/concepts/components/props",
|
|
159
159
|
category: "reactivity",
|
|
160
160
|
},
|
|
@@ -284,12 +284,12 @@ export const FRONTEND_GUIDANCE: readonly GuidanceEntry[] = [
|
|
|
284
284
|
symptom:
|
|
285
285
|
"A Solid list displays the wrong row state or does unnecessary work after an item is inserted or reordered.",
|
|
286
286
|
cause:
|
|
287
|
-
"
|
|
288
|
-
fix: "Use `<For>` for collections whose item identity can move
|
|
287
|
+
"`<For>` tracks items by identity, while `keyed={false}` tracks them by position and hands each row an item accessor. Choosing the wrong mode changes which values remain attached to a row.",
|
|
288
|
+
fix: "Use plain `<For>` for collections whose item identity can move, `keyed={false}` only when position is the identity, and `keyed={(item) => item.id}` when a stable id should carry row state.",
|
|
289
289
|
verify:
|
|
290
290
|
"Test insert, remove, and reorder operations while editing one row; assert both rendered identity and preserved local state.",
|
|
291
|
-
seeAlso: "Solid list rendering For
|
|
292
|
-
versions: ["Solid
|
|
291
|
+
seeAlso: "Solid list rendering For keyed",
|
|
292
|
+
versions: ["Solid 2.0"],
|
|
293
293
|
source: "https://docs.solidjs.com/concepts/control-flow/list-rendering",
|
|
294
294
|
category: "lists",
|
|
295
295
|
},
|
|
@@ -299,12 +299,12 @@ export const FRONTEND_GUIDANCE: readonly GuidanceEntry[] = [
|
|
|
299
299
|
symptom:
|
|
300
300
|
"A Solid computation reads a signal once and never updates, or a server-rendered value is captured before the component runs.",
|
|
301
301
|
cause:
|
|
302
|
-
"The signal is read outside a tracked computation or at module/component setup time instead of inside JSX, `
|
|
303
|
-
fix: "Read signals where Solid can track them, keep derived work in `createMemo`, and
|
|
302
|
+
"The signal is read outside a tracked computation or at module/component setup time instead of inside JSX, `createMemo`, or the compute half of `createEffect`.",
|
|
303
|
+
fix: "Read signals where Solid can track them, keep derived work in `createMemo`, and split `createEffect(compute, effect)` so reads happen in `compute` and side effects in `effect`. Do not cache a getter's current value as a plain variable.",
|
|
304
304
|
verify:
|
|
305
305
|
"Change the source signal after mount and assert the derived output changes without manually calling an update function.",
|
|
306
306
|
seeAlso: "Solid reactivity tracking createMemo createEffect",
|
|
307
|
-
versions: ["Solid
|
|
307
|
+
versions: ["Solid 2.0"],
|
|
308
308
|
source: "https://docs.solidjs.com/concepts/reactivity",
|
|
309
309
|
category: "reactivity",
|
|
310
310
|
},
|
|
@@ -314,11 +314,11 @@ export const FRONTEND_GUIDANCE: readonly GuidanceEntry[] = [
|
|
|
314
314
|
symptom: "A Solid event listener, interval, or resource outlives the owner that created it.",
|
|
315
315
|
cause:
|
|
316
316
|
"The effect allocates an external resource without registering cleanup with the current owner.",
|
|
317
|
-
fix: "
|
|
317
|
+
fix: "Return a cleanup function from the `effect` half of `createEffect(compute, effect)`, or register `onCleanup` in the same owner that created the resource. Abort async work when its owner is disposed.",
|
|
318
318
|
verify:
|
|
319
319
|
"Mount and dispose the owner repeatedly, then assert that listener, timer, and request counts return to zero.",
|
|
320
320
|
seeAlso: "Solid onCleanup effects",
|
|
321
|
-
versions: ["Solid
|
|
321
|
+
versions: ["Solid 2.0"],
|
|
322
322
|
source: "https://docs.solidjs.com/reference/lifecycle/on-cleanup",
|
|
323
323
|
category: "effects",
|
|
324
324
|
},
|
package/src/mcp-http.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { docsTools } from "./mcp-docs-tools.ts"
|
|
|
30
30
|
export type { TypeEntry } from "./types-search.ts"
|
|
31
31
|
|
|
32
32
|
// Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
|
|
33
|
-
const VERSION = "5.
|
|
33
|
+
const VERSION = "5.15.0"
|
|
34
34
|
const SERVER_INFO = { name: "nifra-docs", version: VERSION }
|
|
35
35
|
// Derive the GET/health tool list from the tools actually served, so the line can never drift from them.
|
|
36
36
|
const docsHealth = (tools: McpTool[]): string =>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { UpgradeRecipe } from "./index.ts"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Upgrade recipe for Nifra 5.15.
|
|
5
|
+
*
|
|
6
|
+
* This release has no import moves. A Solid app moves to Solid 2.0, which changes its dependencies and
|
|
7
|
+
* its build plugin. The notes cover that move, copied job and shared-state payloads, serving an app on
|
|
8
|
+
* `@nifrajs/node-uws` (which now seals it and answers fixed routes natively), the response body hook's
|
|
9
|
+
* render fast path, `c.json()` on Bun and Deno under a body hook, and where `compression()` gzips on
|
|
10
|
+
* Bun for Linux.
|
|
11
|
+
*/
|
|
12
|
+
export const recipe: UpgradeRecipe = {
|
|
13
|
+
version: "5.15.0",
|
|
14
|
+
pins: [
|
|
15
|
+
{ match: "@nifrajs/", to: "5.15.0" },
|
|
16
|
+
{ match: "create-nifra", to: "5.15.0" },
|
|
17
|
+
{ match: "nifra", to: "5.15.0" },
|
|
18
|
+
],
|
|
19
|
+
importMoves: [],
|
|
20
|
+
affects: [
|
|
21
|
+
"@nifrajs/agent",
|
|
22
|
+
"@nifrajs/core",
|
|
23
|
+
"@nifrajs/jobs",
|
|
24
|
+
"@nifrajs/middleware",
|
|
25
|
+
"@nifrajs/node-uws",
|
|
26
|
+
"@nifrajs/proxy",
|
|
27
|
+
"@nifrajs/web-solid",
|
|
28
|
+
],
|
|
29
|
+
notes: [
|
|
30
|
+
'`@nifrajs/web-solid` targets Solid 2.0 and Solid 1.x is no longer supported. Depend on `solid-js` and `@solidjs/web` ^2.0.0, use `@solidjs/vite-plugin` ^3.0.1 under Vite (replacing `vite-plugin-solid`), set `jsxImportSource` to `@solidjs/web`, and drop the `"solid"` resolve condition from `conditions`. `babel-preset-solid`, `solid-refresh` and Babel are no longer dependencies of the adapter. Components using `createResource`, `Suspense`, `ErrorBoundary`, `onMount`, `Dynamic` or `Context.Provider` move to `createMemo` under `Loading`, `Errored`, `onSettled`, `dynamic()` and the context component; `splitProps` and `mergeProps` become `omit` and `merge`. `RouteSlotHooks` takes the Solid 2 `createEffect(compute, effect)` shape and no longer has `onCleanup`. In production a server render error reaches the client as a bare error with no server path.',
|
|
31
|
+
"`MemoryJobStore` copies a job's payload when it is enqueued and again when it is leased, and refuses with a `TypeError` a payload a structured clone would change: a function, a class instance or null-prototype object, an accessor, an `Error`, or a `SharedArrayBuffer`. Pass such values as an identifier and rebuild them in the handler.",
|
|
32
|
+
"Shared-state patch values and subscriber batches are copied, so each observer receives its own batch and a caller cannot change live state without a new patch. A value that cannot be cloned faithfully, including shared memory and custom prototypes, is rejected before the batch commits.",
|
|
33
|
+
"`@nifrajs/proxy` requires a patched Undici as its peer: `^7.30.2 || >=8.12.4`. Update `undici` if your lockfile pins an older 7.x. `nifra check` now honors promoted diagnostic errors in its exit verdict, so a diagnostic you promoted to an error fails the run.",
|
|
34
|
+
"`@nifrajs/node-uws` answers `staticResponse()` GET routes inside uWebSockets.js, without a call into JavaScript, and fixed POST routes without building a Web `Request`, whenever nothing in the app can observe the request (no request or response hook, deadline, capacity gate, Host policy, schema, auth or other route-level stage). A POST carrying an `Origin` header still goes through the cross-site form check. New `echoParam(path)` answers a GET route with its final path parameter as text, exactly as sent.",
|
|
35
|
+
"Serving an app on `@nifrajs/node-uws` now seals it, as `listen()` does, so a hook or route added after `serve()` throws `SERVER_SEALED` instead of being skipped on the native paths. Register everything before serving.",
|
|
36
|
+
"A response-observer bundle can offer `renderBody`, a synchronous fast path for its `onResponseBody` hook that builds one `Response` from a handler's returned value. The body hook is not run again over a response it rendered with new bytes, so a custom body hook that is also used as a renderer must be idempotent on its own output. `compression()` uses it; nothing changes for an app that does not write its own response-observer bundle.",
|
|
37
|
+
"On Bun and Deno, `c.json()` keeps the JSON text it wrote when the app has a response body hook, as `c.text()` already did, so a gzipped `c.json()` reply goes out with a `Content-Length` instead of chunked. An app with no body hook builds its reply as before.",
|
|
38
|
+
"`compression()` on Bun for Linux gzips a buffered body up to 64 KiB inline on the event loop, where bodies over 4 KiB went to the thread pool. Bun on macOS keeps the 4 KiB cut.",
|
|
39
|
+
],
|
|
40
|
+
}
|
package/src/recipes/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { recipe as v5_11_0 } from "./5.11.0.ts"
|
|
|
26
26
|
import { recipe as v5_12_0 } from "./5.12.0.ts"
|
|
27
27
|
import { recipe as v5_13_0 } from "./5.13.0.ts"
|
|
28
28
|
import { recipe as v5_14_0 } from "./5.14.0.ts"
|
|
29
|
+
import { recipe as v5_15_0 } from "./5.15.0.ts"
|
|
29
30
|
|
|
30
31
|
/** A pin rule: every dependency whose name starts with `match` is set to version `to`. */
|
|
31
32
|
export interface PinRule {
|
|
@@ -111,6 +112,7 @@ const RECIPES: Record<string, UpgradeRecipe> = {
|
|
|
111
112
|
[v5_12_0.version]: v5_12_0,
|
|
112
113
|
[v5_13_0.version]: v5_13_0,
|
|
113
114
|
[v5_14_0.version]: v5_14_0,
|
|
115
|
+
[v5_15_0.version]: v5_15_0,
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
export function getRecipe(version: string): UpgradeRecipe | undefined {
|