@webpodjs/sdk 0.1.0 → 0.1.1

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.
Files changed (53) hide show
  1. package/README.md +26 -3
  2. package/dist/agent/backend.d.ts +14 -4
  3. package/dist/agent/backend.js +15 -3
  4. package/dist/agent/backend.js.map +1 -1
  5. package/dist/agent/fs.d.ts +6 -0
  6. package/dist/agent/fs.js +10 -1
  7. package/dist/agent/fs.js.map +1 -1
  8. package/dist/agent/protocol.d.ts +9 -0
  9. package/dist/agent/protocol.js +8 -0
  10. package/dist/agent/protocol.js.map +1 -1
  11. package/dist/fs/tar.d.ts +2 -1
  12. package/dist/fs/tar.js +6 -3
  13. package/dist/fs/tar.js.map +1 -1
  14. package/dist/fs/workspace.d.ts +8 -3
  15. package/dist/fs/workspace.js +88 -25
  16. package/dist/fs/workspace.js.map +1 -1
  17. package/dist/fs-router.d.ts +4 -3
  18. package/dist/fs-router.js +7 -3
  19. package/dist/fs-router.js.map +1 -1
  20. package/dist/host/backend.d.ts +2 -2
  21. package/dist/host/backend.js +59 -3
  22. package/dist/host/backend.js.map +1 -1
  23. package/dist/host/channel.d.ts +4 -0
  24. package/dist/host/channel.js +22 -4
  25. package/dist/host/channel.js.map +1 -1
  26. package/dist/host/controller.d.ts +11 -1
  27. package/dist/host/controller.js +15 -2
  28. package/dist/host/controller.js.map +1 -1
  29. package/dist/host/devices.d.ts +8 -2
  30. package/dist/host/devices.js +2 -0
  31. package/dist/host/devices.js.map +1 -1
  32. package/dist/host/pump-worker.js +10 -3
  33. package/dist/host/pump-worker.js.map +1 -1
  34. package/dist/host/ring.d.ts +6 -0
  35. package/dist/host/ring.js +85 -13
  36. package/dist/host/ring.js.map +1 -1
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/net/preview.d.ts +12 -0
  40. package/dist/net/preview.js +166 -2
  41. package/dist/net/preview.js.map +1 -1
  42. package/dist/pod.js +1 -0
  43. package/dist/pod.js.map +1 -1
  44. package/dist/preview-relay.d.ts +0 -0
  45. package/dist/preview-relay.html +4 -0
  46. package/dist/preview-relay.js +107 -0
  47. package/dist/preview-relay.js.map +1 -0
  48. package/dist/preview-serviceworker.js +11 -5
  49. package/dist/preview-serviceworker.js.map +1 -1
  50. package/dist/testing/index.js +1 -0
  51. package/dist/testing/index.js.map +1 -1
  52. package/dist/types.d.ts +12 -1
  53. package/package.json +7 -4
package/dist/types.d.ts CHANGED
@@ -63,9 +63,15 @@ export interface PodFs {
63
63
  readFile(path: string, encoding: "utf8"): Promise<string>;
64
64
  /** Streams a file in chunks, fetching the next chunk only as it is read. */
65
65
  createReadStream(path: string): ReadableStream<Uint8Array>;
66
- /** Creates or truncates. A stream is written chunk by chunk as it arrives. */
66
+ /**
67
+ * Creates or truncates. A stream is written chunk by chunk as it arrives. `durable` (default
68
+ * true): resolves once the file is on storage, so a reload right after keeps it (the guest
69
+ * fsyncs it and its directory; the shared workspace syncs); `false` leaves that to the guest's
70
+ * writeback (a few seconds), for many small writes.
71
+ */
67
72
  writeFile(path: string, data: Uint8Array | string | ReadableStream<Uint8Array>, options?: {
68
73
  mode?: number;
74
+ durable?: boolean;
69
75
  }): Promise<void>;
70
76
  readdir(path: string): Promise<DirEntry[]>;
71
77
  mkdir(path: string, options?: {
@@ -87,6 +93,11 @@ export interface PodFs {
87
93
  watch(path: string, listener: (events: FsEvent[]) => void, options?: {
88
94
  recursive?: boolean;
89
95
  }): Promise<FsWatcher>;
96
+ /**
97
+ * Everything written so far on storage: a barrier after writes with `durable: false`
98
+ * (`importTar` writes so, then syncs once). Optional: a PodFs without it writes durably.
99
+ */
100
+ sync?(): Promise<void>;
90
101
  }
91
102
  export interface BackendSpawnRequest {
92
103
  command: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpodjs/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Run Linux pods in the browser: boot a QEMU-Wasm guest, run processes, files, networking and snapshots",
5
5
  "keywords": [
6
6
  "webpod",
@@ -32,21 +32,24 @@
32
32
  "default": "./dist/testing/index.js"
33
33
  },
34
34
  "./coi-serviceworker.js": "./dist/coi-serviceworker.js",
35
- "./preview-serviceworker.js": "./dist/preview-serviceworker.js"
35
+ "./preview-serviceworker.js": "./dist/preview-serviceworker.js",
36
+ "./preview-relay.js": "./dist/preview-relay.js",
37
+ "./preview-relay.html": "./dist/preview-relay.html"
36
38
  },
37
39
  "files": [
38
40
  "dist"
39
41
  ],
40
42
  "sideEffects": [
41
43
  "./dist/coi-serviceworker.js",
42
- "./dist/preview-serviceworker.js"
44
+ "./dist/preview-serviceworker.js",
45
+ "./dist/preview-relay.js"
43
46
  ],
44
47
  "publishConfig": {
45
48
  "access": "public"
46
49
  },
47
50
  "scripts": {
48
51
  "prebuild": "node scripts/sync-abi.mjs",
49
- "build": "tsc -p .",
52
+ "build": "tsc -p . && node -e \"require('fs').copyFileSync('src/preview-relay.html','dist/preview-relay.html')\"",
50
53
  "test": "node --test test/*.test.js"
51
54
  }
52
55
  }