(exports: HeldExport[])
| 5415 | } |
| 5416 | |
| 5417 | private findElsewhere(exports: HeldExport[]): Elsewhere | undefined { |
| 5418 | const seen = new Set<string>() |
| 5419 | for (let i = 0; i < exports.length; i++) { |
| 5420 | const [exporter, name, held] = exports[i] |
| 5421 | const key = `${exporter.id}\0${name}\0${held.depth}:${held.copied}` |
| 5422 | if (seen.has(key)) continue |
| 5423 | seen.add(key) |
| 5424 | // code the build doesn't follow may write it too: what loads its |
| 5425 | // module with require() or import(), as tsc's CommonJS does every |
| 5426 | // import, a dependency, or a read of a namespace re-exporting it. |
| 5427 | // The site's factory checks each value it read as it creates the |
| 5428 | // validator, as a build reading one module at a time relies on, so |
| 5429 | // only a write the build sees refuses the site |
| 5430 | for (const edge of this.importersOf(exporter.id)) { |
| 5431 | switch (edge.kind) { |
| 5432 | case "reexport": |
| 5433 | if (edge.name === name) exports.push([edge.module, edge.as, held]) |
| 5434 | break |
| 5435 | case "star": |
| 5436 | if (name !== "default") exports.push([edge.module, name, held]) |
| 5437 | break |
| 5438 | case "import": { |
| 5439 | if (edge.name !== "*" && edge.name !== name) break |
| 5440 | const write = |
| 5441 | edge.name === "*" ? |
| 5442 | this.namespaceWriteOf( |
| 5443 | edge.binding, |
| 5444 | edge.module, |
| 5445 | name, |
| 5446 | held, |
| 5447 | exports |
| 5448 | ) |
| 5449 | : this.mayWritesOf(edge.binding, edge.module, held)[0] |
| 5450 | if (write) { |
| 5451 | return { |
| 5452 | node: write, |
| 5453 | module: this.moduleOfNode(write) ?? edge.module |
| 5454 | } |
| 5455 | } |
| 5456 | if (edge.name !== "*") { |
| 5457 | exports.push( |
| 5458 | ...this.exportsHolding(edge.binding, edge.module, held) |
| 5459 | ) |
| 5460 | } |
| 5461 | } |
| 5462 | } |
| 5463 | } |
| 5464 | } |
| 5465 | } |
| 5466 | |
| 5467 | // where a namespace's reads of an export may write it, adding the names |
| 5468 | // what holds it next is exported as |
no test coverage detected