workers-sdk
workers-sdk copied to clipboard
First steps to running wrangler's dev function via API without react
Prior to this change, wrangler.unstable_dev()
would only support running one instance of wrangler at a time, as Ink only lets you render one instance of React. This resulted in test failures in CI.
This change creates pure JS/TS versions of these React hooks:
- useEsbuild
- useLocalWorker
- useCustomBuild
- useTmpDir
As a side-effect of removing React, tests should run faster in CI.
What I don't know:
- If this breaks pages' usage of dev CC: @GregBrimble
- If esbuild's
watch
function works as expected
What we're not supporting (in this PR, anyway):
- multi-worker support (you should be able to test multiple workers at the same time, but they won't know about each other)
Closes #1432 Closes #1419
🦋 Changeset detected
Latest commit: 1cf79838dfc76b4c39d55719bee983d58ec283d4
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Name | Type |
---|---|
wrangler | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
A wrangler prerelease is available for testing. You can install this latest build in your project with:
npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2980556025/npm-package-wrangler-1538
You can reference the automatically updated head of this PR with:
npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1538/npm-package-wrangler-1538
Or you can use npx
with this latest build directly:
npx https://prerelease-registry.developers.workers.dev/runs/2980556025/npm-package-wrangler-1538 dev path/to/script.js
Codecov Report
Merging #1538 (1cf7983) into main (23f8921) will decrease coverage by
6.05%
. The diff coverage is67.56%
.
@@ Coverage Diff @@
## main #1538 +/- ##
==========================================
- Coverage 80.18% 74.13% -6.06%
==========================================
Files 92 97 +5
Lines 6224 7070 +846
Branches 1603 1850 +247
==========================================
+ Hits 4991 5241 +250
- Misses 1233 1829 +596
Impacted Files | Coverage Δ | |
---|---|---|
packages/wrangler/src/bundle.ts | 71.42% <ø> (+1.78%) |
:arrow_up: |
packages/wrangler/src/metrics/send-event.ts | 100.00% <ø> (ø) |
|
packages/wrangler/src/pages/dev.tsx | 22.90% <ø> (ø) |
|
packages/wrangler/src/dev/local.tsx | 29.51% <50.00%> (ø) |
|
packages/wrangler/src/api/dev.ts | 57.69% <52.38%> (+42.30%) |
:arrow_up: |
packages/wrangler/src/dev/start-server.ts | 69.49% <69.49%> (ø) |
|
packages/wrangler/src/dev.tsx | 84.65% <97.82%> (+3.36%) |
:arrow_up: |
packages/wrangler/src/pages/constants.ts | 100.00% <0.00%> (ø) |
|
...ngler/src/pages/functions/routes-transformation.ts | 80.39% <0.00%> (ø) |
|
packages/wrangler/src/dev-registry.tsx | 14.28% <0.00%> (ø) |
|
... and 6 more |