Repository navigation
refactor(core): share the target compile pipeline behind createTargetCompiler - #107
jonkwheeler wants to merge 1 commit into
Conversation
…Compiler Every target package re-implemented the same parse → specialize → analyze → transform pipeline (plus the Volar variant), and two test helpers hand-built copies that had already drifted. createTargetCompiler(descriptor) owns the orchestration in @tsrx/core; each target now contributes only its platform descriptor. The Volar path forces moduleScopedHookComponents off for every target, matching what Solid and Vue already did locally. The pipeline no longer calls the no-op dedupeMappings; its export remains for external consumers. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Let's hold off with these changes. As I mentioned before we don't wanna do compiler work now. Plus this doesn't work with Ripple as Ripple transformers live in the ripple repo. We're also about to do somewhat big changes. So, let's keep it open for now. But I wanna make the changes first and then come back to this and put up a pr for Ripple before we go ahead. I'm assuming Octane may be affected too actually, so may need a pr there too. |
|
Sounds good — closing this out. Fair point on Ripple: the factory assumes the shared The branch ( |
Summary
createTargetCompiler(descriptor)in@tsrx/core, owning the sharedparse → specialize → analyze → transformpipeline plus the Volar/editor variant (typeOnly,preserveParens/keywordTokens,moduleScopedHookComponents: false,withPlatformTypes)index.jsfiles collapse toexport const { parse, compile, compile_to_volar_mappings } = createTargetCompiler(platform)— eachtransform.jsnow exports itsJsxPlatformdescriptor instead of an instantiated transformto_tsvstypeOnly) now go through the same seam;inspect-originsasserts on the Volar mappings the language server consumes instead of decoding raw VLQaststripping,platformspecialization, and Volar flag-forcingdedupeMappingscall (currently a no-op); the export remains for external consumersCONTEXT.mddomain glossary (compile pipeline, platform descriptor, target vs consumer compiler, Volar compile)Test plan
pnpm test --project tsrx-utils(645 tests, incl. both collapsed helpers + new suite)pnpm test— tsrx-react / tsrx-preact / tsrx-solid / tsrx-vue (2,137 tests via the shared compile harness)pnpm test— language-server, typescript-plugin, vite-plugin-react, vite-plugin-solid (275 consumer-side tests)pnpm typecheck(all 30 package configs)pnpm format:checkGenerated with Devin
Note
Medium Risk
Unifies compile and Volar behavior across all framework targets; React/Preact editor output now follows the same forced Volar hook-scoping as Solid/Vue, so regressions would show up in language tooling rather than runtime bundles.
Overview
Introduces
createTargetCompiler(platform)in@tsrx/core, which owns the sharedparse → specialize platform → analyze → transformflow and the editorcompile_to_volar_mappingspath (type-only transform, Volar-grade parse options,moduleScopedHookComponents: false, optionalwithPlatformTypes).React, Preact, Solid, and Vue drop ~100 lines of duplicated entry-point code; each package now
export const { parse, compile, compile_to_volar_mappings } = createTargetCompiler(platform), withtransform.jsexporting theJsxPlatformdescriptor instead of a pre-built transform.Adds
TargetCompiler/ factory typings, a changeset,CONTEXT.mdglossary, and focused tests at the factory seam (diagnostic aggregation,aststripping, platform specialization, Volar vs client hook-helper shaping). Internal test helpers route through the same factory;inspect-originsasserts on Volarmappingsinstead of hand-decoded source maps. The shared Volar path no longer wrapsdedupeMappings(already a no-op).Reviewed by Cursor Bugbot for commit dacb634. Bugbot is set up for automated code reviews on this repo. Configure here.