Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for named entrypoints #5215

Merged
merged 20 commits into from Apr 3, 2024
Merged

Add support for named entrypoints #5215

merged 20 commits into from Apr 3, 2024

Conversation

GregBrimble
Copy link
Member

@GregBrimble GregBrimble commented Mar 9, 2024

LDW exemption: CR-849919

What this PR solves / how to test


(updated by @mrbbot)

This PR adds support for named entrypoints to wrangler deploy and wrangler (pages) dev. This also enables support for JS RPC over multiple wrangler dev sessions.

Service bindings to other wrangler dev sessions are now implemented with workerd-native external service bindings instead of middleware. This is required to use Cap'n Proto over HTTP for JSRPC. This middleware was the last middleware that wrapped the env object. Code for wrapping env has been removed from the middleware loader. Implementing this for WorkerEntrypoints would've required us to look for named exports and apply env wrapping to all of these.


Author has addressed the following

Copy link

changeset-bot bot commented Mar 9, 2024

🦋 Changeset detected

Latest commit: d342bd6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
wrangler Minor
miniflare Minor
@cloudflare/vitest-pool-workers Patch
@cloudflare/pages-shared 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

Copy link
Contributor

github-actions bot commented Mar 9, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8545615151/npm-package-wrangler-5215

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5215/npm-package-wrangler-5215

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8545615151/npm-package-wrangler-5215 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8545615151/npm-package-create-cloudflare-5215 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8545615151/npm-package-cloudflare-kv-asset-handler-5215
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8545615151/npm-package-miniflare-5215
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8545615151/npm-package-cloudflare-pages-shared-5215
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8545615151/npm-package-cloudflare-vitest-pool-workers-5215

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.45.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240329.1
workerd 1.20240329.0 1.20240329.0
workerd --version 1.20240329.0 2024-03-29

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@GregBrimble GregBrimble force-pushed the entrypoints branch 2 times, most recently from 4961cfc to 6a5ec8e Compare March 9, 2024 03:52
Copy link

codecov bot commented Mar 9, 2024

Codecov Report

Attention: Patch coverage is 69.29134% with 39 lines in your changes are missing coverage. Please review.

Project coverage is 72.18%. Comparing base (b531b59) to head (d342bd6).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5215      +/-   ##
==========================================
+ Coverage   72.12%   72.18%   +0.06%     
==========================================
  Files         331      331              
  Lines       17123    17175      +52     
  Branches     4371     4386      +15     
==========================================
+ Hits        12350    12398      +48     
- Misses       4773     4777       +4     
Files Coverage Δ
packages/wrangler/src/api/dev.ts 83.33% <ø> (ø)
...es/wrangler/src/api/integrations/platform/index.ts 16.66% <ø> (ø)
...wrangler/src/api/startDevWorker/ProxyController.ts 61.97% <100.00%> (+1.40%) ⬆️
packages/wrangler/src/api/startDevWorker/events.ts 15.38% <ø> (ø)
packages/wrangler/src/config/index.ts 88.00% <100.00%> (ø)
packages/wrangler/src/config/validation.ts 89.89% <100.00%> (+0.03%) ⬆️
packages/wrangler/src/deploy/deploy.ts 93.31% <ø> (ø)
...wrangler/src/deployment-bundle/apply-middleware.ts 100.00% <ø> (ø)
packages/wrangler/src/deployment-bundle/bundle.ts 87.50% <ø> (-1.03%) ⬇️
...src/deployment-bundle/create-worker-upload-form.ts 90.32% <100.00%> (+0.12%) ⬆️
... and 9 more

... and 5 files with indirect coverage changes

@GregBrimble GregBrimble changed the title WIP entrypoints Entrypoints Mar 22, 2024
@GregBrimble GregBrimble marked this pull request as ready for review March 22, 2024 15:14
@GregBrimble GregBrimble requested review from a team as code owners March 22, 2024 15:14
@petebacondarwin petebacondarwin marked this pull request as draft March 22, 2024 15:31
@petebacondarwin petebacondarwin marked this pull request as ready for review March 25, 2024 16:26
@GregBrimble GregBrimble added the ldw-exempt PRs marked with this label can be included in releases during LDW. label Mar 25, 2024
@mrbbot mrbbot changed the title Entrypoints Add support for named entrypoints Mar 25, 2024
@mrbbot mrbbot force-pushed the entrypoints branch 3 times, most recently from 0084213 to 5350fe0 Compare March 26, 2024 13:37
@@ -1,9 +1,24 @@
// TODO(soon): remove once https://github.com/cloudflare/workerd/pull/1870 lands
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eagle has landed 🦅

Just need to publish to npm, and then we should be good to go. Looks like there was a problem with that latest run though: https://github.com/cloudflare/workerd/actions/runs/8438068332

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to remove this file before merging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reminder. Yes, I'll do that now.

