(environment: BuildEnvironment, hook?: Plugin['load'])
| 174 | } |
| 175 | |
| 176 | function wrapEnvironmentLoad(environment: BuildEnvironment, hook?: Plugin['load']): Plugin['load'] { |
| 177 | if (!hook) { |
| 178 | return; |
| 179 | } |
| 180 | |
| 181 | const fn = getHookHandler(hook); |
| 182 | const handler: Plugin['load'] = function (id, ...args) { |
| 183 | return fn.call(injectEnvironmentInContext(this, environment), id, injectSsrFlag(args[0], environment)); |
| 184 | }; |
| 185 | |
| 186 | if ('handler' in hook) { |
| 187 | return { |
| 188 | ...hook, |
| 189 | handler |
| 190 | } as Plugin['load']; |
| 191 | } |
| 192 | return handler; |
| 193 | } |
| 194 | |
| 195 | function wrapEnvironmentTransform(environment: BuildEnvironment, hook?: Plugin['transform']): Plugin['transform'] { |
| 196 | if (!hook) { |
no test coverage detected