( environment: Environment, hook: Plugin['resolveId'] | undefined, pluginName: string, )
| 1366 | } |
| 1367 | |
| 1368 | function wrapEnvironmentResolveId( |
| 1369 | environment: Environment, |
| 1370 | hook: Plugin['resolveId'] | undefined, |
| 1371 | pluginName: string, |
| 1372 | ): Plugin['resolveId'] { |
| 1373 | if (!hook) return |
| 1374 | |
| 1375 | const fn = getHookHandler(hook) |
| 1376 | const handler: Plugin['resolveId'] = function (id, importer, options) { |
| 1377 | return fn.call( |
| 1378 | injectEnvironmentInContext(this, environment), |
| 1379 | id, |
| 1380 | importer, |
| 1381 | injectSsrFlag(options, environment, pluginName), |
| 1382 | ) |
| 1383 | } |
| 1384 | |
| 1385 | if ('handler' in hook) { |
| 1386 | return wrapHookObject(hook, handler) |
| 1387 | } else { |
| 1388 | return handler |
| 1389 | } |
| 1390 | } |
| 1391 | |
| 1392 | function wrapEnvironmentLoad( |
| 1393 | environment: Environment, |
no test coverage detected