( environment: Environment, )
| 125 | } |
| 126 | |
| 127 | function createIsExternal( |
| 128 | environment: Environment, |
| 129 | ): (id: string, importer?: string) => boolean { |
| 130 | const processedIds = new Map<string, boolean>() |
| 131 | |
| 132 | const isConfiguredAsExternal = createIsConfiguredAsExternal(environment) |
| 133 | |
| 134 | return (id: string, importer?: string) => { |
| 135 | if (processedIds.has(id)) { |
| 136 | return processedIds.get(id)! |
| 137 | } |
| 138 | let isExternal = false |
| 139 | if (id[0] !== '.' && !path.isAbsolute(id)) { |
| 140 | isExternal = |
| 141 | isBuiltin(environment.config.resolve.builtins, id) || |
| 142 | isConfiguredAsExternal(id, importer) |
| 143 | } |
| 144 | processedIds.set(id, isExternal) |
| 145 | return isExternal |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | export function canExternalizeFile(filePath: string): boolean { |
| 150 | const ext = path.extname(filePath) |
no test coverage detected