feat: support .tsrx route modules - #8
Conversation
…h @tsrx/oxc's parser facade as an optional lazily-loaded peer; tsrx joins the Vite adapter's default extensions
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Summary
analyzeModulecurrently parses every route withoxc-parserhard-coded tolang: 'tsx', which throws on TSRX syntax (@{ ... }bodies,@if/@for,<style>sidecars). Export analysis now routes by filename:.tsrxmodules parse through@tsrx/oxc/parser, the official TSRX oxc integration, whoseParseResultmirrorsoxc-parser(samemodule.staticExports/StaticExportEntryshape) — so analysis semantics are byte-for-byte identical downstream..ts/.tsx/.js/.jsxroutes keep the exact existingoxc-parserpath, untouched.@tsrx/oxcis a new optional peer dependency, loaded lazily viacreateRequireonly when a.tsrxroute module is actually scanned. Projects without.tsrxroutes never load (or need) it; scanning a.tsrxroute without it installed fails with an error naming the module and the fix. The facade reports most syntax errors throughresult.errorsbut throws on some malformed sources; both channels normalize into the analyzer's existingFailed to parse <file>SyntaxError shape.DEFAULT_EXTENSIONSgainstsrx, matching@solidjs/vite-plugin's extension-is-the-opt-in posture, so.tsrxpages participate in routing without anextensionsoverride.Tests
.tsrxexport analysis: namedrouteconfig export,GEThandler, default export with a statement-container body containing@if+ a scoped<style>sidecar; type-only exports filtered..tsrx:page: true,$component.pick = ["default", "$css"],$$route.pick = ["route"]..tsrxthrows the uniformFailed to parseerror.tscbuild clean;npm pack --dry-runverified.Verified end-to-end against a real consumer: the solid-v2/with-tsrx template builds with a
.tsrxroute module using this branch'sdist.Made with Cursor