@k8ordo/framework 1.4.0 → 1.4.2

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.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.mjs +1 -2
  3. package/dist/runtime/app-router.d.mts +1 -3
  4. package/dist/runtime/app-router.mjs +1 -2
  5. package/dist/runtime/browser-payloads.d.mts +1 -3
  6. package/dist/runtime/browser-payloads.mjs +1 -2
  7. package/dist/runtime/cancel.d.mts +1 -3
  8. package/dist/runtime/cancel.mjs +1 -2
  9. package/dist/runtime/client-ready.d.mts +1 -3
  10. package/dist/runtime/client-ready.mjs +1 -2
  11. package/dist/runtime/cookies.d.mts +1 -3
  12. package/dist/runtime/cookies.mjs +1 -2
  13. package/dist/runtime/entry.browser.mjs +1 -2
  14. package/dist/runtime/entry.rsc.d.mts +1 -3
  15. package/dist/runtime/entry.rsc.mjs +1 -2
  16. package/dist/runtime/entry.ssr.d.mts +1 -3
  17. package/dist/runtime/entry.ssr.mjs +1 -2
  18. package/dist/runtime/fallback-boundary.d.mts +0 -2
  19. package/dist/runtime/fallback-boundary.mjs +1 -2
  20. package/dist/runtime/guard.d.mts +0 -2
  21. package/dist/runtime/guard.mjs +1 -2
  22. package/dist/runtime/is-payload.d.mts +1 -3
  23. package/dist/runtime/is-payload.mjs +1 -2
  24. package/dist/runtime/mount.d.mts +1 -3
  25. package/dist/runtime/mount.mjs +1 -2
  26. package/dist/runtime/page-boundary.d.mts +0 -2
  27. package/dist/runtime/page-boundary.mjs +1 -2
  28. package/dist/runtime/page-shown.d.mts +1 -3
  29. package/dist/runtime/page-shown.mjs +1 -2
  30. package/dist/runtime/page-watch.d.mts +1 -3
  31. package/dist/runtime/page-watch.mjs +1 -2
  32. package/dist/runtime/params.d.mts +0 -2
  33. package/dist/runtime/params.mjs +1 -2
  34. package/dist/runtime/pathname.d.mts +1 -3
  35. package/dist/runtime/pathname.mjs +1 -2
  36. package/dist/runtime/payload-path.d.mts +1 -3
  37. package/dist/runtime/payload-path.mjs +1 -2
  38. package/dist/runtime/payload.d.mts +1 -3
  39. package/dist/runtime/payload.mjs +1 -2
  40. package/dist/runtime/prefetch.d.mts +1 -3
  41. package/dist/runtime/prefetch.mjs +1 -2
  42. package/dist/runtime/recover.d.mts +1 -3
  43. package/dist/runtime/recover.mjs +1 -2
  44. package/dist/runtime/redirect-file.d.mts +0 -2
  45. package/dist/runtime/redirect-file.mjs +1 -2
  46. package/dist/runtime/redirect.d.mts +0 -2
  47. package/dist/runtime/redirect.mjs +1 -2
  48. package/dist/runtime/reload.d.mts +1 -3
  49. package/dist/runtime/reload.mjs +1 -2
  50. package/dist/runtime/render.d.mts +1 -3
  51. package/dist/runtime/render.mjs +1 -2
  52. package/dist/runtime/request-scope.d.mts +1 -3
  53. package/dist/runtime/request-scope.mjs +1 -2
  54. package/dist/runtime/request.d.mts +1 -3
  55. package/dist/runtime/request.mjs +1 -2
  56. package/dist/runtime/revealed.d.mts +1 -3
  57. package/dist/runtime/revealed.mjs +1 -2
  58. package/dist/runtime/route.d.mts +0 -2
  59. package/dist/runtime/route.mjs +1 -2
  60. package/dist/runtime/says-not-found.d.mts +1 -3
  61. package/dist/runtime/says-not-found.mjs +1 -2
  62. package/dist/runtime/shell.d.mts +1 -3
  63. package/dist/runtime/shell.mjs +1 -2
  64. package/dist/runtime/tree-pathname.d.mts +1 -3
  65. package/dist/runtime/tree-pathname.mjs +1 -2
  66. package/dist/serve.d.mts +1 -3
  67. package/dist/serve.mjs +2 -3
  68. package/dist/server.d.mts +0 -16
  69. package/dist/server.mjs +2 -4
  70. package/dist/{shared-dir-CkF4QCWc.mjs → shared-dir-CNXFRZgP.mjs} +1 -2
  71. package/dist/{static-BaGdAVF1.d.mts → static-6z8_6B1U.d.mts} +0 -6
  72. package/dist/{static-host-dgtttTuZ.mjs → static-host-C6D_11Gp.mjs} +6 -12
  73. package/dist/vercel.d.mts +1 -5
  74. package/dist/vercel.mjs +3 -5
  75. package/dist/vite.d.mts +1 -3
  76. package/dist/vite.mjs +16 -30
  77. package/docs/GUIDE.md +10 -0
  78. package/package.json +5 -5
