(id: string)
| 1387 | |
| 1388 | // e.g. `arksets` for a module a workspace links from its source |
| 1389 | packageNameOf(id: string): string | undefined { |
| 1390 | const dir = dirname(id) |
| 1391 | if (dir in this.packageNamesByDir) return this.packageNamesByDir[dir] |
| 1392 | const manifestPath = join(dir, "package.json") |
| 1393 | const manifest = this.host.readFile(manifestPath) |
| 1394 | let name: string | undefined |
| 1395 | if (manifest !== undefined) { |
| 1396 | try { |
| 1397 | name = parsePackageManifest(manifest, manifestPath).name |
| 1398 | } catch { |
| 1399 | // one that doesn't parse names nothing |
| 1400 | } |
| 1401 | } |
| 1402 | return (this.packageNamesByDir[dir] = |
| 1403 | manifest !== undefined ? name |
| 1404 | : dir === dirname(dir) ? undefined |
| 1405 | : this.packageNameOf(dir)) |
| 1406 | } |
| 1407 | |
| 1408 | private load(id: string, specifier: string): SourceModule | ImportTarget { |
| 1409 | const source = this.host.readFile(id) |
no test coverage detected