sproutboat 0.11.13 → 0.12.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 CHANGED
@@ -10,6 +10,18 @@ maintained going forward by the `release` skill.
10
10
 
11
11
  ## Unreleased
12
12
 
13
+ ## [0.12.0] - 2026-09-28
14
+
15
+ ### Added
16
+ - Run three original Cloudflare Worker examples unchanged: JSON responses,
17
+ cookie parsing, and redirects. The example suite now checks 21 native apps.
18
+ - Pass `(request, env, ctx)` to fetch handlers using the 2026-09-28
19
+ compatibility date while preserving the earlier two-argument form for older apps.
20
+
21
+ ### Changed
22
+ - Update to Porffor alpha 10 via `@sproutboat/toolchain@^0.4.14` and use
23
+ `@sproutboat/runtime@^0.13.0` for native request decoding and redirects.
24
+
13
25
  ## [0.11.13] - 2026-09-26
14
26
 
15
27
  ### Added
@@ -627,7 +639,8 @@ its own package.
627
639
  - Renamed the package to `sproutboat` (was `@sproutboat/cli`); dropped the
628
640
  `sprout` bin alias in favour of a user-defined shell alias.
629
641
 
630
- [Unreleased]: https://github.com/baronunread/sproutboat-cli/compare/v0.11.13...HEAD
642
+ [Unreleased]: https://github.com/baronunread/sproutboat-cli/compare/v0.12.0...HEAD
643
+ [0.12.0]: https://github.com/baronunread/sproutboat-cli/compare/v0.11.13...v0.12.0
631
644
  [0.11.13]: https://github.com/baronunread/sproutboat-cli/compare/v0.11.12...v0.11.13
632
645
  [0.11.12]: https://github.com/baronunread/sproutboat-cli/compare/v0.11.11...v0.11.12
633
646
  [0.11.11]: https://github.com/baronunread/sproutboat-cli/compare/v0.11.10...v0.11.11
package/SURFACE.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > Generated by `src/surface.test.ts` from `src/surface.ts` + the pinned
4
4
  > toolchain constants. Do not edit by hand — run `UPDATE_SURFACE=1 bun test`.
5
5
 
6
- **Package:** `sproutboat` 0.11.13 · runs on Bun (use `bunx`, not `npx`)
6
+ **Package:** `sproutboat` 0.12.0 · runs on Bun (use `bunx`, not `npx`)
7
7
 
8
8
  ## Commands
9
9
 
@@ -76,7 +76,7 @@ usage: sproutboat <init [name] | check [project-dir] | types [project-dir] | dev
76
76
  | | |
77
77
  | --- | --- |
78
78
  | Zig | `0.16.0` (`zig cc -target x86_64-linux-musl`, static) |
79
- | Provenance stamp | `zig-musl/0.16.0+porffor/de4eb58+uws/360c276d` |
79
+ | Provenance stamp | `zig-musl/0.16.0+porffor/08ac7ee+uws/360c276d` |
80
80
  | Artifact schema | `2` |
81
81
  | Runtime | `native-fetch` |
82
82
  | Capability profile | `http-sync-v0` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutboat",
3
- "version": "0.11.13",
3
+ "version": "0.12.0",
4
4
  "description": "Wrangler-shaped CLI for Sproutboat. Deploys workers to any control plane via --api-url / SPROUTBOAT_API_URL.",
5
5
  "keywords": [
6
6
  "cli",
@@ -64,23 +64,24 @@
64
64
  "@sproutboat/artifact": "^0.3.0",
65
65
  "@sproutboat/assets": "^0.3.0",
66
66
  "@sproutboat/config": "^0.4.0",
67
- "@sproutboat/runtime": "^0.12.1",
68
- "@sproutboat/toolchain": "^0.4.13",
67
+ "@sproutboat/runtime": "^0.13.0",
68
+ "@sproutboat/toolchain": "^0.4.14",
69
69
  "@sproutboat/wire": "^0.9.1"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@oxlint/plugins": "1.81.0",
73
73
  "@types/bun": "1.4.0",
74
+ "cookie": "2.0.1",
74
75
  "lefthook": "2.1.12",
75
76
  "oxfmt": "0.66.0",
76
77
  "oxlint": "1.81.0",
77
78
  "typescript": "7.0.2"
78
79
  },
