(specifier: string | AstNode)
| 136 | |
| 137 | function importResolve(input: string, cacheRoot: string, packageRoot: string): Plugin { |
| 138 | async function resolve(specifier: string | AstNode): Promise<ResolveIdResult> { |
| 139 | return typeof specifier !== "string" || // AST node? |
| 140 | isNodeBuiltin(specifier) || // node built-in, e.g., "node:fs" or "fs" |
| 141 | isPathImport(specifier) || // relative path, e.g., ./foo.js |
| 142 | /^\0?[\w-]+:/.test(specifier) || // windows file path, https: URL, \x00node-resolve:, etc. |
| 143 | specifier === input // entry point |
| 144 | ? null // don’t do any additional resolution |
| 145 | : {id: await resolveNodeImportInternal(cacheRoot, packageRoot, specifier), external: true}; // resolve bare import |
| 146 | } |
| 147 | return { |
| 148 | name: "resolve-import", |
| 149 | resolveId: resolve, |
no test coverage detected