fix(directives): report server functions that cannot work - #2318
Open
lxsmnsyc wants to merge 2 commits into
Open
fix(directives): report server functions that cannot work#2318lxsmnsyc wants to merge 2 commits into
lxsmnsyc wants to merge 2 commits into
Conversation
A server function is moved to the top level of its module, and several shapes stop working once it is. They compiled without complaint before. - Fail the build when a server function reads a variable from an enclosing function, uses `this` or `arguments` in an arrow, uses `super`, or reads a private class member. - Fail the build when the directive is in an object or class method. The transform ignored it, which shipped the method body and the modules it imports to the browser. - Warn when a directive string is not the first statement of a module or a function body, where it has no effect. - Warn for each export a "use server" module cannot serve, naming it. Those exports are still left out of the client build. - Support an anonymous default export from a "use server" module. - Compile server functions in `.mts` and `.cts` files. - Point build errors at the full path of the file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b0ddee2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
Ids were the position of the function in the file, so adding a server function renumbered every later one. A client bundle from an earlier build then called a different function instead of failing. - Build the id from the names the function is nested under, such as `Page.load`. Functions that share a name path are numbered. - Keep production ids opaque by hashing that name. - Drop `get-descriptive-name.ts`, which nothing uses now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
Author
|
Also replaces the |
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 server function is moved to the top level of its module, and several shapes stop working once it is. They compiled without complaint before.
thisorargumentsin an arrow, usessuper, or reads a private class member..mtsand.ctsfiles.