fix: fix plain TypeScript parser handling#7342
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughFilename-aware AST parsing was added and threaded through transforms: callers now pass an optional filename into parse/transform APIs so .ts/.cts/.mts files are parsed without JSX by default. Multiple router and start-plugin modules were updated to accept and forward this filename context; some local AST wrappers were removed. ChangesFilename-Aware AST Parsing & Transform Pipeline
Sequence Diagram(s)sequenceDiagram
participant Generator as router-generator
participant Parser as router-utils.parseAst
participant Plugin as router-plugin / start-plugin-core
participant Compiler as StartCompiler
participant RSBuild as rsbuild/vite
Generator->>Parser: transform(source, filename=node.fullPath)
Parser-->>Generator: parsed AST (no JSX for .ts)
Generator->>Plugin: code-splitting / HMR analyses (filename)
Plugin->>Parser: parseAst(code, filename)
Plugin-->>Compiler: provides file-aware analysis results
RSBuild->>Plugin: call getImportSources(code, file)
RSBuild-->>Compiler: cached TransformResult with filename
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 79ad1b6
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview4 package(s) bumped directly, 6 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/start-plugin-core/src/start-compiler/compiler.ts`:
- Around line 866-876: The ingestModule implementation passes the raw id into
parseAst when parserFilename is omitted, which may include query params;
normalize the fallback by calling cleanId(id) before passing to parseAst (i.e.,
use parseAst({ code, filename: parserFilename ?? cleanId(id) })) and keep
extractModuleInfo(id) unchanged; update the ingestModule function to import/use
cleanId and ensure parseAst gets the cleaned filename so filename-based parser
mode inference works correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 02e3353a-faae-42a9-afc7-60b7b692b739
📒 Files selected for processing (21)
.changeset/calm-type-assertions.mde2e/react-start/basic/src/routeTree.gen.tse2e/react-start/basic/src/routes/plain-ts-type-assertion.tsxe2e/react-start/basic/src/utils/cast.tse2e/react-start/basic/tests/navigation.spec.tspackages/router-generator/src/generator.tspackages/router-generator/src/transform/transform.tspackages/router-generator/src/transform/types.tspackages/router-plugin/src/core/code-splitter/compilers.tspackages/router-plugin/src/core/router-code-splitter-plugin.tspackages/router-plugin/src/core/router-hmr-plugin.tspackages/router-utils/src/ast.tspackages/router-utils/tests/stripTypeExports.test.tspackages/start-plugin-core/src/import-protection/analysis.tspackages/start-plugin-core/src/import-protection/ast.tspackages/start-plugin-core/src/import-protection/rewrite.tspackages/start-plugin-core/src/import-protection/sourceLocation.tspackages/start-plugin-core/src/rsbuild/import-protection.tspackages/start-plugin-core/src/start-compiler/compiler.tspackages/start-plugin-core/src/vite/import-protection-plugin/plugin.tspackages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
💤 Files with no reviewable changes (1)
- packages/start-plugin-core/src/import-protection/ast.ts
Merging this PR will not alter performance
Comparing Footnotes
|
fixes #7341
Summary by CodeRabbit
New Features
Bug Fixes
Chores