* The file a package's declared entry for an import lands on (#2502): the * first declared target, in order (`exports` by condition, then the root's * `main`-style fields), that the index holds, or that is build output the * index lacks (`dist/index.js`), read as the source it is built from * (`
(targets: WorkspaceImportTargets, language: Language, context: ResolutionContext)
| 1559 | * were read. |
| 1560 | */ |
| 1561 | function declaredWorkspaceEntry(targets: WorkspaceImportTargets, language: Language, context: ResolutionContext): string | null { |
| 1562 | for (const target of targets.declared) { |
| 1563 | const hit = indexedTarget(target, language, context) ?? builtSourceOf(target, targets.packageDir, language, context); |
| 1564 | if (hit) return hit; |
| 1565 | } |
| 1566 | return null; |
| 1567 | } |
| 1568 | |
| 1569 | /** A read of the page a browser gives a script: `document.title`, `window.location`. */ |
| 1570 | const BROWSER_GLOBAL_READ = /(?<![\w$.])(?:document|window)\s*[.[]/; |
no test coverage detected