@statewalker/webrun-files 0.10.3 → 0.10.5

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.
package/README.md CHANGED
@@ -9,12 +9,13 @@ every implementation follows. It contains no storage backend.
9
9
  ## Why it exists
10
10
 
11
11
  Code that reads and writes files should not care whether the files live in memory, on disk, in a
12
- browser directory, in S3, in SQLite or behind an HTTP endpoint. This package is the contract those
12
+ browser directory, in S3, in SQLite, behind an HTTP endpoint or across an RPC. This package is the contract those
13
13
  backends implement, so application code, tests and decorators are written once against it. Keeping
14
14
  it backend-free means depending on it pulls in nothing runtime-specific.
15
15
 
16
- Backends: `@statewalker/webrun-files-mem`, `-node`, `-browser`, `-s3`, `-sqlite`, `-http`; mounts,
17
- guards and layers: `@statewalker/webrun-files-composite`.
16
+ Backends: `@statewalker/webrun-files-mem`, `-node`, `-browser`, `-s3`, `-sqlite`, `-http`; any
17
+ `FilesApi` over an RPC (Durable Object RPC, postMessage, …): `-rpc`; mounts, guards and layers:
18
+ `@statewalker/webrun-files-composite`.
18
19
 
19
20
  ## How to use
20
21
 
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/file-utils.ts
2
+ // src/file-utils.ts
3
3
  /**
4
4
  * Collect async iterable chunks into a single Uint8Array.
5
5
  */
@@ -88,8 +88,7 @@ async function readAt(files, path, buffer, bufferOffset, length, position) {
88
88
  async function writeText(files, path, content) {
89
89
  await files.write(path, [new TextEncoder().encode(content)]);
90
90
  }
91
- //#endregion
92
- //#region src/list-order.ts
91
+ // src/list-order.ts
93
92
  /**
94
93
  * The order every `FilesApi.list()` yields: paths compared by Unicode code
95
94
  * point, which is the same as comparing their UTF-8 bytes — the order of
@@ -211,8 +210,7 @@ var PathHeap = class {
211
210
  return comparePaths(this.#key(a), this.#key(b)) < 0;
212
211
  }
213
212
  };
214
- //#endregion
215
- //#region src/path-utils.ts
213
+ // src/path-utils.ts
216
214
  /**
217
215
  * Path manipulation utilities for virtual filesystem paths.
218
216
  * All paths use forward slashes and start with "/".
@@ -263,7 +261,6 @@ function extname(path) {
263
261
  if (dotIndex <= 0) return "";
264
262
  return name.substring(dotIndex);
265
263
  }
266
- //#endregion
267
264
  exports.basename = basename;
268
265
  exports.comparePaths = comparePaths;
269
266
  exports.dirname = dirname;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/file-utils.ts
1
+ // src/file-utils.ts
2
2
  /**
3
3
  * Collect async iterable chunks into a single Uint8Array.
4
4
  */
@@ -87,8 +87,7 @@ async function readAt(files, path, buffer, bufferOffset, length, position) {
87
87
  async function writeText(files, path, content) {
88
88
  await files.write(path, [new TextEncoder().encode(content)]);
89
89
  }
90
- //#endregion
91
- //#region src/list-order.ts
90
+ // src/list-order.ts
92
91
  /**
93
92
  * The order every `FilesApi.list()` yields: paths compared by Unicode code
94
93
  * point, which is the same as comparing their UTF-8 bytes — the order of
@@ -210,8 +209,7 @@ var PathHeap = class {
210
209
  return comparePaths(this.#key(a), this.#key(b)) < 0;
211
210
  }
212
211
  };
213
- //#endregion
214
- //#region src/path-utils.ts
212
+ // src/path-utils.ts
215
213
  /**
216
214
  * Path manipulation utilities for virtual filesystem paths.
217
215
  * All paths use forward slashes and start with "/".
@@ -262,5 +260,4 @@ function extname(path) {
262
260
  if (dotIndex <= 0) return "";
263
261
  return name.substring(dotIndex);
264
262
  }
265
- //#endregion
266
263
  export { basename, comparePaths, dirname, extname, joinPath, listInPathOrder, mergeInPathOrder, normalizePath, readAt, readFile, readRange, readText, tryReadFile, tryReadText, writeText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statewalker/webrun-files",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "FilesApi interface and utilities for cross-platform filesystem abstraction",
@@ -38,7 +38,7 @@
38
38
  "rimraf": "^6.1.3",
39
39
  "rolldown": "^1.2.12",
40
40
  "typescript": "^7.0.2",
41
- "vitest": "^5.0.3"
41
+ "vitest": "^4.1.4 || ^5.0.3"
42
42
  },
43
43
  "sideEffects": false,
44
44
  "publishConfig": {