(environment: BuildEnvironment, hook?: Plugin['resolveId'])
| 150 | } |
| 151 | |
| 152 | function wrapEnvironmentResolveId(environment: BuildEnvironment, hook?: Plugin['resolveId']): Plugin['resolveId'] { |
| 153 | if (!hook) { |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | const fn = getHookHandler(hook); |
| 158 | const handler: Plugin['resolveId'] = function (id, importer, options) { |
| 159 | return fn.call( |
| 160 | injectEnvironmentInContext(this, environment), |
| 161 | id, |
| 162 | importer, |
| 163 | injectSsrFlag(options, environment) |
| 164 | ); |
| 165 | }; |
| 166 | |
| 167 | if ('handler' in hook) { |
| 168 | return { |
| 169 | ...hook, |
| 170 | handler |
| 171 | } as Plugin['resolveId']; |
| 172 | } |
| 173 | return handler; |
| 174 | } |
| 175 | |
| 176 | function wrapEnvironmentLoad(environment: BuildEnvironment, hook?: Plugin['load']): Plugin['load'] { |
| 177 | if (!hook) { |
no test coverage detected