* Closes the project and all associated resources. This can only be called once; the closing promise is cached until the server restarts. * If the resources are needed again, create a new project.
()
| 505 | * If the resources are needed again, create a new project. |
| 506 | */ |
| 507 | public close(): Promise<void> { |
| 508 | if (!this.closingPromise) { |
| 509 | this.closingPromise = Promise.all( |
| 510 | [ |
| 511 | this.vite?.close(), |
| 512 | this.typechecker?.stop(), |
| 513 | // browser might not be set if it threw an error during initialization |
| 514 | (this.browser || this._parent?._parentBrowser?.vite)?.close(), |
| 515 | this.clearTmpDir(), |
| 516 | ].filter(Boolean), |
| 517 | ).then(() => { |
| 518 | if (!this.runner.isClosed()) { |
| 519 | return this.runner.close() |
| 520 | } |
| 521 | }).then(() => { |
| 522 | this._provided = {} as any |
| 523 | this._vite = undefined |
| 524 | }) |
| 525 | } |
| 526 | return this.closingPromise |
| 527 | } |
| 528 | |
| 529 | /** |
| 530 | * Import a file using Vite module runner. |
nothing calls this directly
no test coverage detected