@nifrajs/cli 5.8.0 → 5.9.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 +134 -0
- package/dist/agent-files.d.ts +0 -22
- package/dist/agent-files.d.ts.map +1 -1
- package/dist/agent-files.js +3 -1
- package/dist/agent-files.js.map +1 -1
- package/dist/assure-hydration.d.ts.map +1 -1
- package/dist/assure-hydration.js +2 -10
- package/dist/assure-hydration.js.map +1 -1
- package/dist/assure.d.ts.map +1 -1
- package/dist/assure.js +3 -3
- package/dist/assure.js.map +1 -1
- package/dist/check-scan.d.ts +2 -0
- package/dist/check-scan.d.ts.map +1 -1
- package/dist/check-scan.js +54 -86
- package/dist/check-scan.js.map +1 -1
- package/dist/check.d.ts +3 -0
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +20 -23
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +42 -13
- package/dist/cli.js.map +1 -1
- package/dist/command-catalog.d.ts.map +1 -1
- package/dist/command-catalog.js +20 -30
- package/dist/command-catalog.js.map +1 -1
- package/dist/config-target.js +1 -1
- package/dist/config-target.js.map +1 -1
- package/dist/db-child.js +3 -10
- package/dist/db-child.js.map +1 -1
- package/dist/db-config.d.ts +2 -0
- package/dist/db-config.d.ts.map +1 -1
- package/dist/db-config.js +2 -0
- package/dist/db-config.js.map +1 -1
- package/dist/doctor.d.ts +14 -3
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +91 -6
- package/dist/doctor.js.map +1 -1
- package/dist/frontend-guidance.d.ts +19 -0
- package/dist/frontend-guidance.d.ts.map +1 -1
- package/dist/frontend-guidance.js +267 -23
- package/dist/frontend-guidance.js.map +1 -1
- package/dist/hand-built-manifest.d.ts.map +1 -1
- package/dist/hand-built-manifest.js +1 -1
- package/dist/hand-built-manifest.js.map +1 -1
- package/dist/internal/control-character.d.ts +3 -0
- package/dist/internal/control-character.d.ts.map +1 -0
- package/dist/internal/control-character.js +10 -0
- package/dist/internal/control-character.js.map +1 -0
- package/dist/internal/escape-regexp.d.ts +3 -0
- package/dist/internal/escape-regexp.d.ts.map +1 -0
- package/dist/internal/escape-regexp.js +5 -0
- package/dist/internal/escape-regexp.js.map +1 -0
- package/dist/internal/line-at.d.ts +3 -0
- package/dist/internal/line-at.d.ts.map +1 -0
- package/dist/internal/line-at.js +5 -0
- package/dist/internal/line-at.js.map +1 -0
- package/dist/internal/nifra-project.d.ts.map +1 -1
- package/dist/internal/nifra-project.js +35 -41
- package/dist/internal/nifra-project.js.map +1 -1
- package/dist/internal/posix-path.d.ts +3 -0
- package/dist/internal/posix-path.d.ts.map +1 -0
- package/dist/internal/posix-path.js +5 -0
- package/dist/internal/posix-path.js.map +1 -0
- package/dist/internal/project-specifiers.d.ts.map +1 -1
- package/dist/internal/project-specifiers.js +3 -10
- package/dist/internal/project-specifiers.js.map +1 -1
- package/dist/internal/realpath-or-self.d.ts +3 -0
- package/dist/internal/realpath-or-self.d.ts.map +1 -0
- package/dist/internal/realpath-or-self.js +11 -0
- package/dist/internal/realpath-or-self.js.map +1 -0
- package/dist/internal/record.d.ts +3 -0
- package/dist/internal/record.d.ts.map +1 -0
- package/dist/internal/record.js +5 -0
- package/dist/internal/record.js.map +1 -0
- package/dist/internal/source-facts.d.ts.map +1 -1
- package/dist/internal/source-facts.js +28 -25
- package/dist/internal/source-facts.js.map +1 -1
- package/dist/introspect.d.ts +0 -22
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +11 -151
- package/dist/introspect.js.map +1 -1
- package/dist/levels-tool.d.ts +2 -0
- package/dist/levels-tool.d.ts.map +1 -1
- package/dist/levels-tool.js +54 -64
- package/dist/levels-tool.js.map +1 -1
- package/dist/load.d.ts +6 -1
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js.map +1 -1
- package/dist/local-cli.d.ts +7 -0
- package/dist/local-cli.d.ts.map +1 -1
- package/dist/local-cli.js +13 -0
- package/dist/local-cli.js.map +1 -1
- package/dist/mcp-docs-tools.d.ts +1 -1
- package/dist/mcp-docs-tools.d.ts.map +1 -1
- package/dist/mcp-docs-tools.js +46 -3
- package/dist/mcp-docs-tools.js.map +1 -1
- package/dist/mcp-http.d.ts +1 -1
- package/dist/mcp-http.js +2 -2
- package/dist/mcp-io.d.ts +16 -0
- package/dist/mcp-io.d.ts.map +1 -1
- package/dist/mcp-io.js +63 -0
- package/dist/mcp-io.js.map +1 -1
- package/dist/mcp-isolate.d.ts.map +1 -1
- package/dist/mcp-isolate.js +2 -1
- package/dist/mcp-isolate.js.map +1 -1
- package/dist/mcp-project-child.d.ts.map +1 -1
- package/dist/mcp-project-child.js +5 -12
- package/dist/mcp-project-child.js.map +1 -1
- package/dist/mcp-render.d.ts.map +1 -1
- package/dist/mcp-render.js +9 -51
- package/dist/mcp-render.js.map +1 -1
- package/dist/mcp-root.js +1 -1
- package/dist/mcp-root.js.map +1 -1
- package/dist/mcp-run.d.ts.map +1 -1
- package/dist/mcp-run.js +3 -46
- package/dist/mcp-run.js.map +1 -1
- package/dist/mcp-ws.d.ts.map +1 -1
- package/dist/mcp-ws.js +2 -18
- package/dist/mcp-ws.js.map +1 -1
- package/dist/migrate-layout.d.ts.map +1 -1
- package/dist/migrate-layout.js +36 -57
- package/dist/migrate-layout.js.map +1 -1
- package/dist/output-schemas.d.ts.map +1 -1
- package/dist/output-schemas.js +7 -7
- package/dist/output-schemas.js.map +1 -1
- package/dist/port.d.ts.map +1 -1
- package/dist/port.js +1 -2
- package/dist/port.js.map +1 -1
- package/dist/ppr-read-fix.js +2 -2
- package/dist/ppr-read-fix.js.map +1 -1
- package/dist/recipes/5.9.0.d.ts +10 -0
- package/dist/recipes/5.9.0.d.ts.map +1 -0
- package/dist/recipes/5.9.0.js +41 -0
- package/dist/recipes/5.9.0.js.map +1 -0
- package/dist/recipes/index.d.ts +5 -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/dist/review.d.ts.map +1 -1
- package/dist/review.js +9 -13
- package/dist/review.js.map +1 -1
- package/dist/rules/contract-visibility.d.ts.map +1 -1
- package/dist/rules/contract-visibility.js +3 -9
- package/dist/rules/contract-visibility.js.map +1 -1
- package/dist/rules/data-guard.d.ts.map +1 -1
- package/dist/rules/data-guard.js +3 -10
- package/dist/rules/data-guard.js.map +1 -1
- package/dist/rules/pages.d.ts.map +1 -1
- package/dist/rules/pages.js +41 -58
- package/dist/rules/pages.js.map +1 -1
- package/dist/rules/routes.d.ts.map +1 -1
- package/dist/rules/routes.js +20 -27
- package/dist/rules/routes.js.map +1 -1
- package/dist/rules/security.d.ts.map +1 -1
- package/dist/rules/security.js +206 -313
- package/dist/rules/security.js.map +1 -1
- package/dist/rules/zones.d.ts.map +1 -1
- package/dist/rules/zones.js +3 -10
- package/dist/rules/zones.js.map +1 -1
- package/dist/runtime-differences.d.ts +62 -0
- package/dist/runtime-differences.d.ts.map +1 -0
- package/dist/runtime-differences.js +222 -0
- package/dist/runtime-differences.js.map +1 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +43 -43
- package/dist/sdk.js.map +1 -1
- package/dist/smoke.d.ts.map +1 -1
- package/dist/smoke.js +4 -12
- package/dist/smoke.js.map +1 -1
- package/dist/source-rewrites.d.ts +27 -0
- package/dist/source-rewrites.d.ts.map +1 -0
- package/dist/source-rewrites.js +402 -0
- package/dist/source-rewrites.js.map +1 -0
- package/dist/stylex-migrate.d.ts.map +1 -1
- package/dist/stylex-migrate.js +1 -1
- package/dist/stylex-migrate.js.map +1 -1
- package/dist/symptom-search.d.ts +5 -0
- package/dist/symptom-search.d.ts.map +1 -0
- package/dist/symptom-search.js +21 -0
- package/dist/symptom-search.js.map +1 -0
- package/dist/upgrade.d.ts +28 -3
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +153 -64
- package/dist/upgrade.js.map +1 -1
- package/dist/verification-plan.d.ts.map +1 -1
- package/dist/verification-plan.js +5 -3
- package/dist/verification-plan.js.map +1 -1
- package/docs/examples.json +32 -2
- package/docs/llms-full.txt +749 -95
- package/docs/types.json +300 -61
- package/package.json +11 -11
- package/src/agent-files.ts +4 -1
- package/src/assure-hydration.ts +2 -9
- package/src/assure.ts +3 -4
- package/src/check-scan.ts +65 -82
- package/src/check.ts +25 -23
- package/src/cli.ts +61 -13
- package/src/command-catalog.ts +22 -32
- package/src/config-target.ts +1 -1
- package/src/db-child.ts +3 -10
- package/src/db-config.ts +4 -0
- package/src/doctor.ts +128 -12
- package/src/frontend-guidance.ts +344 -25
- package/src/hand-built-manifest.ts +1 -2
- package/src/internal/control-character.ts +8 -0
- package/src/internal/escape-regexp.ts +4 -0
- package/src/internal/line-at.ts +4 -0
- package/src/internal/nifra-project.ts +39 -35
- package/src/internal/posix-path.ts +4 -0
- package/src/internal/project-specifiers.ts +3 -10
- package/src/internal/realpath-or-self.ts +10 -0
- package/src/internal/record.ts +4 -0
- package/src/internal/source-facts.ts +39 -29
- package/src/introspect.ts +16 -156
- package/src/levels-tool.ts +71 -78
- package/src/load.ts +6 -1
- package/src/local-cli.ts +12 -0
- package/src/mcp-docs-tools.ts +51 -3
- package/src/mcp-http.ts +2 -2
- package/src/mcp-io.ts +77 -0
- package/src/mcp-isolate.ts +2 -3
- package/src/mcp-project-child.ts +5 -14
- package/src/mcp-render.ts +11 -59
- package/src/mcp-root.ts +1 -1
- package/src/mcp-run.ts +5 -54
- package/src/mcp-ws.ts +2 -19
- package/src/migrate-layout.ts +52 -72
- package/src/output-schemas.ts +7 -8
- package/src/port.ts +1 -4
- package/src/ppr-read-fix.ts +2 -2
- package/src/recipes/5.9.0.ts +42 -0
- package/src/recipes/index.ts +7 -0
- package/src/review.ts +12 -15
- package/src/rules/contract-visibility.ts +3 -8
- package/src/rules/data-guard.ts +3 -10
- package/src/rules/pages.ts +47 -58
- package/src/rules/routes.ts +21 -27
- package/src/rules/security.ts +224 -255
- package/src/rules/zones.ts +3 -10
- package/src/runtime-differences.ts +302 -0
- package/src/sdk.ts +55 -58
- package/src/smoke.ts +4 -13
- package/src/source-rewrites.ts +463 -0
- package/src/stylex-migrate.ts +1 -3
- package/src/symptom-search.ts +27 -0
- package/src/upgrade.ts +194 -74
- package/src/verification-plan.ts +10 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-plan.d.ts","sourceRoot":"","sources":["../src/verification-plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,SAAS,CAAA;AAExD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,uFAAuF;IACvF,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;CACnC;
|
|
1
|
+
{"version":3,"file":"verification-plan.d.ts","sourceRoot":"","sources":["../src/verification-plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,SAAS,CAAA;AAExD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,uFAAuF;IACvF,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;CACnC;AA0TD,iDAAiD;AACjD,wBAAgB,iBAAiB,IAAI,SAAS,MAAM,EAAE,CAErD;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAE/E;AAOD,uEAAuE;AACvE,wBAAgB,gBAAgB,CAC9B,IAAI,GAAE,oBAAgC,GACrC,SAAS,oBAAoB,EAAE,CAQjC;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,oBAAgC,GAAG,SAAS,MAAM,EAAE,CAE7F;AAED,uEAAuE;AACvE,wBAAgB,0BAA0B,CACxC,IAAI,GAAE,oBAAgC,EACtC,QAAQ,GAAE,oBAAgC,GACzC,SAAS,MAAM,EAAE,CAGnB;AAID,4DAA4D;AAC5D,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,oBAAgC,GAAG,MAAM,CAMrF"}
|
|
@@ -19,7 +19,8 @@ const GATES = Object.freeze([
|
|
|
19
19
|
gate("docs", [["run", "check:docs"]], "Run `bun run check:docs` and update the failing documentation example."),
|
|
20
20
|
gate("api-corpus", [["run", "check:api"]], "Run `bun run gen:api` and review the generated API reference."),
|
|
21
21
|
gate("cards-corpus", [["run", "check:cards"]], "Run `bun run gen:cards` and review the generated package cards."),
|
|
22
|
-
gate("node-outcome-
|
|
22
|
+
gate("node-outcome-laws", [["run", "check:node-outcome"]], "Run `bun run check:node-outcome` and fix the Node adapter answer that breaks the printed outcome law."),
|
|
23
|
+
gate("vendored-copies", [["run", "check:vendored"]], "Edit the source each refused copy names, never the copy, then run `bun run gen:vendored`."),
|
|
23
24
|
gate("sitemap", [["run", "check:sitemap"]], "Run `bun run gen:sitemap` and review the generated sitemap."),
|
|
24
25
|
gate("site", [["run", "check:site"]], "Run `bun run check:site` and fix what the site's production build refuses; the release deploys that build after npm has the packages."),
|
|
25
26
|
gate("public-manifest", [["run", "check:public-manifest"]], "Run `bun run gen:public` and review the generated public product manifest."),
|
|
@@ -31,7 +32,7 @@ const GATES = Object.freeze([
|
|
|
31
32
|
["run", "test:coverage"],
|
|
32
33
|
["run", "check:coverage"],
|
|
33
34
|
], "Run `bun run test:coverage` first, then `bun run check:coverage`, and fix the reported coverage regression."),
|
|
34
|
-
gate("corpus", [["run", "check:corpus"]], "Run `bun run gen:llms`, `bun run gen:api`, and `bun run gen:
|
|
35
|
+
gate("corpus", [["run", "check:corpus"]], "Run `bun run gen:llms`, `bun run gen:api`, `bun run gen:cards`, and `bun run gen:vendored`, then rerun the corpus gate."),
|
|
35
36
|
gate("core-performance", [["run", "check:core-performance"]], "Run `bun run check:core-performance` and investigate the measured performance regression.", { workflowRequired: false }),
|
|
36
37
|
gate("middleware-performance", [["run", "check:middleware-overhead"]], "Run `bun run check:middleware-overhead` and investigate the middleware-chain regression.", { workflowRequired: false }),
|
|
37
38
|
gate("output-guard-performance", [["run", "check:output-guard"]], "Run `bun run check:output-guard` and investigate the data guard's projection cost.", { workflowRequired: false }),
|
|
@@ -67,7 +68,8 @@ const DEFAULT_PLAN = Object.freeze([
|
|
|
67
68
|
"docs",
|
|
68
69
|
"api-corpus",
|
|
69
70
|
"cards-corpus",
|
|
70
|
-
"node-outcome-
|
|
71
|
+
"node-outcome-laws",
|
|
72
|
+
"vendored-copies",
|
|
71
73
|
"sitemap",
|
|
72
74
|
"public-boundary",
|
|
73
75
|
"public-manifest",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-plan.js","sourceRoot":"","sources":["../src/verification-plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,MAAM,IAAI,GAAG,CACX,EAAU,EACV,QAAwC,EACxC,WAAmB,EACnB,UAAmD,EAAE,EAC/B,EAAE,CACxB,MAAM,CAAC,MAAM,CAAC;IACZ,EAAE;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACzE,WAAW;IACX,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,IAAI;CACnD,CAAC,CAAA;AAEJ,MAAM,KAAK,GAAG,MAAM,CAAC,MAA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@@
|
|
|
75
75
|
"name": "SETUP",
|
|
76
76
|
"topic": "Nifra - Auth & sessions",
|
|
77
77
|
"slug": "auth",
|
|
78
|
-
"code": "// backend/auth.ts - one session manager, created on first use so the secret is read at request time.\n// Store mode keeps data server-side; cookie mode (no store) is stateless.\nimport { createSessions, MemorySessionStore } from \"@nifrajs/auth\"\n\nlet manager: ReturnType<typeof createSessions> | undefined\nexport const getSessions = () => (manager ??= createSessions({\n secret: process.env.SESSION_SECRET!, // at least 32 bytes; never reuse another signing secret\n store: new MemorySessionStore(), // production: a strongly consistent shared SessionStore\n // cookie: { secure: false }, // local http dev only\n}))"
|
|
78
|
+
"code": "// backend/auth.ts - one session manager, created on first use so the secret is read at request time.\n// Store mode keeps data server-side; cookie mode (no store) is stateless.\nimport { createSessions, MemorySessionStore } from \"@nifrajs/auth\"\n\nlet manager: ReturnType<typeof createSessions> | undefined\nexport const getSessions = () => (manager ??= createSessions({\n secret: process.env.SESSION_SECRET!, // at least 32 bytes; never reuse another signing secret\n store: new MemorySessionStore(), // production: a strongly consistent shared SessionStore\n // identity: [\"userId\", \"orgId\", \"role\"], // the keys that say who the visitor is; unset, all of them\n // cookie: { secure: false }, // local http dev only\n}))"
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "BACKEND",
|
|
@@ -185,6 +185,12 @@
|
|
|
185
185
|
"slug": "contract",
|
|
186
186
|
"code": "import { renderPage, unsafeInlineScript } from \"@nifrajs/web\"\n\ndeclare const adapter: import(\"@nifrajs/web\").RenderAdapter\ndeclare const nonce: string // one per response, from your CSP middleware\n\nconst page = renderPage({\n adapter,\n chain: [null],\n data: null,\n clientEntry: \"/assets/client.js\",\n nonce, // reaches the hydration bootstrap, streamed scripts and every island tag\n head: {\n script: [{ content: JSON.stringify({ \"@type\": \"Article\" }) }], // inert: JSON only\n unsafeScript: [unsafeInlineScript(\"window.dataLayer = []\", { nonce })],\n },\n})"
|
|
187
187
|
},
|
|
188
|
+
{
|
|
189
|
+
"name": "NONCE_CSP_HEADER",
|
|
190
|
+
"topic": "Nifra - Framework contract",
|
|
191
|
+
"slug": "contract",
|
|
192
|
+
"code": "import { createNonceResolver, createWebApp } from \"@nifrajs/web\"\n\ndeclare const adapter: import(\"@nifrajs/web\").RenderAdapter\ndeclare const manifest: import(\"@nifrajs/web\").Manifest\n\n// A fresh nonce on every document, and nifra writes the header from that same value - on pages,\n// status pages, _error, and streamed or deferred documents - whatever rebuilds the Request in front.\nexport const app = createWebApp({\n adapter,\n manifest,\n clientEntry: \"/assets/client.js\",\n nonce: createNonceResolver(),\n // `sources`: 'nonce-…' plus a sha256 hash per constant inline script nifra writes.\n cspHeader: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`,\n})"
|
|
193
|
+
},
|
|
188
194
|
{
|
|
189
195
|
"name": "PARAM_404",
|
|
190
196
|
"topic": "Nifra - Framework contract",
|
|
@@ -231,7 +237,13 @@
|
|
|
231
237
|
"name": "FULL_APP",
|
|
232
238
|
"topic": "Nifra - Custom server (createWebApp)",
|
|
233
239
|
"slug": "custom-server",
|
|
234
|
-
"code": "import {
|
|
240
|
+
"code": "import { ONE_DAY, serveStatic } from \"@nifrajs/core/serve-static\"\nimport { createCspPolicy, createWebApp } from \"@nifrajs/web\"\nimport type { Manifest, RenderAdapter } from \"@nifrajs/web\"\n\n// From your build: the framework adapter, the route manifest, and what buildClient() returned.\ndeclare const adapter: RenderAdapter\ndeclare const manifest: Manifest\ndeclare const build: {\n readonly entry: string\n readonly assets: readonly string[]\n readonly routes: Readonly<Record<string, readonly string[]>>\n readonly css?: readonly string[]\n}\ndeclare const errors: { capture(error: unknown, tags: Record<string, string>): void }\n\n// buildClient({ outDir: \"dist/assets\" }) writes the chunks where their /assets/ URLs point.\nconst files = serveStatic([\n { dir: new URL(\"./dist/assets/\", import.meta.url), hashedFiles: build.assets, cacheControl: ONE_DAY },\n {\n dir: new URL(\"./public/\", import.meta.url),\n prefix: \"/\",\n immutable: false,\n cacheControl: ONE_DAY,\n fallthrough: true,\n },\n])\n\nconst csp = createCspPolicy({\n header: ({ sources }) => `default-src 'self'; script-src 'self' ${sources}; object-src 'none'`,\n})\n\nexport const app = createWebApp({\n adapter,\n manifest,\n clientEntry: build.entry,\n routePreload: build.routes,\n styles: build.css ?? [],\n csp,\n server: { requestTimeoutMs: 15_000, gracefulSignals: { drainMs: 8_000 } },\n onLoaderError: (error, { route }) => errors.capture(error, { route }),\n})\n\napp.listen(3000, { static: files })"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "HASHED_FONTS",
|
|
244
|
+
"topic": "Nifra - Custom server (createWebApp)",
|
|
245
|
+
"slug": "custom-server",
|
|
246
|
+
"code": "import { ONE_DAY, serveStatic } from \"@nifrajs/core/serve-static\"\n\n// The fonts loadGoogleFont wrote into public/fonts/ are content-hashed; the rest of public/ is not.\nconst HASHED_FONT = /^\\/fonts\\/[\\w-]+-[0-9a-f]{16}\\.woff2$/\n\nexport const publicFiles = serveStatic({\n dir: new URL(\"./public/\", import.meta.url),\n prefix: \"/\",\n hashedFiles: [HASHED_FONT],\n cacheControl: ONE_DAY,\n fallthrough: true,\n})"
|
|
235
247
|
},
|
|
236
248
|
{
|
|
237
249
|
"name": "ACTION",
|
|
@@ -497,6 +509,12 @@
|
|
|
497
509
|
"slug": "plugins",
|
|
498
510
|
"code": "import { server } from \"@nifrajs/core/server\"\nimport { cache, MemoryResponseCache, prettyJson } from \"@nifrajs/middleware\"\n\n// Full response cache: pluggable store, Vary-aware keys, byte cap. Bypasses Set-Cookie and respects\n// Cache-Control (no-store/private). MemoryResponseCache is per-instance - refuses prod unless opted in.\nconst app = server()\napp.use(cache({ store: new MemoryResponseCache(), ttlMs: 30_000, vary: [\"accept-language\"] }))\napp.use(prettyJson()) // pretty-print JSON responses (size-capped; optional ?pretty query toggle)"
|
|
499
511
|
},
|
|
512
|
+
{
|
|
513
|
+
"name": "GROUPED_TIERS",
|
|
514
|
+
"topic": "Nifra - Plugins & middleware",
|
|
515
|
+
"slug": "plugins",
|
|
516
|
+
"code": "import { server } from \"@nifrajs/core/server\"\nimport { MemoryStore, rateLimitTiers } from \"@nifrajs/middleware\"\n\nconst store = new MemoryStore()\nconst limiter = rateLimitTiers({\n store,\n floor: { max: 120, windowMs: 60_000 },\n tiers: [\n // One 30/min allowance across all three, not 30 each. The name is the bucket's\n // store scope, so adding or removing a prefix later keeps the live counters.\n {\n name: \"exports\",\n prefix: [\"/api/exports\", \"/api/reports/download\", \"/api/invoices/pdf\"],\n max: 30,\n windowMs: 60_000,\n },\n ],\n})\nconst app = server().use(limiter)\n\n// The store key a request is charged to, for a test or an ops tool: \"tier:exports:<ip>\".\nconst key = await limiter.keyOf(new Request(\"http://x/api/exports/csv\"), { clientIp: \"203.0.113.9\" })\nif (key !== undefined) await store.hit(key, 60_000) // pre-spend one hit"
|
|
517
|
+
},
|
|
500
518
|
{
|
|
501
519
|
"name": "IDENTITY",
|
|
502
520
|
"topic": "Nifra - Plugins & middleware",
|
|
@@ -545,6 +563,12 @@
|
|
|
545
563
|
"slug": "plugins",
|
|
546
564
|
"code": "import { server } from \"@nifrajs/core/server\"\nimport { idempotency, MemoryIdempotencyStore } from \"@nifrajs/middleware\"\n\n// A retried POST with the same Idempotency-Key replays the first response instead of\n// re-running the side effect. Shared store in production (atomic claim); dev-only memory store.\nconst app = server()\napp.use(idempotency({ store: new MemoryIdempotencyStore() }))"
|
|
547
565
|
},
|
|
566
|
+
{
|
|
567
|
+
"name": "REQUEST_LOCALS",
|
|
568
|
+
"topic": "Nifra - Plugins & middleware",
|
|
569
|
+
"slug": "plugins",
|
|
570
|
+
"code": "import { carryRequestLocals, requestLocal, server } from \"@nifrajs/core/server\"\n\n// One slot per value. A WeakMap<Request, T> would lose it at the first copy of the request.\nconst requestId = requestLocal<string>()\n\nconst billing = server().get(\"/invoices\", (c) => ({ requestId: requestId.get(c.req) }))\n\nexport const app = server()\n .onRequest((req) => {\n requestId.set(req, req.headers.get(\"x-request-id\") ?? crypto.randomUUID())\n })\n // The child sees a copy of the request with /billing stripped, and reads the same value.\n .mount({ path: \"/billing\", app: billing, stripPrefix: true })\n\n// A wrapper that rebuilds the request carries the values itself. It keeps the host, which the\n// same-origin check on a form POST compares with the browser's Origin.\nexport const fetch = (req: Request): Response | Promise<Response> => {\n const url = new URL(req.url)\n if (!url.pathname.startsWith(\"/v1/\")) return app.fetch(req)\n url.pathname = url.pathname.slice(\"/v1\".length)\n const rebuilt = new Request(url.href, req)\n carryRequestLocals(req, rebuilt)\n return app.fetch(rebuilt)\n}"
|
|
571
|
+
},
|
|
548
572
|
{
|
|
549
573
|
"name": "SESSION_TIERS",
|
|
550
574
|
"topic": "Nifra - Plugins & middleware",
|
|
@@ -617,6 +641,12 @@
|
|
|
617
641
|
"slug": "routing",
|
|
618
642
|
"code": "// routes/users/[id].backend.ts - its server half\nimport { t } from \"@nifrajs/schema\"\nimport type { Route } from \"./+types/[id]\"\n\nexport const loaderOutput = t.object({ name: t.string() })\n\nexport async function loader({ params }: Route.LoaderArgs) {\n return { name: `User ${params.id}` }\n}"
|
|
619
643
|
},
|
|
644
|
+
{
|
|
645
|
+
"name": "OPTIONS",
|
|
646
|
+
"topic": "Nifra - Runtime differences",
|
|
647
|
+
"slug": "runtime-differences",
|
|
648
|
+
"code": "import { server } from \"@nifrajs/core\"\nimport { serve } from \"@nifrajs/node\"\n\n// Deno (and Bun's Host handling): the Host header and the request target are checked and resolved.\nconst app = server({ validateHost: true, normalizeTarget: true })\n\n// Node: the adapter has the same normalizeTarget switch.\nawait serve(app, { port: 3000, normalizeTarget: true })"
|
|
649
|
+
},
|
|
620
650
|
{
|
|
621
651
|
"name": "BOUNDED",
|
|
622
652
|
"topic": "Nifra - security & hardening",
|