( environment: DevEnvironment, url: string, module: EnvironmentModuleNode, timestamp: number, )
| 207 | } |
| 208 | |
| 209 | async function getCachedTransformResult( |
| 210 | environment: DevEnvironment, |
| 211 | url: string, |
| 212 | module: EnvironmentModuleNode, |
| 213 | timestamp: number, |
| 214 | ) { |
| 215 | const prettyUrl = debugCache ? prettifyUrl(url, environment.config.root) : '' |
| 216 | |
| 217 | // tries to handle soft invalidation of the module if available, |
| 218 | // returns a boolean true is successful, or false if no handling is needed |
| 219 | const softInvalidatedTransformResult = await handleModuleSoftInvalidation( |
| 220 | environment, |
| 221 | module, |
| 222 | timestamp, |
| 223 | ) |
| 224 | if (softInvalidatedTransformResult) { |
| 225 | debugCache?.(`[memory-hmr] ${prettyUrl}`) |
| 226 | return softInvalidatedTransformResult |
| 227 | } |
| 228 | |
| 229 | // check if we have a fresh cache |
| 230 | const cached = module.transformResult |
| 231 | if (cached) { |
| 232 | debugCache?.(`[memory] ${prettyUrl}`) |
| 233 | return cached |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | async function loadAndTransform( |
| 238 | environment: DevEnvironment, |
no test coverage detected