(file: string)
| 339 | } |
| 340 | |
| 341 | getModulesByFile(file: string): Set<ModuleNode> | undefined { |
| 342 | // Until Vite 5.1.x, the moduleGraph contained modules from both the browser and server |
| 343 | // We maintain backwards compatibility by returning a Set of module proxies assuming |
| 344 | // that the modules for a certain file are the same in both the browser and server |
| 345 | const clientModules = this._client.getModulesByFile(file) |
| 346 | const ssrModules = this._ssr.getModulesByFile(file) |
| 347 | if (!clientModules && !ssrModules) { |
| 348 | return undefined |
| 349 | } |
| 350 | const result = new Set<ModuleNode>() |
| 351 | if (clientModules) { |
| 352 | for (const mod of clientModules) { |
| 353 | result.add(this.getBackwardCompatibleBrowserModuleNode(mod)!) |
| 354 | } |
| 355 | } |
| 356 | if (ssrModules) { |
| 357 | for (const mod of ssrModules) { |
| 358 | if (mod.id == null || !this._client.getModuleById(mod.id)) { |
| 359 | result.add(this.getBackwardCompatibleServerModuleNode(mod)!) |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | return result |
| 364 | } |
| 365 | |
| 366 | onFileChange(file: string): void { |
| 367 | this._client.onFileChange(file) |
no test coverage detected