( config: InputOptions, context: string )
| 184 | }; |
| 185 | |
| 186 | const getModuleContext = ( |
| 187 | config: InputOptions, |
| 188 | context: string |
| 189 | ): NormalizedInputOptions['moduleContext'] => { |
| 190 | const configModuleContext = config.moduleContext; |
| 191 | if (typeof configModuleContext === 'function') { |
| 192 | return id => configModuleContext(id) ?? context; |
| 193 | } |
| 194 | if (configModuleContext) { |
| 195 | const contextByModuleId: Record<string, string> = Object.create(null); |
| 196 | for (const [key, moduleContext] of Object.entries(configModuleContext)) { |
| 197 | contextByModuleId[resolve(key)] = moduleContext; |
| 198 | } |
| 199 | return id => contextByModuleId[id] ?? context; |
| 200 | } |
| 201 | return () => context; |
| 202 | }; |
| 203 | |
| 204 | const getTreeshake = (config: InputOptions): NormalizedInputOptions['treeshake'] => { |
| 205 | const configTreeshake = config.treeshake; |
no test coverage detected
searching dependent graphs…