Repository navigation
computer: Allow source modules under simple ws:* names - #281
Merged
Merged
Conversation
A host can now ship a source module in its own namespace, alongside its host modules. Host modules export plain functions only, so a host that wants to offer objects (an MCP server whose tools are methods, say) needs a source facade that imports them; until now that facade had to live outside ws:*, which reads as a library the user bundled rather than one the host provides. Source modules under ws:* follow the host modules' naming rule and are described to the model as libraries the host provides.
🦋 Changeset detectedLatest commit: f58fad7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
commit: |
A source module's ws:* imports were checked against host modules alone, so a ws:* source importing another failed before loading, with "imports \"ws:b\", which is not configured". They are now checked against both, and rewritten to the module directory the same way. The isolated JavaScript guide, the modules option and WorkspaceModule still said ws:* was for host modules only; they now describe source under ws:* as a library the host provides, with an example. Adds the changeset.
| "@cloudflare/computer": patch | ||
| --- | ||
|
|
||
| `WorkerJavaScriptBackend` custom modules now support exporting objects as well as functions. |
There was a problem hiding this comment.
🔍 Release note obscures source module naming
Source modules could already export objects. The new support is for simple ws:* names; host modules still accept only functions. The changelog entry can mislead users into passing objects as host module exports.
Was this helpful? React with 👍 or 👎 to provide feedback.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A host can now ship a source module in its own namespace, alongside its host modules. Host modules export plain functions only, so a host that wants to offer objects (an MCP server whose tools are methods, say) needs a source facade that imports them; until now that facade had to live outside ws:*, which reads as a library the user bundled rather than one the host provides.
Source modules under ws:* follow the host modules' naming rule and are described to the model as libraries the host provides.