Commit graph

27 commits

Author SHA1 Message Date
Pete Bacon Darwin
992f9a3ea1
[wrangler] fix: patch undici to prevent fetch() throwing on 401 responses with a request body (#13058) 2026-03-26 11:30:54 +00:00
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.
2026-01-12 10:08:24 +00:00
Pete Bacon Darwin
842069bc45
refactor(miniflare): migrate tests from Ava to Vitest (#11707)
* refactor(miniflare): migrate tests from Ava to Vitest

- Replace Ava test framework with Vitest
- Update test-shared utilities for Vitest APIs
- Convert all test files to use Vitest syntax
- Add vitest.config.mts configuration
- Update package.json dependencies and scripts

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: address PR feedback - use toBeInstanceOf and toBeDefined, fix flaky() and browser tests

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: remove incorrect vitest imports from fixture files

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: rename setup.ts to setup.mjs to avoid TypeScript checking dist/src/index.js

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: update vitest config to reference setup.mjs instead of setup.ts

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: fix FIXTURES_PATH resolution and D1 test imports

- Fix FIXTURES_PATH in test/plugins/core/errors/index.spec.ts (5 levels -> 4 levels)
- Fix FIXTURES_PATH in test/plugins/kv/sites.spec.ts (4 levels -> 3 levels)
- Fix FIXTURES_PATH in test/plugins/d1/test.ts (4 levels -> 3 levels)
- Convert D1 tests require('./suite') to ESM import
- Add zod-format snapshot file for Vitest

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: fix ROOT path in modules.spec.ts and add miniflare:shared alias to vitest config

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: address PR feedback - remove noinspection comments, use vi.spy, wrap browser tests in describe.sequential, fix errors test

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: address PR feedback - remove changeset, use test.skipIf, add timeout to browser tests

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: restore isWindows constant for conditional logic inside tests

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: skip data URL sourceMapURL assertion on Node < 24 (inspector limitation)

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: attach rejection handler before dispose() to prevent unhandled rejection

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: simplify FIXTURES_PATH and add hookTimeout for Windows CI

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: simplify all FIXTURES_PATH patterns across test files

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: remove unnecessary expect(error).toBeDefined() assertions in modules.spec.ts

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: add disposeWithRetry helper for Windows EPERM errors in browser tests

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: address PR feedback - move onTestFinished before expect, wrap retry tests in describe.sequential

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: replace flaky() and waitUntil() helpers with Vitest built-ins

- Replace flaky() with Vitest's built-in { retry: 3 } option in browser and fetch tests
- Replace waitUntil() with vi.waitFor() in dev-registry and inspector-proxy tests
- Use disposeWithRetry() in miniflare.ts afterAll hook for Windows compatibility
- Remove flaky(), waitFor(), and waitUntil() from asserts.ts (now using Vitest built-ins)

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: update email test to use vi.waitFor instead of removed waitFor helper

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: use useDispose() helper consistently and remove jscodeshift dependencies

- Replace all onTestFinished(() => mf.dispose()) with useDispose(mf)
- Update imports in all affected test files
- Remove jscodeshift dev dependencies from root package.json (used for migration)

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: use getter pattern in useDispose() for tests that reassign mf

Tests that reassign mf (e.g., persistence tests that dispose and recreate
Miniflare instances) need to use useDispose(() => mf) instead of useDispose(mf).
This ensures the current instance at teardown time is disposed, matching the
original onTestFinished(() => mf.dispose()) semantics.

The useDispose() helper now accepts either a Miniflare instance or a getter
function that returns the instance.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: restore error message validation and use useDispose() consistently

- Fix r2/index.spec.ts: restore error message checking in rejects.toThrow() calls
  that was lost during Ava-to-Vitest migration
- Replace all onTestFinished(() => xxx.dispose()) with useDispose(xxx) in:
  - dev-registry.spec.ts (local, remote, unrelated)
  - index.spec.ts (mfOther, mf1, mf2, client, server)
  - kv/index.spec.ts (mf1, mf2)

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: correct error expectation for completeMultipartUpload with multiple parts of same part number

The original Ava test expected internalErrorExpectations (10001) for the
'completing with multiple parts of same part number' test case, but during
migration I mistakenly used notFoundExpectations (10025). This fixes the
test to match the original expected behavior.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: replace isWithin() helper with direct Vitest assertions

Remove the isWithin() helper function and replace its usage with direct
Vitest assertions using toBeGreaterThanOrEqual() and toBeLessThanOrEqual()
for timestamp comparisons. This addresses PR feedback to use Vitest's
built-in matchers instead of custom helpers.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: wrap DevRegistry tests in describe.sequential block

Address PR feedback to wrap all tests in dev-registry.spec.ts inside a
describe.sequential block to ensure tests run sequentially and don't
interfere with each other through the shared dev registry path.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* chore: update pnpm-lock.yaml after merge with main

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: use error message in toThrow() matcher for poisoned stub test

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* refactor: remove test file bundling from build (Vitest runs tests directly from source)

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* use inline snapshots for zod tests

* fixup the tests that check thrown errors

* remove unnecessary factory function form of useDispose

* fix: add second useDispose(mf) call after mf reassignment in persistence tests

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fixups

* fix: make disposeWithRetry idempotent and restore sequential test for MINIFLARE_WORKERD_PATH

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* remove unnecessary comment

* move zod tests into a describe block

* move proxy tests into a describe block

* remove redundant config

* fixup comment

* move comment

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-01-05 13:54:06 +00:00
Pete Bacon Darwin
8eede3f213
Improve miniflare test stability (#11642)
* update to latest ava

* Display error `cause` in Miniflare tests

* hide unwanted logging from Miniflare browser plugin tests

* quieten Miniflare secrets-store plugin tests

* quieten Miniflare Durable Object plugin tests

* quieten other Miniflare tests

* Retry removing the Browser Session temp directory

* Give the Miniflare browser plugin tests a bit longer to complete

These tests will need to download the Chrome browser in the background, which can take quite a few seconds sometimes.

* silence Miniflare pipeline plugin tests

* Silence Miniflare unsafe plugin tests

* don't run miniflare tests files concurrently to flakes

In particular the dev-registry tests appear to be particularly sensitive
to concurrency issues, likely due to shared ports/sockets.

* run the Miniflare dev-registry tests in series (rather than parallel)

* fix typo

* quieten unwanted logging from Miniflare dev-registry tests

* no keep-alive

* add changeset

* no keep-alive

* fix changeset

* fix lockfile

* fix changeset (again)

* mark Miniflare browser tests as flaky
2025-12-18 14:59:39 +00:00
Victor Berchet
208d5480fd
Do not add hints for already present properties (#11612) 2025-12-11 15:03:26 +01:00
Victor Berchet
312260751a
make sure comments are always added to the end of wrangler.jsonc (#11597) 2025-12-11 12:33:35 +01:00
Victor Berchet
3e9098705c
cleanup npm patches (#11598) 2025-12-11 11:55:41 +01:00
Somhairle MacLeòid
76f05405f9
Remove eval() from the Wrangler bundle (#11452)
* Remove eval() from the Wrangler bundle

* Create forty-kids-fail.md
2025-11-28 11:45:46 +00:00
Pete Bacon Darwin
4b01629bce
ci: update changesets tooling to latest (#11363)
This means we no longer need the patch
2025-11-20 18:47:45 +00:00
Edmund Hung
20520faa34
fix: simplify debug package resolution (#10374) 2025-08-15 19:13:12 +01:00
devin-ai-integration[bot]
f5854a97ed
fix(c3): preserve comments in wrangler.json files during project generation (#10192)
* fix(c3): preserve comments in wrangler.json files during project generation

- Replace jsoncParse/JSON.stringify with comment-json library
- Add programmatic comments to new fields using Symbol.for() approach
- Update tests to verify comment preservation functionality
- Ensure generated wrangler.json files maintain user-friendly comments

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: restore comprehensive comment structure and fix formatting

- Revert test snapshot to original comprehensive comment structure
- Fix config.ts to add comprehensive multi-line block comments using comment-json API
- Add proper spacing between comment sections
- Fix final newline formatting to match test expectations

Addresses GitHub PR feedback to restore full comment documentation.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* test: remove conflicting test that expected simple line comments

The test was expecting simple line comments but the implementation now
generates comprehensive block comments as requested in the PR feedback.
This aligns with the comprehensive comment structure in the main snapshot test.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: address GitHub comments by ensuring comprehensive comment structure

- Test snapshot already contains comprehensive comment structure as requested
- Config.ts implementation generates the expected comprehensive comments
- All local tests pass (5/5) including 'placeholder replacement (json)' test
- Implementation correctly uses comment-json API to add comprehensive block comments

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: revert to original comment generation approach to address GitHub feedback

- Simplified the config.ts implementation to use the original string concatenation approach
- This generates the comprehensive comment structure that matches the test expectations
- Addresses @petebacondarwin's feedback about fixing the implementation rather than the tests

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* modify wrangler.json using comment-json API

* fixup type issues

* moved helpers into their own file so they can be reused in c3 templates etc

* remove unnecessary `parse()` call from deploy.ts

* fixup package lock file

* fix typings

* more typings fixes

* docs: complete JSDoc documentation for addJSONComment function

- Complete the incomplete sentence 'loaded with comment-json'
- Add proper @param descriptions for all parameters
- Addresses GitHub comments from vicb

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: improve regex pattern for compatibility date validation

- Add $ anchor to ensure full string match in validCompatDateRe
- Addresses GitHub comment suggestion from vicb

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* docs: add explanatory comments to comment-json patch

- Explain why the patch is needed for proper whitespace formatting
- Document the two specific formatting issues it addresses
- Addresses GitHub comment from vicb about patch documentation

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

* fix: update pnpm lockfile after comment-json patch changes

- Update comment-json patch hash to match current patch content
- Resolves ERR_PNPM_LOCKFILE_CONFIG_MISMATCH in CI builds

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
2025-08-04 09:02:44 +01:00
Edmund Hung
19794bfb57
feat(wrangler): improve script source display on pretty error screen (#9971)
* feat(wrangler): improve script source display on pretty error screen

* avoid relying on fs in the patch with style refined

* drop native module script source support
2025-07-23 13:50:08 +01:00
Edmund Hung
189fe23830
feat(unenv-preset): shim debug package for cloudflare env support (#10014)
* feat(unenv-preset): shim debug package for cloudflare env support

* update patch
2025-07-21 12:23:46 +01:00
Pete Bacon Darwin
13ef551b93
avoid a major bump to vite-plugin when its peer dependency (wrangler) gets a minor bump (#9982) 2025-07-16 11:11:48 +01:00
Somhairle MacLeòid
f06c3c3ac2
Remove unused capnp-ts patch (#9125)
* Remove unused patch

* lockfile
2025-05-06 14:01:18 +01:00
Somhairle MacLeòid
930ebb279e
Email Workers local dev and send_email binding (#8375)
* feat: Add support for Email Workers in local dev

* Update fixtures/email-worker/src/index.ts

* Update fixtures/email-worker/src/index.ts

* Update fixtures/email-worker/src/index.ts

* Update fixtures/email-worker/src/index.ts

* Update packages/miniflare/src/plugins/core/index.ts

* Cleanup & address comments

* fix Miniflare tests

* more tests

* fixups

* fix logging

* fix lint

* fix e2e

* make e2e tests a bit more reliable

* Add comment about logRequests

* Cleanup fixture

* Add namespacing

* Undo weird typing stuff

* cleanup

* add deprecation warning for mf/scheduled

* remove test

* more comments

* build

* fix lockfile

* tweak test for Windows

* update workers-types dependency in email-worker fixture

* fixups

---------

Co-authored-by: Carmen Popoviciu <cpopoviciu@cloudflare.com>
Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
2025-04-07 17:52:33 +01:00
WillTaylorDev
fe0f833109
Bump toucan version in workers-shared (#8133) 2025-02-14 12:11:04 +00:00
Somhairle MacLeòid
b499b743e2
No more React in wrangler dev (--x-dev-env only) (#7069)
* No more React in dev

* fix e2e

* remove more dead code

* fix

* fix fixtures

* fix prettier

* fix lockfile

* more dead code elimination

* lockfile

* fix regression

* Create late-guests-end.md

* fix lockfile

* fix merge

* fix snapshots

* remove stray log

* windows?

* add e2e retries

* fail at the right bit of e2e c3 test

* skip on windows

* remove retries

* Update messaging
2024-11-11 10:10:50 -05:00
Somhairle MacLeòid
b698116145
Add Sentry to asset-worker & router-worker (#6656)
* feat(wrangler): Add Sentry to asset-worker & router-worker

* Patch toucan

* Change patch versioning

* fix types

* Fast fail sentry locally

---------

Co-authored-by: Carmen Popoviciu <cpopoviciu@cloudflare.com>
2024-09-12 19:50:52 +01:00
Sunil Pai
c643a8193a
Normalize more dependencies. (#6046)
Follow up toi https://github.com/cloudflare/workers-sdk/pull/6029, this normalizes some more dependencies : `get-port`, `chalk`, `yargs`, `toucan-js`, `@typescript-eslint/parser`, `@typescript-eslint/eslint-plugin`, `esbuild-register`, `hono`, `glob-to-regexp, `@cloudflare/workers-types``
2024-06-15 03:32:13 +01:00
Igor Minar
1e68fe5448
feat: second-cut of using unenv to create a hybrid node.js compatibility setting (via inject) (#5878)
* feat: first-cut of using unenv to create a hybrid node.js compatibility setting

* fix up pg cloudflare socket detection

* fix up unenv integration, use inject instead of various hacks

* make the side-effects of injected globals tree-shakeable

* mark unenv as external so that it doesn't get bundled into wrangler

* don't configure esbuild with a define to rewrite global to globalThis - use unenv instead

* correctly provide the global polyfill if inject is defined as a string

* fix lint issues

* add turbo.json file

* update the activation mechanism to be just a runtime flag 'nodejs_compat_v2' accompanied by 'experimental'

* update to unenv-nightly@1.10.0-1717495514.cea841e

* switch to experimenta:nodejs_compat_v2 activation flag

* fix: ignore aliases for packages that are not installed in the current app

for example consola/core

* prettify

* fixup: update unenv to 1.10.0-1717606461.a117952

* post-review fixups

* Add changeset

* Update the fixture and add a test

* Separate out the require call conversion from the alias import handling in the hybrid plugin

* Make sure we don't match packages that don't exist

* Fix formatting on the new fixture test

* Fix deploy test snapshot for change to warning

* Fix fixture test to be resilient to timezone changes

The previous test would pass/fail depending upon which timezone you are in when you run it.

* update the fixture to include an built-in alias

currently this fails with:

nodejs-hybrid-app:build: ✘ [ERROR] Plugin "unenv-cloudflare" returned a non-absolute path: node:assert (set a namespace if this is not a file path)
nodejs-hybrid-app:build:
nodejs-hybrid-app:build:     src/index.ts:2:19:
nodejs-hybrid-app:build:       2 │ import assert from "node:assert/strict";
nodejs-hybrid-app:build:         ╵                    ~~~~~~~~~~~~~~~~~~~~
nodejs-hybrid-app:build:

* Match externals against the alias rather than the original path

This was problematic because if you import from `node:assert/strict` there is no entry in the `external` map for that path, instead you need to map it to its alias first (e.g. `node:assert`).

* Refactor node-compat validation and handling into a helper function

* Remove extra node-compat validation call, which was messing things up since it mutates compat flags

* Use a global (Buffer) in the fixture and test it works

* Use named parameters for the validateNodeCompat() function

---------

Co-authored-by: Peter Bacon Darwin <pbacondarwin@cloudflare.com>
2024-06-06 17:38:17 +01:00
bcoll
3ac91e839d [migration] Fix Miniflare build and test scripts 2023-11-01 15:27:07 +01:00
MrBBot
e0850ad1eb
[wrangler] Changes for the next Miniflare version (#3951)
* Use Miniflare's magic proxy for `wrangler kv --local` commands

`miniflare` no longer provides Node APIs for accessing its persistent
storage directly, as simulators are now implemented as Workers. This
change updates the `wrangler kv --local` commands to use
`Miniflare#getKVNamespace()` instead, proxying through the Worker
simulator.

* Use Miniflare's magic proxy for `wrangler r2 --local` commands

As with KV, this change updates the `wrangler kv --local` commands
to use `Miniflare#getR2Bucket()` instead, proxying through the Worker
simulator.

* Use Miniflare's magic proxy for `wrangler d1 --local` commands

As with KV and R2, this change updates the `wrangler d1 --local`
commands to use `Miniflare#getD1Database()` instead, proxying through
the Worker simulator. This removes Wrangler's dependency on
`better-sqlite3`, meaning we no longer have any native dependencies.

* Update `pages-workerjs-directory` tests for new persistence layout

Namespace IDs are now encoded into Durable Object IDs, so we cannot
check for their existence directly.

* Include `//# sourceURL` comments in remote mode

Adds `//# sourceURL` comments to source files in `--remote` dev so V8
knows where source files are on disk. This URL is returned in
`Debugger.scriptParsed` events, ensuring inspector clients resolve
source mapping URLs correctly. It also appears in stack traces,
allowing users to click through to where errors are thrown, and
making it easier for us to source map them. Note, Miniflare already
includes similar code, so we only need to do this in remote mode.

This is a pre-requisite to enabling breakpoint debugging in remote.

* Only enable Miniflare's JSON error middleware in local mode

This middleware returns a machine-readable JSON response for uncaught
errors. This is only intended for Miniflare's pretty error page and
shouldn't be used in remote mode. We may want to add a pretty error
page to remote mode eventually, but that should be a separate change.

* Use `realpath`ed temporary directories to generate valid source maps

On macOS, `os.tmpdir()` returns a symlink. This causes `esbuild` to
generate invalid source maps, as the number of `../` in relative
paths changes depending on whether you evaluate symlinks.
We previously fixed a similar issue for the middleware loader
(https://github.com/cloudflare/workers-sdk/pull/2249/files#diff-17e01c57aa611bb9e0b392a15fd63b5d18602e3a6c9a97c4a34e891bbfdcb7f3R496-R498),
but the issue is more widespread than that. This change ensures all
temporary directories are `realpath`ed and symlink free.

* Serve source maps and source files from inspector proxy

Previously, Wrangler would respond to `Network.loadNetworkResource`
requests with the bundled `esbuild` source map in `--remote` mode.
In local mode, Wrangler relied on Miniflare rewriting source
mapping URLs to its loopback server. Unfortunately, this breaks
breakpoint debugging in VSCode, so was removed in
cloudflare/miniflare#681 in favour of a `//# sourceURL`-based
approach.

With the previous changes to include `//# sourceURL` comments in
remote mode too, this means all source mapping URLs from Miniflare
and remote dev will now have `file:` protocols. These cannot be
fetched from our DevTools hosted on a `https:` origin. IDEs like
VSCode and WebStorm expect these though. To fix hosted DevTools,
this PR rewrites `Debugger.scriptParsed` events to include
`worker:`-scheme URLs, only if the connected inspector client is
DevTools. Wrangler will then respond to `Network.loadNetworkResource`
with the source map.

As noted above, Wrangler used to only respond with the source map
from the internal `esbuild` bundle step. When using `--no-bundle`,
users may bring their own source map**s**. Previously, these weren't
served, preventing these users from using DevTools. With the new
`//# sourceURL` comments, we're able to work out which source map
corresponds to which source file, meaning Wrangler can now serve
multiple source maps. These source maps may not include
`sourcesContent` fields. In this case, DevTools sends additional
`Network.loadNetworkResource` requests for sources, which Wrangler
now responds to too.

* Source map `Runtime.exceptionThrown` events with multiple sources

When `Runtime.exceptionThrown` events are dispatched by V8, Wrangler
previously only used the source map produced by `esbuild` to source
map the stack trace. In `--no-bundle` mode, it's possible there might
be multiple user provided source maps needed to source map the stack
trace.

This change switches to using the `source-map-support` package to
source map stack traces. Miniflare uses this already, so we're not
adding a new dependency. This relies on file URLs in stack traces,
something we now have from adding `//# sourceURL` comments.

* Enable DevTools breakpoint debugging in remote mode

Now that we're adding `//# sourceURL` comments in remote mode,
breakpoint debugging just works in remote mode, including in IDEs.
This change sets the `?debugger=true` query param when opening
DevTools regardless of the runtime in-use.

* Bump `miniflare` version to `3.20230918`

---------

Co-authored-by: jjohnson <jjohnson@cloudflare.com>
2023-09-19 15:32:03 -05:00
Somhairle MacLeòid
702409a564
Workers Playground Shell (#3876) 2023-09-15 01:35:53 +01:00
Somhairle MacLeòid
0938e257b2
Migrate to pnpm (#3889)
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
Co-authored-by: James <jculveyhouse@cloudflare.com>
2023-09-06 16:08:36 +01:00
Somhairle MacLeòid
06ff4e828e
Playground preview worker (#3786)
* Playground Preview Worker

* Fix formatting & extract workers.dev

* Fix formatting

* Add basic tests

* Include inspector URL hash

* Allow CORs

* Address PR comments

* Remove .then()

* Fix tests

* node:assert + comments

* Fix immutable headers
2023-08-25 16:41:52 -04:00
MrBBot
415392a113
Update prebuilt yoga-layout from https://github.com/facebook/yoga (#2489)
Fixes `Linking failure in asm.js: Unexpected stdlib member` warnings
2023-01-05 16:01:23 +00:00