workers-sdk/patches
Pete Bacon Darwin 2203af4433
Add Node.js 24 and 25 compatibility to the test suites for Miniflare, Wrangler, and vitest-pool-workers packages (#11858)
* test: fix Node 24/25 miniflare tests

Vite strips `//# sourceMappingURL=` comments from string literals during transformation,
which was causing the inline source map test to fail. This fix moves the worker script
with the inline source map to an external fixture file that is loaded at runtime,
bypassing Vite's transformation and allowing the test to work correctly on all Node.js versions.

* test: fix Node 25 wrangler tests by mocking undici globals

Extend the undici mock in vitest.setup.ts to also replace FormData,
Headers, Request, and Response with their global equivalents. This
allows MSW to properly intercept and parse requests in Node 25 where
native fetch/FormData classes differ from undici's implementations.

Also update FormData snapshot assertions in pages/deploy.test.ts to use
a new formDataToObject() helper that produces consistent output across
Node versions, since the internal representation of FormData varies.

* fix: patch buffer-equal-constant-time for Node 25 compatibility

Node 25 removed SlowBuffer from the buffer module (it was deprecated
in Node 24). The buffer-equal-constant-time package (last updated in
2013) accesses SlowBuffer.prototype without checking if it exists,
causing a crash.

This patch adds guards to check if SlowBuffer is defined before
accessing its prototype. The fix is backwards compatible with older
Node versions.

This is a transitive dependency through:
verdaccio -> @verdaccio/signature -> jsonwebtoken -> jws -> jwa -> buffer-equal-constant-time

* test: disable native webstorage for wrangler tests on Node 25+

Node 25 has native localStorage enabled by default, which conflicts with MSW.
Use a helper script to conditionally add --no-experimental-webstorage flag
to NODE_OPTIONS only on Node 25+, since this flag doesn't exist in Node 20-24.
History 2026-01-12 10:08:24 +00:00
..
@cloudflare__component-listbox@1.10.6.patch [wrangler] Changes for the next Miniflare version (#3951) 2023-09-19 15:32:03 -05:00
@netlify__build-info.patch Remove eval() from the Wrangler bundle (#11452) 2025-11-28 11:45:46 +00:00
buffer-equal-constant-time@1.0.1.patch Add Node.js 24 and 25 compatibility to the test suites for Miniflare, Wrangler, and vitest-pool-workers packages (#11858) 2026-01-12 10:08:24 +00:00
postal-mime.patch Email Workers local dev and send_email binding (#8375) 2025-04-07 17:52:33 +01:00
toucan-js@4.0.0.patch Bump toucan version in workers-shared (#8133) 2025-02-14 12:11:04 +00:00
youch@4.1.0-beta.10.patch feat(wrangler): improve script source display on pretty error screen (#9971) 2025-07-23 13:50:08 +01:00