@GregBrimble
Copy link
Member Author

GregBrimble commented Apr 3, 2024

Okay, once these pass, I'm merging and will follow up with another PR to bump to the latest workerd version 🚀

@GregBrimble GregBrimble merged commit cd03d1d into main Apr 3, 2024
25 checks passed
@GregBrimble GregBrimble deleted the entrypoints branch April 3, 2024 21:42
@workers-devprod workers-devprod mentioned this pull request Apr 4, 2024
renovate bot added a commit to Johannes-Andersen/Johannes that referenced this pull request Apr 24, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [wrangler](https://togithub.com/cloudflare/workers-sdk)
([source](https://togithub.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler))
| [`3.51.2` ->
`3.52.0`](https://renovatebot.com/diffs/npm/wrangler/3.51.2/3.52.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/wrangler/3.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/wrangler/3.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/wrangler/3.51.2/3.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/wrangler/3.51.2/3.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>cloudflare/workers-sdk (wrangler)</summary>

###
[`v3.52.0`](https://togithub.com/cloudflare/workers-sdk/blob/HEAD/packages/wrangler/CHANGELOG.md#3520)

[Compare
Source](https://togithub.com/cloudflare/workers-sdk/compare/wrangler@3.51.2...wrangler@3.52.0)

##### Minor Changes

- [#&#8203;5666](https://togithub.com/cloudflare/workers-sdk/pull/5666)
[`81d9615`](https://togithub.com/cloudflare/workers-sdk/commit/81d961582da2db2b020305c63a9f1f1573ff873d)
Thanks [@&#8203;CarmenPopoviciu](https://togithub.com/CarmenPopoviciu)!
- fix: Fix Pages config validation around Durable Objects

Today Pages cannot deploy Durable Objects itself. For this reason it is
mandatory that when declaring Durable Objects bindings in the config
file, the `script_name` is specified. We are currently not failing
validation if
`script_name` is not specified but we should. These changes fix that.

##### Patch Changes

- [#&#8203;5610](https://togithub.com/cloudflare/workers-sdk/pull/5610)
[`24840f6`](https://togithub.com/cloudflare/workers-sdk/commit/24840f67b6495a664f5463697aa49fa9478435b9)
Thanks [@&#8203;SuperchupuDev](https://togithub.com/SuperchupuDev)! -
Mark `ts-json-schema-generator` as a dev dependency

- [#&#8203;5669](https://togithub.com/cloudflare/workers-sdk/pull/5669)
[`a7e36d5`](https://togithub.com/cloudflare/workers-sdk/commit/a7e36d503f442a8225ffdedef30b569a8a396663)
Thanks
[@&#8203;dario-piotrowicz](https://togithub.com/dario-piotrowicz)! -
fix: fix broken Durable Object local proxying (when no `cf` property is
present)

A regression was introduced in wrangler 3.46.0
([cloudflare/workers-sdk#5215)
which made it so that missing `Request#cf` properties are serialized as
`"undefined"`, this in turn
throws a syntax parse error when such values are parsed via `JSON.parse`
breaking the communication
with Durable Object local proxies. Fix such issue by serializing missing
`Request#cf` properties as
    `"{}"` instead.

- [#&#8203;5616](https://togithub.com/cloudflare/workers-sdk/pull/5616)
[`c6312b5`](https://togithub.com/cloudflare/workers-sdk/commit/c6312b5017279b31ce99c761e2063973f7d948bf)
Thanks [@&#8203;webbertakken](https://togithub.com/webbertakken)! - fix:
broken link to durable object migrations docs

- [#&#8203;5482](https://togithub.com/cloudflare/workers-sdk/pull/5482)
[`1b7739e`](https://togithub.com/cloudflare/workers-sdk/commit/1b7739e0af99860aa063f01c0a6e7712ac072fdb)
Thanks [@&#8203;DaniFoldi](https://togithub.com/DaniFoldi)! - docs: show
new Discord url everywhere for consistency. The old URL still works, but
https://discord.cloudflare.com is preferred.

- Updated dependencies
\[[`3a0d735`](https://togithub.com/cloudflare/workers-sdk/commit/3a0d7356bd8bc6fe614a3ef3f9c1278659555568),
[`1b7739e`](https://togithub.com/cloudflare/workers-sdk/commit/1b7739e0af99860aa063f01c0a6e7712ac072fdb)]:
    -   miniflare@3.20240419.0
-
[@&#8203;cloudflare/kv-asset-handler](https://togithub.com/cloudflare/kv-asset-handler)[@&#8203;0](https://togithub.com/0).3.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Johannes-Andersen/Johannes).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMTMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjMxMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ldw-exempt PRs marked with this label can be included in releases during LDW.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants