( id: string, source: string, options: ParserOptions )
| 177 | } |
| 178 | |
| 179 | export const parseCode = ( |
| 180 | id: string, |
| 181 | source: string, |
| 182 | options: ParserOptions |
| 183 | ): ParseResult => { |
| 184 | if (readsRaw && importsWithinRaw(source)) { |
| 185 | try { |
| 186 | return parseSync(id, source, { |
| 187 | ...options, |
| 188 | experimentalRawTransfer: true |
| 189 | } as ParserOptions) |
| 190 | } catch (e) { |
| 191 | // a process that can't reserve the buffer reads JSON |
| 192 | if (!(e instanceof RangeError)) throw e |
| 193 | readsRaw = false |
| 194 | } |
| 195 | } |
| 196 | return parseSync(id, source, options) |
| 197 | } |
| 198 | |
| 199 | type Lang = "js" | "jsx" | "ts" | "tsx" |
| 200 |
no test coverage detected