@sproutboat/toolchain 0.4.11 → 0.4.12

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 CHANGED
@@ -1,10 +1,20 @@
1
1
  # @sproutboat/toolchain
2
2
 
3
+ ## 0.4.12
4
+
5
+ ### Patch Changes
6
+
7
+ - ed9640a: Point Porffor patch diagnostics, runtime comments, and historical notes to the
8
+ shared upstream notes in the Sproutboat platform repository.
9
+ - b6cc9e6: Pin Porffor alpha 9, including alpha 8's compiler and GC fixes and alpha 9's ESM module support. Adapt the native-fetch link and compile-flag patches to Porffor's split C-unit build. Preserve the published 0.4.11 `TypedArray.from` workaround, which alpha 9 still needs. Re-vendor the verified alpha 9 source archive. The uWebSockets commit is unchanged.
10
+
3
11
  ## 0.4.11
4
12
 
5
13
  ### Patch Changes
6
14
 
7
- - 6d72af7: Fix `TypedArray.from` with array-like inputs in native binaries, and regenerate Porffor's builtins table when its compiler is unpacked through a symlinked temporary path. This preserves the key bytes in repeated HMAC signing with `Uint8Array.from({ length: 16 }, mapFn)`.
15
+ - 6d72af7: Fix `TypedArray.from` with array-like inputs in native binaries and
16
+ regenerate Porffor's builtin table after the source patch, including when
17
+ the compiler is unpacked through a symlinked temporary path.
8
18
 
9
19
  ## 0.4.10
10
20
 
@@ -87,7 +97,7 @@
87
97
  prototype and stop once the "next" pointer stops advancing, reading a
88
98
  fixed-point chain as "no `.then` found" instead of spinning. Not specific to
89
99
  `Date.prototype.toISOString()` — an earlier note wrongly correlated the bug
90
- with that one call; see `sproutboat-cli/patches/UPSTREAM.md`.
100
+ with that one call; see `https://github.com/baronunread/sproutboat/tree/main/patches/upstream`.
91
101
 
92
102
  ## 0.4.0
93
103
 
