(id: string, source: string)
| 141 | |
| 142 | // a module's tree, read in the language its id names |
| 143 | export const parseModule = (id: string, source: string): ParseResult => { |
| 144 | const result = parse(id, source, langOf(id)) |
| 145 | // Next and other tools allow JSX in a .js module |
| 146 | if (result.errors.length && id.endsWith(".js")) { |
| 147 | const jsx = parse(id, source, "jsx") |
| 148 | if (!jsx.errors.length) return jsx |
| 149 | } |
| 150 | return result |
| 151 | } |
| 152 | |
| 153 | // oxc's raw transfer reads a tree several times faster than its JSON, through |
| 154 | // a buffer reserving 6 GiB of address space, which Windows commits |
no test coverage detected