-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Miniflare 3] Add support for routing to multiple Workers (#520)
* Add support for routing to multiple Workers This change ports Miniflare 2's `mounts` router to Miniflare 3. This attempts to replicate the logic of the `route(s)` field in the Wrangler configuration file: https://developers.cloudflare.com/workers/platform/triggers/routes/#matching-behavior Internally, this is implemented by binding all routable workers as service bindings in the entry service. The first worker is always bound as a "fallback", in case no routes match. Validation has been added to ensure we a) have a fallback, b) don't have workers with duplicate names that would cause bindings with the same name, and c) all routable/fallback workers have code so they actually get added as `workerd` services. * Require code for all Workers It doesn't really make sense to have Workers without code. This change updates our `zod` schemas to encode this requirement. * fixup! Add support for routing to multiple Workers Assert names unique when collecting routes * fixup! Add support for routing to multiple Workers Move `CORE_PLUGIN_NAME` back to `core` * fixup! Add support for routing to multiple Workers Add specific error message when defining multiple unnamed workers * fixup! Add support for routing to multiple Workers Use `Map` when de-duping services * fixup! Add support for routing to multiple Workers Extract out common plugin/namespace/persist Worker into function * fixup! Add support for routing to multiple Workers Use same specificity calculation for routes as internal service * fixup! fixup! Add support for routing to multiple Workers
- Loading branch information
Showing
18 changed files
with
715 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.