package/dist/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as pagePathFor, a as cloudflareCounts, b as NOT_FOUND_SEGMENT, c as rewriteFor, d as ENCODINGS, f as SUFFIX, g as isPayloadPath, i as builtRules, l as rulesOf, n as resolveStatic, o as cloudflareMatches, p as isCompressible, s as formatRedirects, t as readRules, u as shellRules, v as payloadPathFor, x as decodePathname, y as FALLBACK_SEGMENT } from "./static-host-dgtttTuZ.mjs";
2
- import { t as sharedDir } from "./shared-dir-CkF4QCWc.mjs";
1
+ import { _ as pagePathFor, a as cloudflareCounts, b as NOT_FOUND_SEGMENT, c as rewriteFor, d as ENCODINGS, f as SUFFIX, g as isPayloadPath, i as builtRules, l as rulesOf, n as resolveStatic, o as cloudflareMatches, p as isCompressible, s as formatRedirects, t as readRules, u as shellRules, v as payloadPathFor, x as decodePathname, y as FALLBACK_SEGMENT } from "./static-host-C6D_11Gp.mjs";
2
+ import { t as sharedDir } from "./shared-dir-CNXFRZgP.mjs";
3
3
  import { createRequire, findPackageJSON } from "node:module";
4
4
  import { normalizePathname, withBase, withoutBase } from "@k8ordo/router";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -12,7 +12,7 @@ import { promisify } from "node:util";
12
12
  import { brotliCompress, constants, gzip } from "node:zlib";
13
13
  import { contentType, lookup } from "mime-types";
14
14
  import { createHash } from "node:crypto";
15
- //#region ../framework-engine/dist/grammar/tree.mjs
15
+ // ../framework-engine/dist/grammar/tree.mjs
16
16
  const CONVENTION = {
17
17
  "page.tsx": "page",
18
18
  "layout.tsx": "layout",
@@ -261,8 +261,7 @@ const parseRouteTree = (files) => {
261
261
  problems
262
262
  };
263
263
  };
264
- //#endregion
265
- //#region ../framework-engine/dist/runtime/route.mjs
264
+ // ../framework-engine/dist/runtime/route.mjs
266
265
  /** The request methods a `route.ts` answers by exporting a function named so. */
267
266
  const ROUTE_METHODS = [
268
267
  "GET",
@@ -273,8 +272,7 @@ const ROUTE_METHODS = [
273
272
  "DELETE",
274
273
  "OPTIONS"
275
274
  ];
276
- //#endregion
277
- //#region ../framework-engine/dist/host.mjs
275
+ // ../framework-engine/dist/host.mjs
278
276
  /**
279
277
  * The package the application actually installed. This engine is bundled
280
278
  * into it rather than published on its own, so it is the only name
@@ -282,8 +280,7 @@ const ROUTE_METHODS = [
282
280
  * prebundle is addressed through it, and the generated files name it.
283
281
  */
284
282
  const FRAMEWORK = "@k8ordo/framework";
285
- //#endregion
286
- //#region ../framework-engine/dist/generate/emit.mjs
283
+ // ../framework-engine/dist/generate/emit.mjs
287
284
  /** What answers a directory's own URL: its page, or its route.ts. */
288
285
  const ownFile = (dir) => dir.page ?? dir.route;
289
286
  /**
@@ -874,8 +871,7 @@ const emitRegisterModule = (options) => {
874
871
  lines.push("");
875
872
  return lines.join("\n");
876
873
  };
877
- //#endregion
878
- //#region ../framework-engine/dist/runtime/payload.mjs
874
+ // ../framework-engine/dist/runtime/payload.mjs
879
875
  /**
880
876
  * Said by the handler under mode: 'static' alone, on the not-found a page
881
877
  * answered with `notFound()`: the build tells it apart from a param a schema
@@ -915,8 +911,7 @@ const SHELL_HEADER = "x-k8ordo-shell";
915
911
  const CLIENT_DEPS_HEADER = "x-k8ordo-client-deps";
916
912
  /** What `clientDepsHeader` said. */
917
913
  const readClientDeps = (value) => JSON.parse(decodeURIComponent(value));
918
- //#endregion
919
- //#region ../framework-engine/dist/generate/write.mjs
914
+ // ../framework-engine/dist/generate/write.mjs
920
915
  /** The filesystem edge: everything below it is a pure function of this list. */
921
916
  const scanRoutes = async (dir) => {
922
917
  const walk = async (relative) => {
@@ -1079,8 +1074,7 @@ const writeIfChanged = async (file, content) => {
1079
1074
  } catch {}
1080
1075
  await writeFile(file, content, "utf8");
1081
1076
  };
1082
- //#endregion
1083
- //#region ../framework-engine/dist/plugin/core.mjs
1077
+ // ../framework-engine/dist/plugin/core.mjs
1084
1078
  const VIRTUAL_ROUTES = "virtual:k8ordo/routes";
1085
1079
  /**
1086
1080
  * The warning a module gets when the RSC plugin's list of Server Actions is
@@ -1290,8 +1284,7 @@ const engine = (options, host) => {
1290
1284
  plugin
1291
1285
  ];
1292
1286
  };
1293
- //#endregion
1294
- //#region ../framework-engine/dist/plugin/server-actions.mjs
1287
+ // ../framework-engine/dist/plugin/server-actions.mjs
1295
1288
  /**
1296
1289
  * The modules that declared `'use server'`, as the RSC pipeline found them —
1297
1290
  * relative to the project root, in a stable order.
@@ -1322,8 +1315,7 @@ const serverActionModules = (config) => {
1322
1315
  * `node_modules`; the question here is about the id in hand.
1323
1316
  */
1324
1317
  const isServerActionModule = (config, id) => getPluginApi(config)?.manager.serverReferences.claimMap.has(id) ?? false;
1325
- //#endregion
1326
- //#region src/precompress.ts
1318
+ // src/precompress.ts
1327
1319
  const compress = {
1328
1320
  br: (data) => promisify(brotliCompress)(data, { params: {
1329
1321
  [constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MAX_QUALITY,
@@ -1355,8 +1347,7 @@ const precompress = async (dir) => {
1355
1347
  }))).includes(true);
1356
1348
  }))).filter(Boolean).length;
1357
1349
  };
1358
- //#endregion
1359
- //#region src/server-mode.ts
1350
+ // src/server-mode.ts
1360
1351
  const SERVE = fileURLToPath(new URL("./serve.mjs", import.meta.url));
1361
1352
  const LAUNCHER = "virtual:k8ordo/launcher";
1362
1353
  /**
@@ -1442,8 +1433,7 @@ const serverMode = () => ({
1442
1433
  }
1443
1434
  }
1444
1435
  });
1445
- //#endregion
1446
- //#region src/documents.ts
1436
+ // src/documents.ts
1447
1437
  const escapeMarkup = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
1448
1438
  /**
1449
1439
  * The sitemap protocol's one required element per URL: `<loc>`. The site is
@@ -1701,8 +1691,7 @@ const unlinkedMessage = (unlinked, report) => {
1701
1691
  ...files.length > LISTED ? [` … and ${counting(files.length - LISTED, "more file", "more files")}`] : []
1702
1692
  ].join("\n");
1703
1693
  };
1704
- //#endregion
1705
- //#region src/paths.ts
1694
+ // src/paths.ts
1706
1695
  /**
1707
1696
  * Every pattern the table declares — pages, redirects and catch-alls — in
1708
1697
  * the order the matcher will try them. The engine's one walk, so the build
@@ -1996,8 +1985,7 @@ const answeredByRoute = (dir, pathname) => {
1996
1985
  }
1997
1986
  return false;
1998
1987
  };
1999
- //#endregion
2000
- //#region src/static.ts
1988
+ // src/static.ts
2001
1989
  const NO_SHELLS = {
2002
1990
  paths: /* @__PURE__ */ new Set(),
2003
1991
  shells: []
@@ -2506,8 +2494,7 @@ const writeRoute = async (file, handler, url) => {
2506
2494
  type: response.headers.get("content-type")
2507
2495
  };
2508
2496
  };
2509
- //#endregion
2510
- //#region src/vite.ts
2497
+ // src/vite.ts
2511
2498
  const RUNTIME_DIR = fileURLToPath(new URL("./runtime/", import.meta.url));
2512
2499
  const STATIC_ONLY = [
2513
2500
  "paths",
@@ -2542,5 +2529,4 @@ const framework = (options) => {
2542
2529
  runtimeDir: RUNTIME_DIR
2543
2530
  }), ...valid.mode === "static" ? staticMode(valid) : [serverMode()]];
2544
2531
  };
2545
- //#endregion
2546
2532
  export { framework };
package/docs/GUIDE.md CHANGED
@@ -153,6 +153,9 @@ import type { LayoutProps } from '@k8ordo/framework';
153
153
  export default function RootLayout({ children }: LayoutProps<'/'>) {
154
154
  return (
155
155
  <html lang="en">
156
+ <head>
157
+ <meta charSet="utf-8" />
158
+ </head>
156
159
  <body>{children}</body>
157
160
  </html>
158
161
  );
@@ -185,6 +188,13 @@ The root layout renders `<html>` and `<body>`: the framework has no document
185
188
  template of its own, because a template you cannot see is a template you
186
189
  cannot change.
187
190
 
191
+ **The root layout names the encoding too.** A static host may send `text/html`
192
+ with no charset, and a browser reading the page as anything but UTF-8 garbles
193
+ the text outside ASCII. Under a [`csp`](references/csp.md#static-mode-hashes-in-a-meta)
194
+ policy the payload script then no longer matches its hash and is refused, so
195
+ the page never hydrates. `<meta charSet="utf-8" />` holds whatever the host
196
+ sends.
197
+
188
198
  **The root layout is the document, and hydration checks all of it.** Anything
189
199
  that rewrites the HTML on the way to the browser — a CDN that inlines web
190
200
  fonts, obfuscates email addresses, or defers scripts — changes a tree React
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k8ordo/framework",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "The k8ordo framework: routes/ compiled into React Server Components, run with or without a server.",
5
5
  "keywords": [
6
6
  "k8ordo",
@@ -76,7 +76,7 @@
76
76
  "devDependencies": {
77
77
  "@arethetypeswrong/cli": "0.18.5",
78
78
  "@k8ordo/framework-engine": "^0.1.1",
79
- "@k8ordo/router": "^1.4.0",
79
+ "@k8ordo/router": "^1.4.2",
80
80
  "@types/compressible": "2.0.3",
81
81
  "@types/fresh": "0.5.3",
82
82
  "@types/mime-types": "3.0.1",
@@ -87,12 +87,12 @@
87
87
  "react": "19.3.1",
88
88
  "react-dom": "19.3.1",
89
89
  "typescript": "7.0.2",
90
- "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
91
- "vite-plus": "1.3.0",
90
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
91
+ "vite-plus": "1.4.0",
92
92
  "vitest": "5.0.5"
93
93
  },
94
94
  "peerDependencies": {
95
- "@k8ordo/router": "^1.4.0",
95
+ "@k8ordo/router": "^1.4.2",
96
96
  "oxc-transform-react": "^0.152.0",
97
97
  "react": ">=19.3.0",
98
98
  "react-dom": ">=19.3.0",