79
80
  "optionalDependencies": {
80
- "@sproutboat/cli-darwin-arm64": "0.11.13",
81
- "@sproutboat/cli-darwin-x64": "0.11.13",
82
- "@sproutboat/cli-linux-arm64": "0.11.13",
83
- "@sproutboat/cli-linux-x64": "0.11.13"
81
+ "@sproutboat/cli-darwin-arm64": "0.12.0",
82
+ "@sproutboat/cli-darwin-x64": "0.12.0",
83
+ "@sproutboat/cli-linux-arm64": "0.12.0",
84
+ "@sproutboat/cli-linux-x64": "0.12.0"
84
85
  },
85
86
  "engines": {
86
87
  "node": ">=18"
package/src/build.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
- import { cp, mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
2
+ import { cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { walkAssets, type AssetManifest } from "./assets";
5
5
  import { resourceRefs, type SproutboatConfig } from "./config";
@@ -82,7 +82,13 @@ async function integrationIdentity(): Promise<string> {
82
82
  const files = ["build.ts", "compile.ts", "sqlite.ts", "bearssl.ts", "toolchain.ts"].map((file) =>
83
83
  resolve(import.meta.dir, file),
84
84
  );
85
- files.push(Bun.resolveSync("@sproutboat/toolchain/patch", import.meta.dir));
85
+ // Hash the patch implementation and its local modules so a Unicode patch
86
+ // edit cannot reuse a binary compiled with earlier builtin semantics.
87
+ const patchDir = dirname(Bun.resolveSync("@sproutboat/toolchain/patch", import.meta.dir));
88
+ const toolchainFiles = (await readdir(patchDir))
89
+ .filter((file) => file.endsWith(".ts") && !file.endsWith(".test.ts"))
90
+ .sort();
91
+ files.push(...toolchainFiles.map((file) => resolve(patchDir, file)));
86
92
  return digest(Buffer.concat(await Promise.all(files.map((file) => readFile(file)))));
87
93
  }
88
94
 
package/src/bundle.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * #89 — bundle the handler before Porffor sees it.
3
3
  *
4
- * Porffor alpha 9 supports ESM imports. We still bundle first so capability
4
+ * Porffor supports ESM imports. We still bundle first so capability
5
5
  * validation sees every dependency and the runtime wrapper receives one
6
6
  * controlled default export.
7
7
  *
package/src/toolchain.ts CHANGED
@@ -38,7 +38,7 @@ const ZIG_SHA256 = {
38
38
  // frozen reference handlers and update its COMPAT.md for any new mismatch before
39
39
  // releasing — the alpha compiler's output can shift between pins. Checked by
40
40
  // hand at bump time, not in CI.
41
- // uWebSockets commit Porffor alpha-4 fetches for the native-fetch server.
41
+ // uWebSockets commit Porffor alpha-10 fetches for the native-fetch server.
42
42
  const UWS_COMMIT = "360c276d";
43
43
  const UWS_COMMIT_FULL = "360c276d609d59af56ae6932adb95154ace9f15f";
44
44
 
@@ -678,7 +678,7 @@ export function porfforVersion(): string {
678
678
 
679
679
  export function esbuildVersion(): string {
680
680
  // Legacy artifact field, retained so older control planes can read manifests.
681
- // Handler bundling uses Bun.build and Porffor alpha 9 needs no esbuild binary.
681
+ // Handler bundling uses Bun.build and Porffor alpha 10 needs no esbuild binary.
682
682
  return "unused";
683
683
  }
684
684
 
package/src/types-gen.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * `sproutboat types` — the project's `env`, as TypeScript.
3
3
  *
4
- * In Workers `env` is a parameter, so an editor can infer it from a signature.
5
- * Here it is a global, which means nothing is inferable at all: `env.SESSIONS`
6
- * is an undeclared identifier until this file exists. That makes generated
7
- * types worth more here than they are there, not less.
4
+ * `env` remains available as a global in both compatibility modes. This file
5
+ * gives it the project's binding names and types. From 2026-09-28 it is also
6
+ * the second handler argument.
8
7
  *
9
8
  * The output declares `env` from `sproutboat.jsonc` and references the ambient
10
9
  * types shipped in `types/sproutboat.d.ts`, so binding *shapes* version with
@@ -75,6 +74,11 @@ export function generateTypes(config: SproutboatConfig): string {
75
74
  .join("\n")
76
75
  : " // No bindings declared in sproutboat.jsonc yet.";
77
76
 
77
+ const handlerNote =
78
+ config.compatibility_date >= "2026-09-28"
79
+ ? "The same object is passed as the second handler argument: fetch(request, env, ctx)."
80
+ : "The handler signature is fetch(request, ctx); env is only a global.";
81
+
78
82
  return `${HEADER}
79
83
  /// <reference types="sproutboat/types" />
80
84
 
@@ -82,7 +86,7 @@ declare global {
82
86
  /**
83
87
  * Bindings from sproutboat.jsonc, for project "${config.name}".
84
88
  *
85
- * A global, not a parameter: the handler signature is \`fetch(request)\`.
89
+ * ${handlerNote}
86
90
  * Every call on these is synchronous, so \`await\` is allowed and does
87
91
  * nothing.
88
92
  */
@@ -6,9 +6,9 @@
6
6
  * generates a project's `sproutboat-env.d.ts`, which references this file and
7
7
  * declares `env` with that project's bindings.
8
8
  *
9
- * Two things differ from Cloudflare Workers and are the reason these exist:
10
- * `env` is a global rather than a parameter, so nothing is inferable from a
11
- * signature, and every binding call is synchronous.
9
+ * Bindings are synchronous. Before compatibility date 2026-09-28, `env` is a
10
+ * global only and `ctx` is the second handler argument. From that date, `env`
11
+ * is also passed as the second argument and `ctx` as the third.
12
12
  */
13
13
 
14
14
  declare global {
@@ -300,11 +300,7 @@ declare global {
300
300
  scheduledTime: number;
301
301
  }
302
302
 
303
- /**
304
- * `env` is a global, not a parameter. `ctx` is the second argument, and its
305
- * only member is `waitUntil`: work that outlives the response, drained
306
- * in-process and capped at 25s.
307
- */
303
+ /** Work that outlives the response, drained in-process and capped at 25s. */
308
304
  interface ExecutionContext {
309
305
  waitUntil(promise: Promise<unknown>): void;
310
306
  }
@@ -318,6 +314,13 @@ declare global {
318
314
  queue?(batch: MessageBatch<QueueBody>, ctx: ExecutionContext): void | Promise<void>;
319
315
  }
320
316
 
317
+ /** Handler signature for compatibility dates from 2026-09-28. */
318
+ interface WorkersHandler<Bindings = Record<string, unknown>, QueueBody = unknown> {
319
+ fetch(request: Request, env: Bindings, ctx: ExecutionContext): Response | Promise<Response>;
320
+ scheduled?(event: ScheduledEvent, env: Bindings, ctx: ExecutionContext): void | Promise<void>;
321
+ queue?(batch: MessageBatch<QueueBody>, env: Bindings, ctx: ExecutionContext): void | Promise<void>;
322
+ }
323
+
321
324
  /**
322
325
  * What a Durable Object class implements. Declare it above the default
323
326
  * export and name it in `durable_objects`.