Conversation
- Skip the server function transform for modules that do not contain the directive. - Append the lazy module id as a string instead of parsing with Babel. Babel now runs only when the module calls `lazy(`. - Register each hoisted server function declaration instead of crawling the whole program scope per function. - Remove unused declarations with a worklist in one pass instead of repeated traversals and crawls. - Merge the two directive placement checks into one traversal. - Keep unused `for...in` and `for...of` loop variables, which used to crash the compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 050c81e 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 |
commit: |
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Makes the server function and lazy transforms do less Babel work. Most modules now skip Babel entirely, and modules with many server functions compile about 4 times faster.
Changes
"use server". Before, everysrc/**module was parsed, transformed and printed twice (client and server), and the output was thrown away.export const id$$ = "..."as a string instead of prepending it with Babel. No existing code moves, so it returnsmap: null. Babel now runs only when the module callslazy(.transformFunctionregisters the hoistedserverFn_Ndeclaration instead of crawling the program scope once per server function.removeUnusedVariablescrawls once and uses a worklist. Removing a declaration dereferences the bindings it read, and bindings left with no references are queued. This replaces the loop of full traversals and crawls.assertNoMethodDirectivesandcollectMisplacedDirectivesare merged intovalidateDirectivePlacement, which does one traversal.Fixes found along the way
In a module with a server function, these used to crash the compile:
for...oforfor...inloop variable.const first = db; const second = first;.Benchmarks
Per-file compile time for the directives transform:
"use server"module, 60 exports (server)Testing
var, and unused loop variables.lazy.spec.tscovers the appended id, thelazyimport rewrite and the skip cases."use server", the spec inputs, and extra removal cases with the old and new compiler, in both modes and both envs. Output was identical except for the inputs that crash the old compiler.vitest runpasses (166 tests).tsc --noEmitis clean.basicandtodomvcfixtures build.🤖 Generated with Claude Code