@@ -0,0 +1,70 @@
1
+ # Porffor alpha 9 upgrade audit
2
+
3
+ Pin: `de4eb588264885b3a1596f75010e371a2052033f`, tagged `alpha-9` on
4
+ 2026-09-24. The vendored codeload archive has SHA-256
5
+ `1a62187a93356b36cb6ac703ce9770c8917e4fa65545fd7c33ee8a180ae5a4c9`.
6
+
7
+ ## Alpha 8 changes
8
+
9
+ The [alpha 8 release](https://github.com/CanadaHonk/porffor/releases/tag/alpha-8)
10
+ contains 27 commits. Every commit falls into one of these groups:
11
+
12
+ | Area | Commits | Effect on Sproutboat |
13
+ | --- | --- | --- |
14
+ | Language and compiler correctness | `6063154a`, `8436b386`, `d3376a2d`, `8833624c`, `b92571c4`, `dfab4235`, `65a6bb3f`, `cb26d320`, `6a47f02c`, `acf6dda0`, `c54557ba`, `50855902`, `5e5db5a4`, `6ec00849`, `61d42690` | Better default parameters, spread calls, object values, closure parameters, uninitialized and `let` bindings, optional computed keys, `finally` and exception exits; the remaining edits remove redundant IR and code generation. These improve handler correctness without replacing a local patch. |
15
+ | GC and memory | `83cd4902`, `b5eb0b98`, `9e283dd2`, `f687ac7c`, `08bf855d`, `135d2761`, `ae4002b1`, `a110867b` | Smaller memory commitment and less GC work. `a110867b` supplies a C macro used by the renderer. No Sproutboat GC patch exists to remove. |
16
+ | String built-ins | `f483ba7e` | Better `substring` and `substr`; no corresponding local shim. |
17
+ | Compiler progress | `b77750b0` | Shows compile progress on a TTY; no runtime contract change. |
18
+ | Self-hosted tools and benchmarks | `370f1f75`, `7b12abd2` | Adds `stat.isFile` and a TypeScript compiler benchmark; neither is used by Sproutboat. |
19
+
20
+ ## Alpha 9 and cleanup decision
21
+
22
+ The [alpha 9 release](https://github.com/CanadaHonk/porffor/releases/tag/alpha-9)
23
+ contains `de4eb588`, adding ESM imports and exports. A direct native-fetch
24
+ fixture importing a sibling module compiled and returned its imported value.
25
+ Porffor now compiles modules as separate cached C units. The local `SB_EXTRA_LINK`
26
+ and `SB_EXTRA_CFLAGS` patches had to move to the new link list and shared
27
+ compile arguments. `UWS_COMMIT` remains `360c276d609d59af56ae6932adb95154ace9f15f`.
28
+
29
+ No local patch is superseded by the alpha 8 or 9 changes. The patches provide
30
+ Sproutboat-specific native-fetch behavior: `$PORT`, log routing, bytestring
31
+ encoding, raw asset bodies, status and header handling, request size, R2
32
+ transfers, and external link and include flags. The CLI still bundles before
33
+ Porffor to validate the full dependency graph, apply its Node shims, and pass
34
+ one controlled handler export to the runtime wrapper. Native ESM makes a future
35
+ module-based wrapper possible, but removing Bun.build or export normalization
36
+ now would also change capability validation and binding behavior. Porffor's
37
+ old external esbuild requirement is gone in alpha 9, so the CLI can drop its
38
+ esbuild dependency and bundled platform executable.
39
+
40
+ A module-wrapper prototype compiled a separate handler module. Its normal
41
+ `env.GREETING` reference returned HTTP 500; using `globalThis.env.GREETING`
42
+ returned HTTP 200. The current export normalization keeps the existing
43
+ unqualified `env` contract. The direct ESM import is now part of the CI native
44
+ crypto vector, so a future pin cannot silently lose module support.
45
+
46
+ Alpha 9 caches compiled C units by the absolute entry path. In one local
47
+ `hello` handler-edit comparison, a stable path compiled in 549 ms versus
48
+ 1,505 ms with changing paths. The CLI's `dev` loop now uses a stable entry
49
+ path per process while keeping candidate artifacts isolated. These are local
50
+ single-run timings, not a published performance claim.
51
+
52
+ The published `@sproutboat/toolchain@0.4.11` includes a `TypedArray.from`
53
+ array-like input patch absent from this checkout's 0.4.10 base. Clean alpha 9
54
+ still returns an empty array for `Uint8Array.from({ length: 4 }, mapFn)`. The
55
+ 0.4.11 patch was carried forward, its precompiled builtin table is regenerated,
56
+ and a native crypto vector now exercises that array-like input.
57
+
58
+ Regression evidence for this pin: toolchain tests (11), CLI tests (92), both
59
+ kitchen-sink harnesses (27 broker checks, 29 standalone checks), and all 12 CLI
60
+ examples passed. The direct ESM fixture returned HTTP 200 with the imported
61
+ value. The package typecheck and lint passed.
62
+
63
+ ## Release order
64
+
65
+ The registry's latest toolchain is 0.4.11 and still pins alpha 7. This checkout
66
+ has been reconciled with that release's `TypedArray.from` patch; its pending
67
+ changeset targets 0.4.12. Publish the alpha 9 toolchain first. Then update
68
+ `sproutboat-cli`, the main `sproutboat` app, and `sproutboat-site/web` to require
69
+ 0.4.12 and refresh their lockfiles. The CLI can then ship without an esbuild
70
+ executable. Until 0.4.12 is published, existing npm consumers still run alpha 7.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutboat/toolchain",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -28,7 +28,7 @@ async function fixture(): Promise<{ archive: string; sha256: string }> {
28
28
  " }\n" +
29
29
  " return -1;\n" +
30
30
  "}\n",
31
- "compiler/index.js": " '-xc', '-', '-c',\n uSocketsArchive,\n '-lm'\n",
31
+ "compiler/index.js": " ...darwinReleaseCompileArgs,\n uSocketsArchive,\n '-lm'\n",
32
32
  "compiler/precompile.js":
33
33
  "const fs = require('node:fs');\n" +
34
34
  "const path = require('node:path');\n" +
package/src/acquire.ts CHANGED
@@ -5,7 +5,7 @@ import { homedir } from "node:os";
5
5
  import { resolve } from "node:path";
6
6
  // @ts-expect-error Bun's file loader supplies a path; see the pinned-commit
7
7
  // check below for why this is safe to trust unconditionally.
8
- import vendoredPorfforArchive from "../vendor/porffor-8f01541.tar.gz" with { type: "file" };
8
+ import vendoredPorfforArchive from "../vendor/porffor-de4eb58.tar.gz" with { type: "file" };
9
9
  import { ensurePorfforPatched } from "./patch";
10
10
  import { PORFFOR_ARCHIVE_SHA256, PORFFOR_ARCHIVE_URL, PORFFOR_COMMIT_FULL } from "./pin";
11
11
  // Folded into the cache manifest below so a toolchain release that changes
package/src/patch.ts CHANGED
@@ -8,7 +8,9 @@
8
8
  *
9
9
  * Each edit is independent and re-applied on every build; a file patched by an
10
10
  * older version of this module still receives the newer edits. All of them are
11
- * tracked in patches/UPSTREAM.md and go away as Porffor closes the gaps.
11
+ * tracked in the platform's upstream notes:
12
+ * https://github.com/baronunread/sproutboat/tree/main/patches/upstream
13
+ * They go away as Porffor closes the gaps.
12
14
  */
13
15
  import { readFile, realpath, writeFile } from "node:fs/promises";
14
16
  import { resolve } from "node:path";
@@ -152,20 +154,21 @@ const RENDER_REPLACEMENTS = [
152
154
  * a musl (deploy) build overrides it outright. This splices one spread of
153
155
  * `SB_EXTRA_LINK` before `-lm`, inert unless the variable is set.
154
156
  */
155
- const LINK_ANCHOR = " uSocketsArchive,\n '-lm'\n";
157
+ const LINK_ANCHOR = " uSocketsArchive,\n '-lm'\n";
156
158
  const LINK_INJECT =
157
- " ...(process.env.SB_EXTRA_LINK ? process.env.SB_EXTRA_LINK.split(' ').filter(Boolean) : []),\n";
159
+ " ...(process.env.SB_EXTRA_LINK ? process.env.SB_EXTRA_LINK.split(' ').filter(Boolean) : []),\n";
158
160
  const LINK_MARKER = "SB_EXTRA_LINK";
159
161
 
160
162
  /**
161
163
  * #15 — and the same for the compile step, so the prelude's inline C can
162
- * `#include <bearssl.h>`. The link patch alone is not enough: Porffor compiles
163
- * the generated C from stdin with a fixed argument list, so there is otherwise
164
- * no way to add an include path.
164
+ * `#include <bearssl.h>`. The link patch alone is not enough: Porffor's
165
+ * module builds compile several C units with a fixed argument list, so there
166
+ * is otherwise no way to add an include path. Add the flag before the cache
167
+ * stamp is computed so a change invalidates compiled units.
165
168
  */
166
- const CFLAGS_ANCHOR = " '-xc', '-', '-c',\n";
169
+ const CFLAGS_ANCHOR = " ...darwinReleaseCompileArgs,\n";
167
170
  const CFLAGS_INJECT =
168
- " ...(process.env.SB_EXTRA_CFLAGS ? process.env.SB_EXTRA_CFLAGS.split(' ').filter(Boolean) : []),\n";
171
+ " ...(process.env.SB_EXTRA_CFLAGS ? process.env.SB_EXTRA_CFLAGS.split(' ').filter(Boolean) : []),\n";
169
172
  const CFLAGS_MARKER = "SB_EXTRA_CFLAGS";
170
173
 
171
174
  // Porffor's TypedArray.from only handles iterables. An array-like input such
@@ -817,7 +820,7 @@ export async function patchUwebsockets(root: string): Promise<void> {
817
820
  if (!src.includes(anchor)) {
818
821
  throw new Error(
819
822
  `could not patch Porffor's ${what}: anchor not found in ${file}. ` +
820
- "Porffor's uWebSockets shim changed — check patches/UPSTREAM.md.",
823
+ "Porffor's uWebSockets shim changed. See https://github.com/baronunread/sproutboat/tree/main/patches/upstream.",
821
824
  );
822
825
  }
823
826
  src = src.replace(anchor, inject);
@@ -839,11 +842,11 @@ async function patchCompilerArgs(root: string): Promise<void> {
839
842
  if (at === -1) {
840
843
  throw new Error(
841
844
  `could not patch Porffor for ${what}: anchor not found in ${file}. ` +
842
- "Porffor's native-fetch build changed — check patches/UPSTREAM.md.",
845
+ "Porffor's native-fetch build changed. See https://github.com/baronunread/sproutboat/tree/main/patches/upstream.",
843
846
  );
844
847
  }
845
- // After the anchor for cflags (the args follow it), before it for the link
846
- // line (the object list ends with it).
848
+ // Add flags to compileOnlyArgs so every generated C unit sees them and
849
+ // Porffor's module-build cache includes them in its compiler command.
847
850
  src =
848
851
  marker === CFLAGS_MARKER
849
852
  ? src.slice(0, at + anchor.length) + inject + src.slice(at + anchor.length)
@@ -892,7 +895,7 @@ export async function patchRenderJs(root: string): Promise<void> {
892
895
  if (at === -1) {
893
896
  throw new Error(
894
897
  `could not patch Porffor for ${what}: anchor not found in ${file}. ` +
895
- "Porffor's native-fetch renderer changed — check patches/UPSTREAM.md.",
898
+ "Porffor's native-fetch renderer changed. See https://github.com/baronunread/sproutboat/tree/main/patches/upstream.",
896
899
  );
897
900
  }
898
901
  src = src.slice(0, at + anchor.length) + inject + src.slice(at + anchor.length);
@@ -906,7 +909,7 @@ export async function patchRenderJs(root: string): Promise<void> {
906
909
  if (!src.includes(anchor)) {
907
910
  throw new Error(
908
911
  `could not patch Porffor for ${what}: anchor not found in ${file}. ` +
909
- "Porffor's native-fetch renderer changed — check patches/UPSTREAM.md.",
912
+ "Porffor's native-fetch renderer changed. See https://github.com/baronunread/sproutboat/tree/main/patches/upstream.",
910
913
  );
911
914
  }
912
915
  src = src.replace(anchor, inject);
package/src/pin.ts CHANGED
@@ -11,14 +11,14 @@
11
11
  * uWebSockets archive in `sproutboat-cli/vendor/` — then run both repos'
12
12
  * test + conformance suites. See sproutboat-cli/MIGRATION.md.
13
13
  */
14
- export const PORFFOR_CHANNEL = "alpha-7";
15
- export const PORFFOR_COMMIT_FULL = "8f01541498d6d61c0cbbf8a71be152330888be7e";
14
+ export const PORFFOR_CHANNEL = "alpha-9";
15
+ export const PORFFOR_COMMIT_FULL = "de4eb588264885b3a1596f75010e371a2052033f";
16
16
  export const PORFFOR_COMMIT = PORFFOR_COMMIT_FULL.slice(0, 7);
17
17
  export const PORFFOR_ARCHIVE_SHA256 =
18
- "fae9cfb00c0a21e20e3aa79a9a8093bd24820062039985c6bde2b23e3e8bdb8c";
18
+ "1a62187a93356b36cb6ac703ce9770c8917e4fa65545fd7c33ee8a180ae5a4c9";
19
19
  export const PORFFOR_ARCHIVE_URL = `https://codeload.github.com/CanadaHonk/porffor/tar.gz/${PORFFOR_COMMIT_FULL}`;
20
20
 
21
- /** A compact identity string for a manifest / report (`alpha-7 (8f01541)`). */
21
+ /** A compact identity string for a manifest / report (`alpha-9 (de4eb58)`). */
22
22
  export function porfforVersion(): string {
23
23
  return process.env.PORFFOR_VERSION || `${PORFFOR_CHANNEL} (${PORFFOR_COMMIT})`;
24
24
  }
Binary file
Binary file