* Parses an encoded module reference back into its module index and * reference flags. * @param {string} name the identifier * @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index
(name)
| 186 | * @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index |
| 187 | */ |
| 188 | static matchModuleReference(name) { |
| 189 | const match = MODULE_REFERENCE_REGEXP.exec(name); |
| 190 | if (!match) return null; |
| 191 | const index = Number(match[1]); |
| 192 | const asiSafe = match[7]; |
| 193 | return { |
| 194 | index, |
| 195 | ids: |
| 196 | match[2] === "ns" |
| 197 | ? [] |
| 198 | : JSON.parse(Buffer.from(match[2], "hex").toString("utf8")), |
| 199 | call: Boolean(match[3]), |
| 200 | directImport: Boolean(match[4]), |
| 201 | deferredImport: Boolean(match[5]), |
| 202 | mangleableNamespace: Boolean(match[6]), |
| 203 | asiSafe: asiSafe ? asiSafe === "1" : undefined |
| 204 | }; |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | ConcatenationScope.DEFAULT_EXPORT = DEFAULT_EXPORT; |
no test coverage detected