mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-26 06:34:20 +08:00
AsyncLocalStorage changes, matching Node 24.22: - setTimeout, setInterval, setImmediate, process.nextTick and queueMicrotask callbacks run with the stores that were active when they were scheduled. Before, getStore() returned undefined in them. - An interval keeps that context on every tick, and a refreshed timer keeps it too. - enterWith inside one of these callbacks lasts until the callback returns. An enterWith in top-level code ends when the main module's body returns, and one inside a callback scheduled with no store active ends when that callback returns, so the store does not reach callbacks that were scheduled without it. Programs that enter stores (store.run, exit, enterWith, or a diagnostics_channel store binding) schedule through new *_als runtime entry points, which wrap a callback scheduled with a store active in a closure that installs the stores around the call. The emitter picks them from the new asyncContext runtime feature; other programs keep the plain entry points, so their scheduling is unchanged. The limitations page notes that completion callbacks of callback-style I/O APIs still run with no store. 5815-als-callback-context compares the stores each kind of callback sees with Node, plain and with SCRIPTC_SAN=1.