mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
fix(javascript): parse JavaScript sources with JavaScript grammar (#3782)
parserPluginsForPath enabled Babel's typescript plugin for .js, .jsx, .mjs and .cjs sources. TypeScript reads some valid JavaScript differently: a conditional whose consequent is an arrow with a parenthesized body (c?x=>(a):y=>(b)) throws as a return-type annotation, and a<b>(c) becomes a generic call. VS Code's 20 MB workbench bundles therefore returned no AST at all. Select JavaScript grammar (JSX plus legacy decorators) for explicit JavaScript extensions. TypeScript dialects and unnamed sources keep the existing TypeScript-capable contract. Fixes #3780 Refs #3670 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -206,6 +206,9 @@ code unit, matching the original bytes identified by the artifact digest.
|
||||
|
||||
Plain `.ts` artifact sources use TypeScript syntax without JSX, including
|
||||
angle-bracket type assertions. `.tsx` and `.jsx` retain JSX parsing.
|
||||
JavaScript sources use JavaScript grammar with JSX, never TypeScript syntax,
|
||||
so valid JavaScript that TypeScript reads differently keeps its JavaScript
|
||||
meaning.
|
||||
|
||||
Relative TypeScript imports can name their emitted `.js`, `.mjs`, or `.cjs`
|
||||
counterparts while resolving to inventoried source files. This substitution
|
||||
|
||||
Reference in New Issue
Block a user