Repository navigation
solid: add include option to transform JSX inside node_modules - #1741
Closed
dskanakoglou wants to merge 1 commit into
Closed
dskanakoglou wants to merge 1 commit into
dskanakoglou wants to merge 1 commit into
Conversation
The Solid transform skips every path containing node_modules. Hosts that install plugin packages into their own cache (for example OpenCode's npm cache) need those packages' JSX compiled too, or it runs once and never updates. `include` lists such directories; it is also accepted by ensureSolidTransformPlugin and ensureRuntimePluginSupport, which register an extra plugin when the transform is already installed.
Author
|
The OpenCode side is now confirmed: anomalyco/opencode#39986 was reproduced on 2.2.0 and current |
Member
|
Thanks. We'd rather decide how external TSX is compiled ourselves, so I'm closing this. |
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.
The Solid transform skips every path that contains
node_modules. OpenCode installs plugin packages (npm,git+andgithub:specs) into its cache under<cache>/npm/<key>/<n>/node_modules/<pkg>/, so the JSX in those plugins is never compiled. Bun's JSX runtime evaluates{n()}once, and the plugin renders but never updates. The same folder loaded by path works. This is anomalyco/opencode#39986, whose plan puts the fix in OpenTUI.This adds an
includeoption, a list of directories whose.jsx/.tsxfiles are transformed even though their paths containnode_modules.createSolidTransformPlugin,ensureSolidTransformPluginandensureRuntimePluginSupportall accept it. A host passes its install directory:Only JSX files match. Plain modules in
node_modulesalready get the runtime specifier rewrites, and transforming every dependency would be slow. Nothing is bundled, so plugin modules load normally andimport.meta.urlkeeps pointing at the installed file.Bun fixes plugin filters when a plugin is registered, so when the transform is already installed,
ensureSolidTransformPluginregisters one extra plugin for directories it has not seen. That extra plugin only transforms sources; it does not add thesolid-jsserver-build redirects a second time.Tests:
.tsxcomponent from a directory undernode_modulesviaensureRuntimePluginSupport({ include }), changes a signal, and checks that the rendered frame updatesbun testinpackages/solidpasses (300), andoxlintandoxfmt --checkare clean.Refs anomalyco/opencode#39986