js-dos 8.3.14 → 8.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,15 @@ export interface InitFileEntry {
20
20
  }
21
21
  export type InitFsEntry = InitBundleEntry | InitFileEntry | DosConfig | string;
22
22
  export type InitFs = InitFsEntry | InitFsEntry[];
23
+ export type PersistedSockdrives = {
24
+ drives: {
25
+ url: string;
26
+ persist: Uint8Array;
27
+ }[];
28
+ } | null;
23
29
  export interface Emulators {
24
30
  pathPrefix: string;
31
+ pathSuffix: string;
25
32
  version: string;
26
33
  wdosboxJs: string;
27
34
  bundle: () => Promise<DosBundle>;
@@ -53,7 +60,7 @@ export interface CommandInterface {
53
60
  sendMouseButton: (button: number, pressed: boolean) => void;
54
61
  sendMouseSync: () => void;
55
62
  sendBackendEvent: (event: any) => void;
56
- persist(onlyChanges?: boolean): Promise<Uint8Array | null>;
63
+ persist(onlyChanges?: boolean): Promise<Uint8Array | PersistedSockdrives | null>;
57
64
  events(): CommandInterfaceEvents;
58
65
  networkConnect(networkType: NetworkType, address: string): Promise<void>;
59
66
  networkDisconnect(networkType: NetworkType): Promise<void>;
@@ -61,7 +68,7 @@ export interface CommandInterface {
61
68
  fsTree(): Promise<FsNode>;
62
69
  fsReadFile(file: string): Promise<Uint8Array>;
63
70
  fsWriteFile(file: string, contents: ReadableStream<Uint8Array> | Uint8Array): Promise<void>;
64
- fsDeleteFile(file: string): Promise<void>;
71
+ fsDeleteFile(file: string): Promise<boolean>;
65
72
  }
66
73
  export type MessageType = "log" | "warn" | "error" | string;
67
74
  export interface CommandInterfaceEvents {
@@ -73,4 +80,5 @@ export interface CommandInterfaceEvents {
73
80
  onMessage: (consumer: (msgType: MessageType, ...args: any[]) => void) => void;
74
81
  onNetworkConnected: (consumer: (networkType: NetworkType, address: string) => void) => void;
75
82
  onNetworkDisconnected: (consumer: (networkType: NetworkType) => void) => void;
83
+ onUnload: (consumer: () => Promise<void>) => void;
76
84
  }
@@ -10,6 +10,7 @@ export declare class CommandInterfaceEventsImpl implements CommandInterfaceEvent
10
10
  private delayedMessages;
11
11
  private onNetworkConnectedConsumers;
12
12
  private onNetworkDisconnectedConsumers;
13
+ private onUnloadConsumers;
13
14
  onStdout: (consumer: (message: string) => void) => void;
14
15
  onFrameSize: (consumer: (width: number, height: number) => void) => void;
15
16
  onFrame: (consumer: (rgb: Uint8Array | null, rgba: Uint8Array | null) => void) => void;
@@ -18,6 +19,7 @@ export declare class CommandInterfaceEventsImpl implements CommandInterfaceEvent
18
19
  onMessage: (consumer: (msgType: MessageType, ...args: any[]) => void) => void;
19
20
  onNetworkConnected(consumer: (networkType: NetworkType, address: string) => void): void;
20
21
  onNetworkDisconnected(consumer: (networkType: NetworkType) => void): void;
22
+ onUnload: (consumer: () => Promise<void>) => void;
21
23
  fireStdout: (message: string) => void;
22
24
  fireFrameSize: (width: number, height: number) => void;
23
25
  fireFrame: (rgb: Uint8Array | null, rgba: Uint8Array | null) => void;
@@ -26,4 +28,5 @@ export declare class CommandInterfaceEventsImpl implements CommandInterfaceEvent
26
28
  fireMessage: (msgType: MessageType, ...args: any[]) => void;
27
29
  fireNetworkConnected: (networkType: NetworkType, address: string) => void;
28
30
  fireNetworkDisconnected: (networkType: NetworkType) => void;
31
+ fireUnload: () => Promise<void>;
29
32
  }
@@ -4,6 +4,7 @@ import DosBundle from "../dos/bundle/dos-bundle";
4
4
  import { TransportLayer } from "../protocol/protocol";
5
5
  declare class EmulatorsImpl implements Emulators {
6
6
  pathPrefix: string;
7
+ pathSuffix: string;
7
8
  version: string;
8
9
  wdosboxJs: string;
9
10
  wdosboxxJs: string;
@@ -25,13 +25,14 @@ declare class Host {
25
25
  export declare const host: Host;
26
26
  export declare class WasmModulesImpl implements IWasmModules {
27
27
  private pathPrefix;
28
+ private pathSuffix;
28
29
  private wdosboxJs;
29
30
  private wdosboxxJs;
30
31
  private libzipPromise?;
31
32
  private dosboxPromise?;
32
33
  private dosboxxPromise?;
33
34
  wasmSupported: boolean;
34
- constructor(pathPrefix: string, wdosboxJs: string, wdosboxxJs: string);
35
+ constructor(pathPrefix: string, pathSuffix: string, wdosboxJs: string, wdosboxxJs: string);
35
36
  libzip(): Promise<WasmModule>;
36
37
  dosbox(): Promise<WasmModule>;
37
38
  dosboxx(): Promise<WasmModule>;
@@ -0,0 +1,3 @@
1
+ export declare const compressBound: any;
2
+ export declare const compress: any;
3
+ export declare const uncompress: any;
@@ -1,7 +1,7 @@
1
- import { CommandInterface, NetworkType, BackendOptions, DosConfig, InitFsEntry } from "../emulators";
1
+ import { CommandInterface, NetworkType, BackendOptions, DosConfig, InitFsEntry, PersistedSockdrives } from "../emulators";
2
2
  import { CommandInterfaceEventsImpl } from "../impl/ci-impl";
3
- export type ClientMessage = "wc-install" | "wc-run" | "wc-pack-fs-to-bundle" | "wc-add-key" | "wc-mouse-move" | "wc-mouse-button" | "wc-mouse-sync" | "wc-exit" | "wc-sync-sleep" | "wc-pause" | "wc-resume" | "wc-mute" | "wc-unmute" | "wc-connect" | "wc-disconnect" | "wc-backend-event" | "wc-asyncify-stats" | "wc-fs-tree" | "wc-fs-get-file" | "wc-send-data-chunk" | "wc-net-connected" | "wc-net-received";
4
- export type ServerMessage = "ws-extract-progress" | "ws-ready" | "ws-server-ready" | "ws-frame-set-size" | "ws-update-lines" | "ws-log" | "ws-warn" | "ws-err" | "ws-stdout" | "ws-exit" | "ws-persist" | "ws-sound-init" | "ws-sound-push" | "ws-config" | "ws-sync-sleep" | "ws-connected" | "ws-disconnected" | "ws-asyncify-stats" | "ws-fs-tree" | "ws-send-data-chunk" | "ws-net-connect" | "ws-net-disconnect" | "ws-net-send";
3
+ export type ClientMessage = "wc-install" | "wc-run" | "wc-pack-fs-to-bundle" | "wc-add-key" | "wc-mouse-move" | "wc-mouse-button" | "wc-mouse-sync" | "wc-exit" | "wc-sync-sleep" | "wc-pause" | "wc-resume" | "wc-mute" | "wc-unmute" | "wc-connect" | "wc-disconnect" | "wc-backend-event" | "wc-asyncify-stats" | "wc-fs-tree" | "wc-fs-get-file" | "wc-send-data-chunk" | "wc-net-connected" | "wc-net-received" | "wc-sockdrive-opened" | "wc-sockdrive-new-range" | "wc-unload" | "wc-fs-delete-file";
4
+ export type ServerMessage = "ws-extract-progress" | "ws-ready" | "ws-server-ready" | "ws-frame-set-size" | "ws-update-lines" | "ws-log" | "ws-warn" | "ws-err" | "ws-stdout" | "ws-exit" | "ws-persist" | "ws-sound-init" | "ws-sound-push" | "ws-config" | "ws-sync-sleep" | "ws-connected" | "ws-disconnected" | "ws-asyncify-stats" | "ws-fs-tree" | "ws-send-data-chunk" | "ws-net-connect" | "ws-net-disconnect" | "ws-net-send" | "ws-sockdrive-open" | "ws-sockdrive-ready" | "ws-sockdrive-close" | "ws-sockdrive-load-range" | "ws-sockdrive-write-sector" | "ws-unload" | "ws-fs-delete-file";
5
5
  export type MessageHandler = (name: ServerMessage, props: {
6
6
  [key: string]: any;
7
7
  }) => void;
@@ -33,14 +33,9 @@ export interface AsyncifyStats {
33
33
  cycles: number;
34
34
  netSent: number;
35
35
  netRecv: number;
36
- driveSent: number;
37
- driveRecv: number;
38
- driveRecvTime: number;
39
- driveCacheHit: number;
40
- driveCacheMiss: number;
41
- driveCacheUsed: number;
42
- driveBufferedAmount: number;
43
36
  driveIo: {
37
+ url: string;
38
+ total: number;
44
39
  read: number;
45
40
  write: number;
46
41
  }[];
@@ -83,10 +78,13 @@ export declare class CommandInterfaceOverTransportLayer implements CommandInterf
83
78
  private fsGetFilePromise;
84
79
  private fsGetFileResolve;
85
80
  private fsGetFileParts;
81
+ private fsDeleteFilePromise;
82
+ private fsDeleteFileResolve;
86
83
  private dataChunkPromise;
87
84
  private dataChunkResolve;
88
85
  private networkId;
89
86
  private network;
87
+ private sockdrives;
90
88
  options: BackendOptions;
91
89
  constructor(init: InitFsEntry[], transport: TransportLayer, ready: (err: Error | null) => void, options: BackendOptions);
92
90
  private sendClientMessage;
@@ -113,7 +111,7 @@ export declare class CommandInterfaceOverTransportLayer implements CommandInterf
113
111
  sendMouseButton(button: number, pressed: boolean): void;
114
112
  sendMouseSync(): void;
115
113
  sendBackendEvent(payload: any): void;
116
- persist(onlyChanges?: boolean): Promise<Uint8Array | null>;
114
+ persist(onlyChanges?: boolean): Promise<Uint8Array | PersistedSockdrives | null>;
117
115
  private onPersist;
118
116
  pause(): void;
119
117
  resume(): void;
@@ -128,7 +126,8 @@ export declare class CommandInterfaceOverTransportLayer implements CommandInterf
128
126
  fsTree(): Promise<FsNode>;
129
127
  fsReadFile(file: string): Promise<Uint8Array>;
130
128
  fsWriteFile(file: string, contents: ReadableStream<Uint8Array> | Uint8Array): Promise<void>;
131
- fsDeleteFile(file: string): Promise<void>;
129
+ fsDeleteFile(file: string): Promise<boolean>;
130
+ persistSockdrives(): Promise<PersistedSockdrives>;
132
131
  private sendDataChunk;
133
132
  private sendFullDataChunk;
134
133
  private dataChunkKey;
@@ -0,0 +1,18 @@
1
+ export declare const RAW_STORE = "raw";
2
+ export declare const WRITE_STORE = "write";
3
+ export interface Store {
4
+ put: (key: number, data: Uint8Array, store: string) => Promise<void>;
5
+ get: (key: number, store: string) => Promise<Uint8Array | null>;
6
+ keys: (store: string) => Promise<number[]>;
7
+ each: (key: number[], store: string, callback: (key: number, data: Uint8Array) => void) => Promise<void>;
8
+ close: () => void;
9
+ }
10
+ export declare class NoStore implements Store {
11
+ owner: string;
12
+ close(): void;
13
+ put(key: number, data: Uint8Array, store: string): Promise<void>;
14
+ get(range: number, store: string): Promise<Uint8Array | null>;
15
+ keys(store: string): Promise<number[]>;
16
+ each(keys: number[], store: string, callback: (key: number, data: Uint8Array) => void): Promise<void>;
17
+ }
18
+ export declare function getStore(owner: string): Promise<Store>;
@@ -0,0 +1,27 @@
1
+ interface DriveInfo {
2
+ ahead_read: number;
3
+ range_count: number;
4
+ dropped_ranges: number[];
5
+ preload_ranges: number[] | "_";
6
+ small_ranges: number[];
7
+ cylinders: number;
8
+ heads: number;
9
+ sectors: number;
10
+ sector_size: number;
11
+ size: number;
12
+ name: string;
13
+ url: string;
14
+ sizeInBytes: number;
15
+ readInBytes: number;
16
+ writeInBytes: number;
17
+ }
18
+ export interface Drive {
19
+ info: DriveInfo;
20
+ range(sector: number): number;
21
+ readRangeAsync(range: number): void;
22
+ ready(): void;
23
+ write(sector: number, buffer: Uint8Array): void;
24
+ persist(): Promise<Uint8Array | null>;
25
+ }
26
+ export declare function sockdrive(url: string, _onNewRange: (range: number, buffer: Uint8Array) => void): Promise<Drive>;
27
+ export {};