* One `{ … }` import/export specifier — `a`, `a as b`, `"a-b" as c`, and the * same with TypeScript's inline `type` modifier (`type a`, `type a as b`) — as * the name it takes from the module and the name it binds (Flow's `typeof` * modifier likewise). `type` alone, or `type as t`, is a specifier
(raw: string)
| 2204 | * split by {@link splitSpecifierList}. |
| 2205 | */ |
| 2206 | function parseSpecifier(raw: string): { imported: string; local: string } | null { |
| 2207 | const item = raw.trim(); |
| 2208 | const alias = SPECIFIER_ALIAS.exec(item); |
| 2209 | if (alias) return { imported: unquoteSpecifier(alias[1]!), local: unquoteSpecifier(alias[2]!) }; |
| 2210 | const plain = SPECIFIER_PLAIN.exec(item); |
| 2211 | if (plain) { |
| 2212 | const name = unquoteSpecifier(plain[1]!); |
| 2213 | return { imported: name, local: name }; |
| 2214 | } |
| 2215 | return null; |
| 2216 | } |
| 2217 | |
| 2218 | /** |
| 2219 | * Extract JS/TS import mappings |
no test coverage detected