sproutboat 0.43.0 → 0.44.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,29 @@ maintained going forward by the `release` skill.
10
10
 
11
11
  ## Unreleased
12
12
 
13
+ ## [0.44.0] - 2026-10-29
14
+
15
+ Built on `@sproutboat/runtime` 0.36.0, `@sproutboat/toolchain` 0.21.0 and
16
+ `@sproutboat/wire` 0.20.4.
17
+
18
+ ### Added
19
+
20
+ - **`AsyncLocalStorage`** from `node:async_hooks`, as Workers has it: `run`, `exit`, `getStore` and the static
21
+ `snapshot`. `enterWith` and `disable` throw, as there. The store follows a request across awaits,
22
+ microtasks, timers, intervals, async `fetch`, WebSocket callbacks and `ctx.waitUntil`, and requests
23
+ interleaved in one process never see each other's. The static `bind` is not provided: Porffor compiles a
24
+ `.bind(` call on a function value to `Function.prototype.bind`, so use `snapshot()`. The import used to
25
+ build and then throw "not a constructor" when the app ran, so there is no compatibility date for it. Cost: a
26
+ promise reaction is 56 bytes instead of 40.
27
+
28
+ ### Changed
29
+
30
+ - **`x-sb-cpu-ms` is per request when requests interleave in one process.** A request is charged the thread
31
+ CPU time of the slices in which it ran, not the process delta across its handler, so a request is no longer
32
+ charged for its neighbours' work. From compatibility date `2026-11-02` an async handler is stamped too
33
+ (logs show it as `cpuMs`); earlier dates still send no stamp for an async handler. A synchronous
34
+ handler's stamp is thread time, which leaves out the egress threads.
35
+
13
36
  ## [0.43.0] - 2026-10-29
14
37
 
15
38
  Built on `@sproutboat/runtime` 0.35.0, `@sproutboat/toolchain` 0.20.1 and
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.43.0
6
+ **Package:** `sproutboat` 0.44.0
7
7
 
8
8
  ## Commands
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutboat",
3
- "version": "0.43.0",
3
+ "version": "0.44.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,9 +64,9 @@
64
64
  "@sproutboat/artifact": "^0.3.0",
65
65
  "@sproutboat/assets": "^0.3.0",
66
66
  "@sproutboat/config": "^0.6.0",
67
- "@sproutboat/runtime": "^0.35.0",
68
- "@sproutboat/toolchain": "^0.20.1",
69
- "@sproutboat/wire": "^0.20.3"
67
+ "@sproutboat/runtime": "^0.36.0",
68
+ "@sproutboat/toolchain": "^0.21.0",
69
+ "@sproutboat/wire": "^0.20.4"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@oxlint/plugins": "1.85.0",
@@ -78,10 +78,10 @@
78
78
  "typescript": "7.0.2"
79
79
  },
80
80
  "optionalDependencies": {
81
- "@sproutboat/cli-darwin-arm64": "0.43.0",
82
- "@sproutboat/cli-darwin-x64": "0.43.0",
83
- "@sproutboat/cli-linux-arm64": "0.43.0",
84
- "@sproutboat/cli-linux-x64": "0.43.0"
81
+ "@sproutboat/cli-darwin-arm64": "0.44.0",
82
+ "@sproutboat/cli-darwin-x64": "0.44.0",
83
+ "@sproutboat/cli-linux-arm64": "0.44.0",
84
+ "@sproutboat/cli-linux-x64": "0.44.0"
85
85
  },
86
86
  "engines": {
87
87
  "node": ">=18"
package/src/node-shims.ts CHANGED
@@ -371,7 +371,17 @@ export { NodeURL as URL, NodeURLSearchParams as URLSearchParams, urlFormat as fo
371
371
  export default { URL: NodeURL, URLSearchParams: NodeURLSearchParams, format: urlFormat, parse: urlParse, resolve: urlResolve };
372
372
  `;
373
373
 
374
+ // AsyncLocalStorage comes from the runtime (sproutboat-packages: the prelude defines it on globalThis,
375
+ // over an async context kept by the patched Porffor). Bun's own node:async_hooks polyfill builds but
376
+ // its AsyncLocalStorage is not a constructor in a compiled handler. Aliased, like the node:url shim.
377
+ const NODE_ASYNC_HOOKS_SHIM = `
378
+ const SbAsyncLocalStorage = globalThis.AsyncLocalStorage;
379
+ export { SbAsyncLocalStorage as AsyncLocalStorage };
380
+ export default { AsyncLocalStorage: SbAsyncLocalStorage };
381
+ `;
382
+
374
383
  export const NODE_SHIMS = {
384
+ "node:async_hooks": NODE_ASYNC_HOOKS_SHIM,
375
385
  "node:path": NODE_PATH_SHIM,
376
386
  "node:querystring": NODE_QUERYSTRING_SHIM,
377
387
  "node:url": NODE_URL_SHIM,