| 166 | }; |
| 167 | |
| 168 | const parseNamedImports = (clause: string, binding: NativeScriptImportBinding) => { |
| 169 | const inner = clause.replace(/^\{/, '').replace(/\}$/, ''); |
| 170 | inner |
| 171 | .split(',') |
| 172 | .map((segment) => segment.trim()) |
| 173 | .filter(Boolean) |
| 174 | .forEach((segment) => { |
| 175 | const [imported, local] = segment.split(/\s+as\s+/i).map((s) => s.trim()); |
| 176 | const resolvedImported = imported; |
| 177 | const resolvedLocal = local || imported; |
| 178 | if (resolvedImported) { |
| 179 | binding.named.push({ |
| 180 | imported: resolvedImported, |
| 181 | local: resolvedLocal, |
| 182 | }); |
| 183 | } |
| 184 | }); |
| 185 | }; |
| 186 | |
| 187 | // Handle "import ... from 'x'" forms |
| 188 | code = code.replace(importRegex, (full: string, pfx: string, clause: string, rawSpec: string) => { |