aboutsummaryrefslogtreecommitdiff
path: root/src/api/schema.d.ts
diff options
context:
space:
mode:
authorGravatar Jarred SUmner <jarred@jarredsumner.com> 2022-01-01 01:53:50 -0800
committerGravatar Jarred SUmner <jarred@jarredsumner.com> 2022-01-01 01:53:50 -0800
commita17088363f16fc72562994ed01555841c7c1b1ac (patch)
tree27cb1685eb1ce676476797f7076dd46e2bac5d9c /src/api/schema.d.ts
parent83004f0a0a51658a50499256a874558f26e09a24 (diff)
downloadbun-a17088363f16fc72562994ed01555841c7c1b1ac.tar.gz
bun-a17088363f16fc72562994ed01555841c7c1b1ac.tar.zst
bun-a17088363f16fc72562994ed01555841c7c1b1ac.zip
[bun dev] Improve filesystem watcher & HMR reliability (Linux + a little macOS)
Text editors like Replit save through atomic file updates. In an inotify filesystem watcher (Linux), that appears to be a delete followed by moving the file to the directory. Now when known files are moved into a directory, the watcher sends the file change notification to the browser(s). From there, the browser looks at it's files to determine whether or not Additionally, if an existing HMR connection does not know about a file ID passed to it, it asks the browser to reply with the file path and then starts watching that file. This improves HMR reliabiality if Bun had been restarted but the page hadn't been restarted.
Diffstat (limited to 'src/api/schema.d.ts')
-rw-r--r--src/api/schema.d.ts78
1 files changed, 20 insertions, 58 deletions
diff --git a/src/api/schema.d.ts b/src/api/schema.d.ts
index d00dcfa6e..273f8d9d3 100644
--- a/src/api/schema.d.ts
+++ b/src/api/schema.d.ts
@@ -231,6 +231,8 @@ export enum WebsocketMessageKind {
build_fail = 4,
manifest_success = 5,
manifest_fail = 6,
+ resolve_file = 7,
+ file_change_notification_with_hint = 8,
}
export const WebsocketMessageKindKeys = {
1: "welcome",
@@ -245,16 +247,23 @@ export const WebsocketMessageKindKeys = {
manifest_success: "manifest_success",
6: "manifest_fail",
manifest_fail: "manifest_fail",
+ 7: "resolve_file",
+ resolve_file: "resolve_file",
+ 8: "file_change_notification_with_hint",
+ file_change_notification_with_hint: "file_change_notification_with_hint",
};
export enum WebsocketCommandKind {
build = 1,
manifest = 2,
+ build_with_file_path = 3,
}
export const WebsocketCommandKindKeys = {
1: "build",
build: "build",
2: "manifest",
manifest: "manifest",
+ 3: "build_with_file_path",
+ build_with_file_path: "build_with_file_path",
};
export interface StackFrame {
function_name: string;
@@ -575,37 +584,13 @@ export interface WebsocketMessageBuildFailure {
log: Log;
}
-export interface DependencyManifest {
- ids: Uint32Array;
-}
-
-export interface FileList {
- ptrs: StringPointer[];
- files: string;
-}
-
-export interface WebsocketMessageResolveIDs {
- id: Uint32Array;
- list: FileList;
-}
-
-export interface WebsocketCommandResolveIDs {
- ptrs: StringPointer[];
- files: string;
-}
-
-export interface WebsocketMessageManifestSuccess {
+export interface WebsocketCommandBuildWithFilePath {
id: uint32;
- module_path: string;
- loader: Loader;
- manifest: DependencyManifest;
+ file_path: string;
}
-export interface WebsocketMessageManifestFailure {
+export interface WebsocketMessageResolveID {
id: uint32;
- from_timestamp: uint32;
- loader: Loader;
- log: Log;
}
export declare function encodeStackFrame(
@@ -860,40 +845,17 @@ export declare function encodeWebsocketMessageBuildFailure(
export declare function decodeWebsocketMessageBuildFailure(
buffer: ByteBuffer
): WebsocketMessageBuildFailure;
-export declare function encodeDependencyManifest(
- message: DependencyManifest,
- bb: ByteBuffer
-): void;
-export declare function decodeDependencyManifest(
- buffer: ByteBuffer
-): DependencyManifest;
-export declare function encodeFileList(message: FileList, bb: ByteBuffer): void;
-export declare function decodeFileList(buffer: ByteBuffer): FileList;
-export declare function encodeWebsocketMessageResolveIDs(
- message: WebsocketMessageResolveIDs,
- bb: ByteBuffer
-): void;
-export declare function decodeWebsocketMessageResolveIDs(
- buffer: ByteBuffer
-): WebsocketMessageResolveIDs;
-export declare function encodeWebsocketCommandResolveIDs(
- message: WebsocketCommandResolveIDs,
- bb: ByteBuffer
-): void;
-export declare function decodeWebsocketCommandResolveIDs(
- buffer: ByteBuffer
-): WebsocketCommandResolveIDs;
-export declare function encodeWebsocketMessageManifestSuccess(
- message: WebsocketMessageManifestSuccess,
+export declare function encodeWebsocketCommandBuildWithFilePath(
+ message: WebsocketCommandBuildWithFilePath,
bb: ByteBuffer
): void;
-export declare function decodeWebsocketMessageManifestSuccess(
+export declare function decodeWebsocketCommandBuildWithFilePath(
buffer: ByteBuffer
-): WebsocketMessageManifestSuccess;
-export declare function encodeWebsocketMessageManifestFailure(
- message: WebsocketMessageManifestFailure,
+): WebsocketCommandBuildWithFilePath;
+export declare function encodeWebsocketMessageResolveID(
+ message: WebsocketMessageResolveID,
bb: ByteBuffer
): void;
-export declare function decodeWebsocketMessageManifestFailure(
+export declare function decodeWebsocketMessageResolveID(
buffer: ByteBuffer
-): WebsocketMessageManifestFailure;
+): WebsocketMessageResolveID;