( environment: Environment, hook: Plugin['load'] | undefined, pluginName: string, )
| 1390 | } |
| 1391 | |
| 1392 | function wrapEnvironmentLoad( |
| 1393 | environment: Environment, |
| 1394 | hook: Plugin['load'] | undefined, |
| 1395 | pluginName: string, |
| 1396 | ): Plugin['load'] { |
| 1397 | if (!hook) return |
| 1398 | |
| 1399 | const fn = getHookHandler(hook) |
| 1400 | const handler: Plugin['load'] = function (id, ...args) { |
| 1401 | return fn.call( |
| 1402 | injectEnvironmentInContext(this, environment), |
| 1403 | id, |
| 1404 | injectSsrFlag(args[0], environment, pluginName), |
| 1405 | ) |
| 1406 | } |
| 1407 | |
| 1408 | if ('handler' in hook) { |
| 1409 | return wrapHookObject(hook, handler) |
| 1410 | } else { |
| 1411 | return handler |
| 1412 | } |
| 1413 | } |
| 1414 | |
| 1415 | function wrapEnvironmentTransform( |
| 1416 | environment: Environment, |
no test coverage detected