Uses status bar to indicate hot reloading

This commit is contained in:
Henning Dieterichs
2024-02-02 12:27:15 +01:00
committed by Henning Dieterichs
parent 942ed9acd7
commit 22a578f53b
3 changed files with 267 additions and 36 deletions

View File

@@ -3,20 +3,33 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
type RunFunction = ((debugSession: IDebugSession) => IDisposable) | ((debugSession: IDebugSession) => Promise<IDisposable>);
type RunFunction =
| ((debugSession: IDebugSession, context: Context) => IDisposable)
| ((debugSession: IDebugSession, context: Context) => Promise<IDisposable>);
interface IDebugSession {
name: string;
eval(expression: string): Promise<void>;
evalJs<T extends any[]>(bodyFn: (...args: T) => void, ...args: T): Promise<void>;
eval(expression: string): Promise<unknown>;
evalJs<T extends any[], TResult>(
bodyFn: (...args: T) => TResult,
...args: T
): Promise<TResult>;
}
interface Context {
vscode: typeof import('vscode');
}
interface IDisposable {
dispose(): void;
}
interface HotReloadConfig {
mode?: 'patch-prototype' | undefined;
}
interface GlobalThisAddition {
$hotReload_applyNewExports?(args: { oldExports: Record<string, unknown>; newSrc: string }): AcceptNewExportsFn | undefined;
$hotReload_applyNewExports?(args: { oldExports: Record<string, unknown>; newSrc: string; config?: HotReloadConfig }): AcceptNewExportsFn | undefined;
}
type AcceptNewExportsFn = (newExports: Record<string, unknown>) => boolean;