@fireproof/core 0.19.111 → 0.19.112-dev-iife

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 (67) hide show
  1. package/{chunk-OFGPKRCM.js → chunk-D4E6UX6S.js} +3 -8
  2. package/chunk-D4E6UX6S.js.map +1 -0
  3. package/{chunk-WS3YRPIA.js → chunk-OKACCIGZ.js} +15 -29
  4. package/chunk-OKACCIGZ.js.map +1 -0
  5. package/chunk-PZ5AY32C.js +10 -0
  6. package/deno.json +1 -2
  7. package/gateway-3YJXDXD3.js +59 -0
  8. package/gateway-3YJXDXD3.js.map +1 -0
  9. package/{gateway-5FCWPX5W.js → gateway-HUSQCAA7.js} +5 -4
  10. package/gateway-HUSQCAA7.js.map +1 -0
  11. package/index.cjs +64 -274
  12. package/index.cjs.map +1 -1
  13. package/index.d.cts +1 -3
  14. package/index.d.ts +1 -3
  15. package/index.global.js +575 -312
  16. package/index.global.js.map +1 -1
  17. package/index.js +19 -19
  18. package/index.js.map +1 -1
  19. package/{key-bag-file-WADZBHYG.js → key-bag-file-QCOF7UFH.js} +4 -3
  20. package/{key-bag-file-WADZBHYG.js.map → key-bag-file-QCOF7UFH.js.map} +1 -1
  21. package/{key-bag-indexdb-PGVAI3FJ.js → key-bag-indexdb-VHX3MZ66.js} +4 -3
  22. package/{key-bag-indexdb-PGVAI3FJ.js.map → key-bag-indexdb-VHX3MZ66.js.map} +1 -1
  23. package/metafile-cjs.json +1 -1
  24. package/metafile-esm.json +1 -1
  25. package/metafile-iife.json +1 -1
  26. package/node/chunk-4A4RAVNS.js +17 -0
  27. package/node/chunk-4A4RAVNS.js.map +1 -0
  28. package/node/mem-filesystem.cjs +72 -0
  29. package/node/mem-filesystem.cjs.map +1 -0
  30. package/node/mem-filesystem.d.cts +25 -0
  31. package/node/mem-filesystem.d.ts +25 -0
  32. package/{mem-filesystem-YPPJV7Q2.js → node/mem-filesystem.js} +3 -4
  33. package/node/mem-filesystem.js.map +1 -0
  34. package/node/metafile-cjs.json +1 -0
  35. package/node/metafile-esm.json +1 -0
  36. package/node/node-filesystem.cjs +86 -0
  37. package/node/node-filesystem.cjs.map +1 -0
  38. package/node/node-filesystem.d.cts +36 -0
  39. package/node/node-filesystem.d.ts +36 -0
  40. package/{node-filesystem-INX4ZTHE.js → node/node-filesystem.js} +3 -4
  41. package/node/node-filesystem.js.map +1 -0
  42. package/node/types-DARSfXlb.d.cts +23 -0
  43. package/node/types-DARSfXlb.d.ts +23 -0
  44. package/package.json +15 -6
  45. package/tests/blockstore/keyed-crypto.test.ts +2 -2
  46. package/tests/blockstore/store.test.ts +3 -5
  47. package/tests/fireproof/all-gateway.test.ts +11 -9
  48. package/utils-GYG2FMCZ.js +13 -0
  49. package/utils-GYG2FMCZ.js.map +1 -0
  50. package/web/gateway-impl.cjs +319 -0
  51. package/web/gateway-impl.cjs.map +1 -0
  52. package/web/gateway-impl.d.cts +86 -0
  53. package/web/gateway-impl.d.ts +86 -0
  54. package/{gateway-H7UD6TNB.js → web/gateway-impl.js} +165 -20
  55. package/web/gateway-impl.js.map +1 -0
  56. package/web/metafile-cjs.json +1 -0
  57. package/web/metafile-esm.json +1 -0
  58. package/chunk-OFGPKRCM.js.map +0 -1
  59. package/chunk-PB4BKL4O.js +0 -7
  60. package/chunk-PB4BKL4O.js.map +0 -1
  61. package/chunk-WS3YRPIA.js.map +0 -1
  62. package/gateway-5FCWPX5W.js.map +0 -1
  63. package/gateway-H7UD6TNB.js.map +0 -1
  64. package/mem-filesystem-YPPJV7Q2.js.map +0 -1
  65. package/node-filesystem-INX4ZTHE.js.map +0 -1
  66. package/utils-QO2HIWGI.js +0 -14
  67. /package/{utils-QO2HIWGI.js.map → chunk-PZ5AY32C.js.map} +0 -0
@@ -0,0 +1,17 @@
1
+ // src/runtime/gateways/file/node/to-array-buffer.ts
2
+ function toArrayBuffer(buffer) {
3
+ if (typeof buffer === "string") {
4
+ buffer = Buffer.from(buffer);
5
+ }
6
+ const ab = new ArrayBuffer(buffer.length);
7
+ const view = new Uint8Array(ab);
8
+ for (let i = 0; i < buffer.length; ++i) {
9
+ view[i] = buffer[i];
10
+ }
11
+ return view;
12
+ }
13
+
14
+ export {
15
+ toArrayBuffer
16
+ };
17
+ //# sourceMappingURL=chunk-4A4RAVNS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/gateways/file/node/to-array-buffer.ts"],"sourcesContent":["export function toArrayBuffer(buffer: Buffer | string): Uint8Array {\n if (typeof buffer === \"string\") {\n buffer = Buffer.from(buffer);\n }\n const ab = new ArrayBuffer(buffer.length);\n const view = new Uint8Array(ab);\n for (let i = 0; i < buffer.length; ++i) {\n view[i] = buffer[i];\n }\n return view;\n}\n"],"mappings":";AAAO,SAAS,cAAc,QAAqC;AACjE,MAAI,OAAO,WAAW,UAAU;AAC9B,aAAS,OAAO,KAAK,MAAM;AAAA,EAC7B;AACA,QAAM,KAAK,IAAI,YAAY,OAAO,MAAM;AACxC,QAAM,OAAO,IAAI,WAAW,EAAE;AAC9B,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,EAAE,GAAG;AACtC,SAAK,CAAC,IAAI,OAAO,CAAC;AAAA,EACpB;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/runtime/gateways/file/node/mem-filesystem.ts
21
+ var mem_filesystem_exports = {};
22
+ __export(mem_filesystem_exports, {
23
+ MemFileSystem: () => MemFileSystem
24
+ });
25
+ module.exports = __toCommonJS(mem_filesystem_exports);
26
+ var import_memfs = require("memfs");
27
+
28
+ // src/runtime/gateways/file/node/to-array-buffer.ts
29
+ function toArrayBuffer(buffer) {
30
+ if (typeof buffer === "string") {
31
+ buffer = Buffer.from(buffer);
32
+ }
33
+ const ab = new ArrayBuffer(buffer.length);
34
+ const view = new Uint8Array(ab);
35
+ for (let i = 0; i < buffer.length; ++i) {
36
+ view[i] = buffer[i];
37
+ }
38
+ return view;
39
+ }
40
+
41
+ // src/runtime/gateways/file/node/mem-filesystem.ts
42
+ var MemFileSystem = class {
43
+ async start() {
44
+ return this;
45
+ }
46
+ mkdir(path, options) {
47
+ return import_memfs.fs.promises.mkdir(path, options);
48
+ }
49
+ readdir(path, options) {
50
+ return import_memfs.fs.promises.readdir(path, options);
51
+ }
52
+ rm(path, options) {
53
+ return import_memfs.fs.promises.rm(path, options);
54
+ }
55
+ copyFile(source, destination) {
56
+ return import_memfs.fs.promises.copyFile(source, destination);
57
+ }
58
+ async readfile(path, options) {
59
+ const ret = await import_memfs.fs.promises.readFile(path, options);
60
+ return toArrayBuffer(ret);
61
+ }
62
+ stat(path) {
63
+ return import_memfs.fs.promises.stat(path);
64
+ }
65
+ unlink(path) {
66
+ return import_memfs.fs.promises.unlink(path);
67
+ }
68
+ writefile(path, data) {
69
+ return import_memfs.fs.promises.writeFile(path, Buffer.from(data));
70
+ }
71
+ };
72
+ //# sourceMappingURL=mem-filesystem.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/gateways/file/node/mem-filesystem.ts","../../../src/runtime/gateways/file/node/to-array-buffer.ts"],"sourcesContent":["import type { PathLike, MakeDirectoryOptions, Stats } from \"fs\";\nimport { fs } from \"memfs\";\nimport { IReaddirOptions } from \"memfs/lib/node/types/options.js\";\nimport { toArrayBuffer } from \"./to-array-buffer.js\";\nimport type { SysFileSystem } from \"../../../../types.js\";\n\nexport class MemFileSystem implements SysFileSystem {\n async start(): Promise<SysFileSystem> {\n return this;\n }\n mkdir(path: PathLike, options?: { recursive: boolean }): Promise<string | undefined> {\n return fs.promises.mkdir(path, options);\n }\n readdir(path: PathLike, options?: IReaddirOptions): Promise<string[]> {\n return fs.promises.readdir(path, options) as Promise<string[]>;\n }\n rm(path: PathLike, options?: MakeDirectoryOptions & { recursive: boolean }): Promise<void> {\n return fs.promises.rm(path, options);\n }\n copyFile(source: PathLike, destination: PathLike): Promise<void> {\n return fs.promises.copyFile(source, destination);\n }\n async readfile(path: PathLike, options?: { encoding: BufferEncoding; flag?: string }): Promise<Uint8Array> {\n const ret = await fs.promises.readFile(path, options);\n return toArrayBuffer(ret);\n }\n stat(path: PathLike): Promise<Stats> {\n return fs.promises.stat(path) as Promise<Stats>;\n }\n unlink(path: PathLike): Promise<void> {\n return fs.promises.unlink(path);\n }\n writefile(path: PathLike, data: Uint8Array | string): Promise<void> {\n return fs.promises.writeFile(path, Buffer.from(data));\n }\n}\n","export function toArrayBuffer(buffer: Buffer | string): Uint8Array {\n if (typeof buffer === \"string\") {\n buffer = Buffer.from(buffer);\n }\n const ab = new ArrayBuffer(buffer.length);\n const view = new Uint8Array(ab);\n for (let i = 0; i < buffer.length; ++i) {\n view[i] = buffer[i];\n }\n return view;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAmB;;;ACDZ,SAAS,cAAc,QAAqC;AACjE,MAAI,OAAO,WAAW,UAAU;AAC9B,aAAS,OAAO,KAAK,MAAM;AAAA,EAC7B;AACA,QAAM,KAAK,IAAI,YAAY,OAAO,MAAM;AACxC,QAAM,OAAO,IAAI,WAAW,EAAE;AAC9B,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,EAAE,GAAG;AACtC,SAAK,CAAC,IAAI,OAAO,CAAC;AAAA,EACpB;AACA,SAAO;AACT;;;ADJO,IAAM,gBAAN,MAA6C;AAAA,EAClD,MAAM,QAAgC;AACpC,WAAO;AAAA,EACT;AAAA,EACA,MAAM,MAAgB,SAA+D;AACnF,WAAO,gBAAG,SAAS,MAAM,MAAM,OAAO;AAAA,EACxC;AAAA,EACA,QAAQ,MAAgB,SAA8C;AACpE,WAAO,gBAAG,SAAS,QAAQ,MAAM,OAAO;AAAA,EAC1C;AAAA,EACA,GAAG,MAAgB,SAAwE;AACzF,WAAO,gBAAG,SAAS,GAAG,MAAM,OAAO;AAAA,EACrC;AAAA,EACA,SAAS,QAAkB,aAAsC;AAC/D,WAAO,gBAAG,SAAS,SAAS,QAAQ,WAAW;AAAA,EACjD;AAAA,EACA,MAAM,SAAS,MAAgB,SAA4E;AACzG,UAAM,MAAM,MAAM,gBAAG,SAAS,SAAS,MAAM,OAAO;AACpD,WAAO,cAAc,GAAG;AAAA,EAC1B;AAAA,EACA,KAAK,MAAgC;AACnC,WAAO,gBAAG,SAAS,KAAK,IAAI;AAAA,EAC9B;AAAA,EACA,OAAO,MAA+B;AACpC,WAAO,gBAAG,SAAS,OAAO,IAAI;AAAA,EAChC;AAAA,EACA,UAAU,MAAgB,MAA0C;AAClE,WAAO,gBAAG,SAAS,UAAU,MAAM,OAAO,KAAK,IAAI,CAAC;AAAA,EACtD;AACF;","names":[]}
@@ -0,0 +1,25 @@
1
+ import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
2
+ import { IReaddirOptions } from 'memfs/lib/node/types/options.js';
3
+ import { S as SysFileSystem } from './types-DARSfXlb.cjs';
4
+
5
+ declare class MemFileSystem implements SysFileSystem {
6
+ start(): Promise<SysFileSystem>;
7
+ mkdir(path: PathLike, options?: {
8
+ recursive: boolean;
9
+ }): Promise<string | undefined>;
10
+ readdir(path: PathLike, options?: IReaddirOptions): Promise<string[]>;
11
+ rm(path: PathLike, options?: MakeDirectoryOptions & {
12
+ recursive: boolean;
13
+ }): Promise<void>;
14
+ copyFile(source: PathLike, destination: PathLike): Promise<void>;
15
+ readfile(path: PathLike, options?: {
16
+ encoding: BufferEncoding;
17
+ flag?: string;
18
+ }): Promise<Uint8Array>;
19
+ stat(path: PathLike): Promise<Stats>;
20
+ unlink(path: PathLike): Promise<void>;
21
+ writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
22
+ }
23
+
24
+ export { MemFileSystem };
25
+ declare module '@fireproof/core/node'
@@ -0,0 +1,25 @@
1
+ import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
2
+ import { IReaddirOptions } from 'memfs/lib/node/types/options.js';
3
+ import { S as SysFileSystem } from './types-DARSfXlb.js';
4
+
5
+ declare class MemFileSystem implements SysFileSystem {
6
+ start(): Promise<SysFileSystem>;
7
+ mkdir(path: PathLike, options?: {
8
+ recursive: boolean;
9
+ }): Promise<string | undefined>;
10
+ readdir(path: PathLike, options?: IReaddirOptions): Promise<string[]>;
11
+ rm(path: PathLike, options?: MakeDirectoryOptions & {
12
+ recursive: boolean;
13
+ }): Promise<void>;
14
+ copyFile(source: PathLike, destination: PathLike): Promise<void>;
15
+ readfile(path: PathLike, options?: {
16
+ encoding: BufferEncoding;
17
+ flag?: string;
18
+ }): Promise<Uint8Array>;
19
+ stat(path: PathLike): Promise<Stats>;
20
+ unlink(path: PathLike): Promise<void>;
21
+ writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
22
+ }
23
+
24
+ export { MemFileSystem };
25
+ declare module '@fireproof/core/node'
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  toArrayBuffer
3
- } from "./chunk-WS3YRPIA.js";
4
- import "./chunk-OFGPKRCM.js";
3
+ } from "./chunk-4A4RAVNS.js";
5
4
 
6
- // src/runtime/gateways/file/mem-filesystem.ts
5
+ // src/runtime/gateways/file/node/mem-filesystem.ts
7
6
  import { fs } from "memfs";
8
7
  var MemFileSystem = class {
9
8
  async start() {
@@ -38,4 +37,4 @@ var MemFileSystem = class {
38
37
  export {
39
38
  MemFileSystem
40
39
  };
41
- //# sourceMappingURL=mem-filesystem-YPPJV7Q2.js.map
40
+ //# sourceMappingURL=mem-filesystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/gateways/file/node/mem-filesystem.ts"],"sourcesContent":["import type { PathLike, MakeDirectoryOptions, Stats } from \"fs\";\nimport { fs } from \"memfs\";\nimport { IReaddirOptions } from \"memfs/lib/node/types/options.js\";\nimport { toArrayBuffer } from \"./to-array-buffer.js\";\nimport type { SysFileSystem } from \"../../../../types.js\";\n\nexport class MemFileSystem implements SysFileSystem {\n async start(): Promise<SysFileSystem> {\n return this;\n }\n mkdir(path: PathLike, options?: { recursive: boolean }): Promise<string | undefined> {\n return fs.promises.mkdir(path, options);\n }\n readdir(path: PathLike, options?: IReaddirOptions): Promise<string[]> {\n return fs.promises.readdir(path, options) as Promise<string[]>;\n }\n rm(path: PathLike, options?: MakeDirectoryOptions & { recursive: boolean }): Promise<void> {\n return fs.promises.rm(path, options);\n }\n copyFile(source: PathLike, destination: PathLike): Promise<void> {\n return fs.promises.copyFile(source, destination);\n }\n async readfile(path: PathLike, options?: { encoding: BufferEncoding; flag?: string }): Promise<Uint8Array> {\n const ret = await fs.promises.readFile(path, options);\n return toArrayBuffer(ret);\n }\n stat(path: PathLike): Promise<Stats> {\n return fs.promises.stat(path) as Promise<Stats>;\n }\n unlink(path: PathLike): Promise<void> {\n return fs.promises.unlink(path);\n }\n writefile(path: PathLike, data: Uint8Array | string): Promise<void> {\n return fs.promises.writeFile(path, Buffer.from(data));\n }\n}\n"],"mappings":";;;;;AACA,SAAS,UAAU;AAKZ,IAAM,gBAAN,MAA6C;AAAA,EAClD,MAAM,QAAgC;AACpC,WAAO;AAAA,EACT;AAAA,EACA,MAAM,MAAgB,SAA+D;AACnF,WAAO,GAAG,SAAS,MAAM,MAAM,OAAO;AAAA,EACxC;AAAA,EACA,QAAQ,MAAgB,SAA8C;AACpE,WAAO,GAAG,SAAS,QAAQ,MAAM,OAAO;AAAA,EAC1C;AAAA,EACA,GAAG,MAAgB,SAAwE;AACzF,WAAO,GAAG,SAAS,GAAG,MAAM,OAAO;AAAA,EACrC;AAAA,EACA,SAAS,QAAkB,aAAsC;AAC/D,WAAO,GAAG,SAAS,SAAS,QAAQ,WAAW;AAAA,EACjD;AAAA,EACA,MAAM,SAAS,MAAgB,SAA4E;AACzG,UAAM,MAAM,MAAM,GAAG,SAAS,SAAS,MAAM,OAAO;AACpD,WAAO,cAAc,GAAG;AAAA,EAC1B;AAAA,EACA,KAAK,MAAgC;AACnC,WAAO,GAAG,SAAS,KAAK,IAAI;AAAA,EAC9B;AAAA,EACA,OAAO,MAA+B;AACpC,WAAO,GAAG,SAAS,OAAO,IAAI;AAAA,EAChC;AAAA,EACA,UAAU,MAAgB,MAA0C;AAClE,WAAO,GAAG,SAAS,UAAU,MAAM,OAAO,KAAK,IAAI,CAAC;AAAA,EACtD;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/runtime/gateways/file/node/to-array-buffer.ts":{"bytes":313,"imports":[],"format":"esm"},"src/runtime/gateways/file/node/mem-filesystem.ts":{"bytes":1466,"imports":[{"path":"memfs","kind":"import-statement","external":true},{"path":"memfs/lib/node/types/options.js","kind":"import-statement","external":true},{"path":"src/runtime/gateways/file/node/to-array-buffer.ts","kind":"import-statement","original":"./to-array-buffer.js"}],"format":"esm"},"src/runtime/gateways/file/node/node-filesystem.ts":{"bytes":3143,"imports":[{"path":"src/runtime/gateways/file/node/to-array-buffer.ts","kind":"import-statement","original":"./to-array-buffer.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"fs/promises","kind":"dynamic-import","external":true}],"format":"esm"}},"outputs":{"dist/fireproof-core/node/mem-filesystem.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3071},"dist/fireproof-core/node/mem-filesystem.cjs":{"imports":[{"path":"memfs","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/runtime/gateways/file/node/mem-filesystem.ts","inputs":{"src/runtime/gateways/file/node/mem-filesystem.ts":{"bytesInOutput":1016},"src/runtime/gateways/file/node/to-array-buffer.ts":{"bytesInOutput":277}},"bytes":2252},"dist/fireproof-core/node/node-filesystem.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4979},"dist/fireproof-core/node/node-filesystem.cjs":{"imports":[{"path":"@adviser/cement","kind":"require-call","external":true},{"path":"fs/promises","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"src/runtime/gateways/file/node/node-filesystem.ts","inputs":{"src/runtime/gateways/file/node/node-filesystem.ts":{"bytesInOutput":1084},"src/runtime/gateways/file/node/to-array-buffer.ts":{"bytesInOutput":277}},"bytes":2919}}}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/runtime/gateways/file/node/to-array-buffer.ts":{"bytes":313,"imports":[],"format":"esm"},"src/runtime/gateways/file/node/mem-filesystem.ts":{"bytes":1466,"imports":[{"path":"memfs","kind":"import-statement","external":true},{"path":"memfs/lib/node/types/options.js","kind":"import-statement","external":true},{"path":"src/runtime/gateways/file/node/to-array-buffer.ts","kind":"import-statement","original":"./to-array-buffer.js"}],"format":"esm"},"src/runtime/gateways/file/node/node-filesystem.ts":{"bytes":3143,"imports":[{"path":"src/runtime/gateways/file/node/to-array-buffer.ts","kind":"import-statement","original":"./to-array-buffer.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"dynamic-import","external":true}],"format":"esm"}},"outputs":{"dist/fireproof-core/node/mem-filesystem.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2377},"dist/fireproof-core/node/mem-filesystem.js":{"imports":[{"path":"dist/fireproof-core/node/chunk-4A4RAVNS.js","kind":"import-statement"},{"path":"memfs","kind":"import-statement","external":true}],"exports":["MemFileSystem"],"entryPoint":"src/runtime/gateways/file/node/mem-filesystem.ts","inputs":{"src/runtime/gateways/file/node/mem-filesystem.ts":{"bytesInOutput":739}},"bytes":875},"dist/fireproof-core/node/node-filesystem.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4285},"dist/fireproof-core/node/node-filesystem.js":{"imports":[{"path":"dist/fireproof-core/node/chunk-4A4RAVNS.js","kind":"import-statement"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"dynamic-import","external":true}],"exports":["NodeFileSystem"],"entryPoint":"src/runtime/gateways/file/node/node-filesystem.ts","inputs":{"src/runtime/gateways/file/node/node-filesystem.ts":{"bytesInOutput":898}},"bytes":1036},"dist/fireproof-core/node/chunk-4A4RAVNS.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":735},"dist/fireproof-core/node/chunk-4A4RAVNS.js":{"imports":[],"exports":["toArrayBuffer"],"inputs":{"src/runtime/gateways/file/node/to-array-buffer.ts":{"bytesInOutput":277}},"bytes":359}}}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/runtime/gateways/file/node/node-filesystem.ts
31
+ var node_filesystem_exports = {};
32
+ __export(node_filesystem_exports, {
33
+ NodeFileSystem: () => NodeFileSystem
34
+ });
35
+ module.exports = __toCommonJS(node_filesystem_exports);
36
+
37
+ // src/runtime/gateways/file/node/to-array-buffer.ts
38
+ function toArrayBuffer(buffer) {
39
+ if (typeof buffer === "string") {
40
+ buffer = Buffer.from(buffer);
41
+ }
42
+ const ab = new ArrayBuffer(buffer.length);
43
+ const view = new Uint8Array(ab);
44
+ for (let i = 0; i < buffer.length; ++i) {
45
+ view[i] = buffer[i];
46
+ }
47
+ return view;
48
+ }
49
+
50
+ // src/runtime/gateways/file/node/node-filesystem.ts
51
+ var import_cement = require("@adviser/cement");
52
+ var NodeFileSystem = class {
53
+ async start() {
54
+ this.fs = await import("fs/promises");
55
+ return this;
56
+ }
57
+ async mkdir(path, options) {
58
+ return this.fs?.mkdir(path, options);
59
+ }
60
+ async readdir(path, options) {
61
+ return this.fs?.readdir(path, options);
62
+ }
63
+ async rm(path, options) {
64
+ return this.fs?.rm(path, options);
65
+ }
66
+ async copyFile(source, destination) {
67
+ return this.fs?.copyFile(source, destination);
68
+ }
69
+ async readfile(path, options) {
70
+ const ret = await this.fs?.readFile(path, options);
71
+ return toArrayBuffer(ret);
72
+ }
73
+ stat(path) {
74
+ return this.fs?.stat(path);
75
+ }
76
+ async unlink(path) {
77
+ return this.fs?.unlink(path);
78
+ }
79
+ async writefile(path, data) {
80
+ if ((0, import_cement.runtimeFn)().isDeno) {
81
+ return this.fs?.writeFile(path, data);
82
+ }
83
+ return this.fs?.writeFile(path, Buffer.from(data));
84
+ }
85
+ };
86
+ //# sourceMappingURL=node-filesystem.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/gateways/file/node/node-filesystem.ts","../../../src/runtime/gateways/file/node/to-array-buffer.ts"],"sourcesContent":["import type { PathLike, MakeDirectoryOptions, Stats, ObjectEncodingOptions } from \"node:fs\";\nimport type { mkdir, readdir, rm, copyFile, readFile, stat, unlink, writeFile } from \"node:fs/promises\";\nimport { toArrayBuffer } from \"./to-array-buffer.js\";\nimport type { SysFileSystem } from \"../../../../types.js\";\nimport { runtimeFn } from \"@adviser/cement\";\n\nexport class NodeFileSystem implements SysFileSystem {\n fs?: {\n mkdir: typeof mkdir;\n readdir: typeof readdir;\n rm: typeof rm;\n copyFile: typeof copyFile;\n readFile: typeof readFile;\n stat: typeof stat;\n unlink: typeof unlink;\n writeFile: typeof writeFile;\n };\n\n async start(): Promise<SysFileSystem> {\n this.fs = await import(\"node:fs/promises\");\n return this;\n }\n async mkdir(path: PathLike, options?: { recursive: boolean }): Promise<string | undefined> {\n return this.fs?.mkdir(path, options);\n }\n async readdir(path: PathLike, options?: ObjectEncodingOptions): Promise<string[]> {\n return this.fs?.readdir(path, options) as Promise<string[]>;\n }\n async rm(path: PathLike, options?: MakeDirectoryOptions & { recursive: boolean }): Promise<void> {\n return this.fs?.rm(path, options);\n }\n async copyFile(source: PathLike, destination: PathLike): Promise<void> {\n return this.fs?.copyFile(source, destination);\n }\n async readfile(path: PathLike, options?: { encoding: BufferEncoding; flag?: string }): Promise<Uint8Array> {\n const ret = (await this.fs?.readFile(path, options)) as Buffer;\n return toArrayBuffer(ret);\n }\n stat(path: PathLike): Promise<Stats> {\n return this.fs?.stat(path) as Promise<Stats>;\n }\n async unlink(path: PathLike): Promise<void> {\n return this.fs?.unlink(path);\n }\n async writefile(path: PathLike, data: Uint8Array | string): Promise<void> {\n if (runtimeFn().isDeno) {\n return this.fs?.writeFile(path, data);\n }\n return this.fs?.writeFile(path, Buffer.from(data));\n }\n}\n\n// import { type NodeMap, join } from \"../../sys-container.js\";\n// import type { ObjectEncodingOptions, PathLike } from \"fs\";\n// import * as fs from \"fs/promises\";\n// import * as path from \"path\";\n// import * as os from \"os\";\n// import * as url from \"url\";\n// import { toArrayBuffer } from \"./utils.js\";\n\n// export async function createNodeSysContainer(): Promise<NodeMap> {\n// // const nodePath = \"node:path\";\n// // const nodeOS = \"node:os\";\n// // const nodeURL = \"node:url\";\n// // const nodeFS = \"node:fs\";\n// // const fs = (await import(\"node:fs\")).promises;\n// // const assert = \"assert\";\n// // const path = await import(\"node:path\");\n// return {\n// state: \"node\",\n// ...path,\n// // ...(await import(\"node:os\")),\n// // ...(await import(\"node:url\")),\n// ...os,\n// ...url,\n// ...fs,\n// join,\n// stat: fs.stat as NodeMap[\"stat\"],\n// readdir: fs.readdir as NodeMap[\"readdir\"],\n// readfile: async (path: PathLike, options?: ObjectEncodingOptions): Promise<Uint8Array> => {\n// const rs = await fs.readFile(path, options);\n// return toArrayBuffer(rs);\n// },\n// writefile: fs.writeFile as NodeMap[\"writefile\"],\n// };\n// }\n","export function toArrayBuffer(buffer: Buffer | string): Uint8Array {\n if (typeof buffer === \"string\") {\n buffer = Buffer.from(buffer);\n }\n const ab = new ArrayBuffer(buffer.length);\n const view = new Uint8Array(ab);\n for (let i = 0; i < buffer.length; ++i) {\n view[i] = buffer[i];\n }\n return view;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,cAAc,QAAqC;AACjE,MAAI,OAAO,WAAW,UAAU;AAC9B,aAAS,OAAO,KAAK,MAAM;AAAA,EAC7B;AACA,QAAM,KAAK,IAAI,YAAY,OAAO,MAAM;AACxC,QAAM,OAAO,IAAI,WAAW,EAAE;AAC9B,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,EAAE,GAAG;AACtC,SAAK,CAAC,IAAI,OAAO,CAAC;AAAA,EACpB;AACA,SAAO;AACT;;;ADNA,oBAA0B;AAEnB,IAAM,iBAAN,MAA8C;AAAA,EAYnD,MAAM,QAAgC;AACpC,SAAK,KAAK,MAAM,OAAO,aAAkB;AACzC,WAAO;AAAA,EACT;AAAA,EACA,MAAM,MAAM,MAAgB,SAA+D;AACzF,WAAO,KAAK,IAAI,MAAM,MAAM,OAAO;AAAA,EACrC;AAAA,EACA,MAAM,QAAQ,MAAgB,SAAoD;AAChF,WAAO,KAAK,IAAI,QAAQ,MAAM,OAAO;AAAA,EACvC;AAAA,EACA,MAAM,GAAG,MAAgB,SAAwE;AAC/F,WAAO,KAAK,IAAI,GAAG,MAAM,OAAO;AAAA,EAClC;AAAA,EACA,MAAM,SAAS,QAAkB,aAAsC;AACrE,WAAO,KAAK,IAAI,SAAS,QAAQ,WAAW;AAAA,EAC9C;AAAA,EACA,MAAM,SAAS,MAAgB,SAA4E;AACzG,UAAM,MAAO,MAAM,KAAK,IAAI,SAAS,MAAM,OAAO;AAClD,WAAO,cAAc,GAAG;AAAA,EAC1B;AAAA,EACA,KAAK,MAAgC;AACnC,WAAO,KAAK,IAAI,KAAK,IAAI;AAAA,EAC3B;AAAA,EACA,MAAM,OAAO,MAA+B;AAC1C,WAAO,KAAK,IAAI,OAAO,IAAI;AAAA,EAC7B;AAAA,EACA,MAAM,UAAU,MAAgB,MAA0C;AACxE,YAAI,yBAAU,EAAE,QAAQ;AACtB,aAAO,KAAK,IAAI,UAAU,MAAM,IAAI;AAAA,IACtC;AACA,WAAO,KAAK,IAAI,UAAU,MAAM,OAAO,KAAK,IAAI,CAAC;AAAA,EACnD;AACF;","names":[]}
@@ -0,0 +1,36 @@
1
+ import { PathLike, ObjectEncodingOptions, MakeDirectoryOptions, Stats } from 'node:fs';
2
+ import { mkdir, readdir, rm, copyFile, readFile, stat, unlink, writeFile } from 'node:fs/promises';
3
+ import { S as SysFileSystem } from './types-DARSfXlb.cjs';
4
+ import 'fs';
5
+
6
+ declare class NodeFileSystem implements SysFileSystem {
7
+ fs?: {
8
+ mkdir: typeof mkdir;
9
+ readdir: typeof readdir;
10
+ rm: typeof rm;
11
+ copyFile: typeof copyFile;
12
+ readFile: typeof readFile;
13
+ stat: typeof stat;
14
+ unlink: typeof unlink;
15
+ writeFile: typeof writeFile;
16
+ };
17
+ start(): Promise<SysFileSystem>;
18
+ mkdir(path: PathLike, options?: {
19
+ recursive: boolean;
20
+ }): Promise<string | undefined>;
21
+ readdir(path: PathLike, options?: ObjectEncodingOptions): Promise<string[]>;
22
+ rm(path: PathLike, options?: MakeDirectoryOptions & {
23
+ recursive: boolean;
24
+ }): Promise<void>;
25
+ copyFile(source: PathLike, destination: PathLike): Promise<void>;
26
+ readfile(path: PathLike, options?: {
27
+ encoding: BufferEncoding;
28
+ flag?: string;
29
+ }): Promise<Uint8Array>;
30
+ stat(path: PathLike): Promise<Stats>;
31
+ unlink(path: PathLike): Promise<void>;
32
+ writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
33
+ }
34
+
35
+ export { NodeFileSystem };
36
+ declare module '@fireproof/core/node'
@@ -0,0 +1,36 @@
1
+ import { PathLike, ObjectEncodingOptions, MakeDirectoryOptions, Stats } from 'node:fs';
2
+ import { mkdir, readdir, rm, copyFile, readFile, stat, unlink, writeFile } from 'node:fs/promises';
3
+ import { S as SysFileSystem } from './types-DARSfXlb.js';
4
+ import 'fs';
5
+
6
+ declare class NodeFileSystem implements SysFileSystem {
7
+ fs?: {
8
+ mkdir: typeof mkdir;
9
+ readdir: typeof readdir;
10
+ rm: typeof rm;
11
+ copyFile: typeof copyFile;
12
+ readFile: typeof readFile;
13
+ stat: typeof stat;
14
+ unlink: typeof unlink;
15
+ writeFile: typeof writeFile;
16
+ };
17
+ start(): Promise<SysFileSystem>;
18
+ mkdir(path: PathLike, options?: {
19
+ recursive: boolean;
20
+ }): Promise<string | undefined>;
21
+ readdir(path: PathLike, options?: ObjectEncodingOptions): Promise<string[]>;
22
+ rm(path: PathLike, options?: MakeDirectoryOptions & {
23
+ recursive: boolean;
24
+ }): Promise<void>;
25
+ copyFile(source: PathLike, destination: PathLike): Promise<void>;
26
+ readfile(path: PathLike, options?: {
27
+ encoding: BufferEncoding;
28
+ flag?: string;
29
+ }): Promise<Uint8Array>;
30
+ stat(path: PathLike): Promise<Stats>;
31
+ unlink(path: PathLike): Promise<void>;
32
+ writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
33
+ }
34
+
35
+ export { NodeFileSystem };
36
+ declare module '@fireproof/core/node'
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  toArrayBuffer
3
- } from "./chunk-WS3YRPIA.js";
4
- import "./chunk-OFGPKRCM.js";
3
+ } from "./chunk-4A4RAVNS.js";
5
4
 
6
- // src/runtime/gateways/file/node-filesystem.ts
5
+ // src/runtime/gateways/file/node/node-filesystem.ts
7
6
  import { runtimeFn } from "@adviser/cement";
8
7
  var NodeFileSystem = class {
9
8
  async start() {
@@ -42,4 +41,4 @@ var NodeFileSystem = class {
42
41
  export {
43
42
  NodeFileSystem
44
43
  };
45
- //# sourceMappingURL=node-filesystem-INX4ZTHE.js.map
44
+ //# sourceMappingURL=node-filesystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/gateways/file/node/node-filesystem.ts"],"sourcesContent":["import type { PathLike, MakeDirectoryOptions, Stats, ObjectEncodingOptions } from \"node:fs\";\nimport type { mkdir, readdir, rm, copyFile, readFile, stat, unlink, writeFile } from \"node:fs/promises\";\nimport { toArrayBuffer } from \"./to-array-buffer.js\";\nimport type { SysFileSystem } from \"../../../../types.js\";\nimport { runtimeFn } from \"@adviser/cement\";\n\nexport class NodeFileSystem implements SysFileSystem {\n fs?: {\n mkdir: typeof mkdir;\n readdir: typeof readdir;\n rm: typeof rm;\n copyFile: typeof copyFile;\n readFile: typeof readFile;\n stat: typeof stat;\n unlink: typeof unlink;\n writeFile: typeof writeFile;\n };\n\n async start(): Promise<SysFileSystem> {\n this.fs = await import(\"node:fs/promises\");\n return this;\n }\n async mkdir(path: PathLike, options?: { recursive: boolean }): Promise<string | undefined> {\n return this.fs?.mkdir(path, options);\n }\n async readdir(path: PathLike, options?: ObjectEncodingOptions): Promise<string[]> {\n return this.fs?.readdir(path, options) as Promise<string[]>;\n }\n async rm(path: PathLike, options?: MakeDirectoryOptions & { recursive: boolean }): Promise<void> {\n return this.fs?.rm(path, options);\n }\n async copyFile(source: PathLike, destination: PathLike): Promise<void> {\n return this.fs?.copyFile(source, destination);\n }\n async readfile(path: PathLike, options?: { encoding: BufferEncoding; flag?: string }): Promise<Uint8Array> {\n const ret = (await this.fs?.readFile(path, options)) as Buffer;\n return toArrayBuffer(ret);\n }\n stat(path: PathLike): Promise<Stats> {\n return this.fs?.stat(path) as Promise<Stats>;\n }\n async unlink(path: PathLike): Promise<void> {\n return this.fs?.unlink(path);\n }\n async writefile(path: PathLike, data: Uint8Array | string): Promise<void> {\n if (runtimeFn().isDeno) {\n return this.fs?.writeFile(path, data);\n }\n return this.fs?.writeFile(path, Buffer.from(data));\n }\n}\n\n// import { type NodeMap, join } from \"../../sys-container.js\";\n// import type { ObjectEncodingOptions, PathLike } from \"fs\";\n// import * as fs from \"fs/promises\";\n// import * as path from \"path\";\n// import * as os from \"os\";\n// import * as url from \"url\";\n// import { toArrayBuffer } from \"./utils.js\";\n\n// export async function createNodeSysContainer(): Promise<NodeMap> {\n// // const nodePath = \"node:path\";\n// // const nodeOS = \"node:os\";\n// // const nodeURL = \"node:url\";\n// // const nodeFS = \"node:fs\";\n// // const fs = (await import(\"node:fs\")).promises;\n// // const assert = \"assert\";\n// // const path = await import(\"node:path\");\n// return {\n// state: \"node\",\n// ...path,\n// // ...(await import(\"node:os\")),\n// // ...(await import(\"node:url\")),\n// ...os,\n// ...url,\n// ...fs,\n// join,\n// stat: fs.stat as NodeMap[\"stat\"],\n// readdir: fs.readdir as NodeMap[\"readdir\"],\n// readfile: async (path: PathLike, options?: ObjectEncodingOptions): Promise<Uint8Array> => {\n// const rs = await fs.readFile(path, options);\n// return toArrayBuffer(rs);\n// },\n// writefile: fs.writeFile as NodeMap[\"writefile\"],\n// };\n// }\n"],"mappings":";;;;;AAIA,SAAS,iBAAiB;AAEnB,IAAM,iBAAN,MAA8C;AAAA,EAYnD,MAAM,QAAgC;AACpC,SAAK,KAAK,MAAM,OAAO,kBAAkB;AACzC,WAAO;AAAA,EACT;AAAA,EACA,MAAM,MAAM,MAAgB,SAA+D;AACzF,WAAO,KAAK,IAAI,MAAM,MAAM,OAAO;AAAA,EACrC;AAAA,EACA,MAAM,QAAQ,MAAgB,SAAoD;AAChF,WAAO,KAAK,IAAI,QAAQ,MAAM,OAAO;AAAA,EACvC;AAAA,EACA,MAAM,GAAG,MAAgB,SAAwE;AAC/F,WAAO,KAAK,IAAI,GAAG,MAAM,OAAO;AAAA,EAClC;AAAA,EACA,MAAM,SAAS,QAAkB,aAAsC;AACrE,WAAO,KAAK,IAAI,SAAS,QAAQ,WAAW;AAAA,EAC9C;AAAA,EACA,MAAM,SAAS,MAAgB,SAA4E;AACzG,UAAM,MAAO,MAAM,KAAK,IAAI,SAAS,MAAM,OAAO;AAClD,WAAO,cAAc,GAAG;AAAA,EAC1B;AAAA,EACA,KAAK,MAAgC;AACnC,WAAO,KAAK,IAAI,KAAK,IAAI;AAAA,EAC3B;AAAA,EACA,MAAM,OAAO,MAA+B;AAC1C,WAAO,KAAK,IAAI,OAAO,IAAI;AAAA,EAC7B;AAAA,EACA,MAAM,UAAU,MAAgB,MAA0C;AACxE,QAAI,UAAU,EAAE,QAAQ;AACtB,aAAO,KAAK,IAAI,UAAU,MAAM,IAAI;AAAA,IACtC;AACA,WAAO,KAAK,IAAI,UAAU,MAAM,OAAO,KAAK,IAAI,CAAC;AAAA,EACnD;AACF;","names":[]}
@@ -0,0 +1,23 @@
1
+ import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
2
+
3
+ interface SysFileSystem {
4
+ start(): Promise<SysFileSystem>;
5
+ mkdir(path: PathLike, options?: {
6
+ recursive: boolean;
7
+ }): Promise<string | undefined>;
8
+ readdir(path: PathLike, options?: unknown): Promise<string[]>;
9
+ rm(path: PathLike, options?: MakeDirectoryOptions & {
10
+ recursive: boolean;
11
+ }): Promise<void>;
12
+ copyFile(source: PathLike, destination: PathLike): Promise<void>;
13
+ readfile(path: PathLike, options?: {
14
+ encoding: BufferEncoding;
15
+ flag?: string;
16
+ }): Promise<Uint8Array>;
17
+ stat(path: PathLike): Promise<Stats>;
18
+ unlink(path: PathLike): Promise<void>;
19
+ writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
20
+ }
21
+
22
+ export type { SysFileSystem as S };
23
+ declare module '@fireproof/core/node'
@@ -0,0 +1,23 @@
1
+ import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
2
+
3
+ interface SysFileSystem {
4
+ start(): Promise<SysFileSystem>;
5
+ mkdir(path: PathLike, options?: {
6
+ recursive: boolean;
7
+ }): Promise<string | undefined>;
8
+ readdir(path: PathLike, options?: unknown): Promise<string[]>;
9
+ rm(path: PathLike, options?: MakeDirectoryOptions & {
10
+ recursive: boolean;
11
+ }): Promise<void>;
12
+ copyFile(source: PathLike, destination: PathLike): Promise<void>;
13
+ readfile(path: PathLike, options?: {
14
+ encoding: BufferEncoding;
15
+ flag?: string;
16
+ }): Promise<Uint8Array>;
17
+ stat(path: PathLike): Promise<Stats>;
18
+ unlink(path: PathLike): Promise<void>;
19
+ writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
20
+ }
21
+
22
+ export type { SysFileSystem as S };
23
+ declare module '@fireproof/core/node'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireproof/core",
3
- "version": "0.19.111",
3
+ "version": "0.19.112-dev-iife",
4
4
  "description": "Live database for the web.",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -13,6 +13,18 @@
13
13
  "require": "./index.cjs",
14
14
  "script": "./index.global.js",
15
15
  "types": "./index.d.ts"
16
+ },
17
+ "./node": {
18
+ "import": "./index.js",
19
+ "require": "./index.cjs",
20
+ "script": "./index.global.js",
21
+ "types": "./index.d.ts"
22
+ },
23
+ "./web": {
24
+ "import": "./web/index.js",
25
+ "require": "./web/index.cjs",
26
+ "script": "./web/index.global.js",
27
+ "types": "./web/index.d.ts"
16
28
  }
17
29
  },
18
30
  "keywords": [
@@ -42,11 +54,9 @@
42
54
  "url": "https://github.com/fireproof-storage/fireproof/issues"
43
55
  },
44
56
  "devDependencies": {},
45
- "peerDependencies": {
46
- "react": ">=18.0.0"
47
- },
57
+ "peerDependencies": {},
48
58
  "dependencies": {
49
- "@adviser/cement": "^0.2.31",
59
+ "@adviser/cement": "^0.2.36",
50
60
  "multiformats": "^13.3.0",
51
61
  "@ipld/unixfs": "^3.0.0",
52
62
  "@ipld/car": "^5.3.2",
@@ -60,7 +70,6 @@
60
70
  "ipfs-unixfs-exporter": "^13.6.1",
61
71
  "memfs": "^4.12.0",
62
72
  "p-limit": "^6.1.0",
63
- "react": "^18.3.1",
64
73
  "p-map": "^7.0.2",
65
74
  "p-retry": "^6.2.0"
66
75
  },
@@ -96,10 +96,10 @@ describe("KeyBag", () => {
96
96
  const { sysFS } = await p._prepare(name);
97
97
 
98
98
  diskBag = await sysFS.readfile((await p._prepare(name)).fName).then((data) => {
99
- return JSON.parse(new TextDecoder().decode(data)) as rt.kb.KeyItem;
99
+ return JSON.parse(sthis.txt.decode(data)) as rt.kb.KeyItem;
100
100
  });
101
101
  diskBag2 = await sysFS.readfile((await p._prepare(name2)).fName).then((data) => {
102
- return JSON.parse(new TextDecoder().decode(data)) as rt.kb.KeyItem;
102
+ return JSON.parse(sthis.txt.decode(data)) as rt.kb.KeyItem;
103
103
  });
104
104
  }
105
105
  expect(await kb.toKeyWithFingerPrint(diskBag.key)).toEqual(res);
@@ -2,8 +2,6 @@ import { CID } from "multiformats";
2
2
  import { bs, NotFoundError, SuperThis } from "@fireproof/core";
3
3
  import { mockSuperThis } from "../helpers";
4
4
 
5
- const decoder = new TextDecoder("utf-8");
6
-
7
5
  function runtime(sthis: SuperThis) {
8
6
  return bs.toStoreRuntime({}, sthis);
9
7
  }
@@ -46,7 +44,7 @@ describe("DataStore", function () {
46
44
  };
47
45
  await store.save(car);
48
46
  const data = await raw.get(store.url(), car.cid.toString());
49
- expect(decoder.decode(data)).toEqual(decoder.decode(car.bytes));
47
+ expect(sthis.txt.decode(data)).toEqual(sthis.txt.decode(car.bytes));
50
48
  });
51
49
  });
52
50
 
@@ -76,7 +74,7 @@ describe("DataStore with a saved car", function () {
76
74
 
77
75
  it("should have a car", async function () {
78
76
  const data = await raw.get(store.url(), car.cid.toString());
79
- expect(decoder.decode(data)).toEqual(decoder.decode(car.bytes));
77
+ expect(sthis.txt.decode(data)).toEqual(sthis.txt.decode(car.bytes));
80
78
  });
81
79
 
82
80
  it("should load a car", async function () {
@@ -153,7 +151,7 @@ describe("MetaStore with a saved header", function () {
153
151
 
154
152
  it("should have a header", async function () {
155
153
  const bytes = await raw.get(store.url(), "main");
156
- const data = decoder.decode(bytes);
154
+ const data = sthis.txt.decode(bytes);
157
155
  expect(data).toMatch(/parents/);
158
156
  const header = JSON.parse(data)[0];
159
157
  expect(header).toBeDefined();
@@ -2,6 +2,7 @@ import { Database, bs } from "@fireproof/core";
2
2
  import { URI } from "@adviser/cement";
3
3
 
4
4
  import { fileContent } from "./cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js";
5
+ import { mockSuperThis } from "../helpers.js";
5
6
 
6
7
  function customExpect(value: unknown, matcher: (val: unknown) => void, message: string): void {
7
8
  try {
@@ -36,6 +37,8 @@ describe("noop Gateway", function () {
36
37
  let fileGateway: ExtendedGateway;
37
38
  let walGateway: ExtendedGateway;
38
39
 
40
+ const sthis = mockSuperThis();
41
+
39
42
  afterEach(async function () {
40
43
  await db.close();
41
44
  await db.destroy();
@@ -218,8 +221,7 @@ describe("noop Gateway", function () {
218
221
  noLoaderOps: [],
219
222
  fileOperations: [],
220
223
  });
221
- const walEncoder = new TextEncoder();
222
- const walTestData = walEncoder.encode(walTestDataString);
224
+ const walTestData = sthis.txt.encode(walTestDataString);
223
225
  const walPutResult = await walGateway?.put(walUrl?.Ok(), walTestData);
224
226
  expect(walPutResult?.Ok()).toBeFalsy();
225
227
  });
@@ -233,12 +235,11 @@ describe("noop Gateway", function () {
233
235
  noLoaderOps: [],
234
236
  fileOperations: [],
235
237
  });
236
- const walEncoder = new TextEncoder();
237
- const walTestData = walEncoder.encode(walTestDataString);
238
+ const walTestData = sthis.txt.encode(walTestDataString);
238
239
  await walGateway?.put(walUrl?.Ok(), walTestData);
239
240
  const walGetResult = await walGateway?.get(walUrl?.Ok());
240
241
  const okResult = walGetResult?.Ok();
241
- const decodedResult = new TextDecoder().decode(okResult);
242
+ const decodedResult = sthis.txt.decode(okResult);
242
243
  expect(decodedResult).toEqual(walTestDataString);
243
244
  });
244
245
 
@@ -251,8 +252,7 @@ describe("noop Gateway", function () {
251
252
  noLoaderOps: [],
252
253
  fileOperations: [],
253
254
  });
254
- const walEncoder = new TextEncoder();
255
- const walTestData = walEncoder.encode(walTestDataString);
255
+ const walTestData = sthis.txt.encode(walTestDataString);
256
256
  await walGateway?.put(walUrl?.Ok(), walTestData);
257
257
  const walDeleteResult = await walGateway?.delete(walUrl?.Ok());
258
258
  expect(walDeleteResult?.Ok()).toBeFalsy();
@@ -302,6 +302,7 @@ describe("noop Gateway subscribe", function () {
302
302
  let metaStore: ExtendedStore;
303
303
 
304
304
  let metaGateway: ExtendedGateway;
305
+ const sthis = mockSuperThis();
305
306
 
306
307
  afterEach(async function () {
307
308
  await db.close();
@@ -325,7 +326,7 @@ describe("noop Gateway subscribe", function () {
325
326
  resolve = r;
326
327
  });
327
328
  const metaSubscribeResult = await metaGateway?.subscribe?.(metaUrl?.Ok(), async (data: Uint8Array) => {
328
- const decodedData = new TextDecoder().decode(data);
329
+ const decodedData = sthis.txt.decode(data);
329
330
  expect(decodedData).toContain("[]");
330
331
  didCall = true;
331
332
  resolve();
@@ -351,6 +352,7 @@ describe("Gateway", function () {
351
352
  let metaGateway: ExtendedGateway;
352
353
  // let fileGateway: ExtendedGateway;
353
354
  // let walGateway: ExtendedGateway;
355
+ const sthis = mockSuperThis();
354
356
 
355
357
  afterEach(async function () {
356
358
  await db.close();
@@ -380,7 +382,7 @@ describe("Gateway", function () {
380
382
  await metaGateway?.start(metaStore?._url);
381
383
  const metaGetResult = await metaGateway?.get(metaUrl?.Ok());
382
384
  const metaGetResultOk = metaGetResult?.Ok();
383
- const decodedMetaGetResultOk = new TextDecoder().decode(metaGetResultOk);
385
+ const decodedMetaGetResultOk = sthis.txt.decode(metaGetResultOk);
384
386
  expect(decodedMetaGetResultOk).toContain("parents");
385
387
  });
386
388
 
@@ -0,0 +1,13 @@
1
+ import {
2
+ getFileName,
3
+ getFileSystem,
4
+ getPath
5
+ } from "./chunk-OKACCIGZ.js";
6
+ import "./chunk-D4E6UX6S.js";
7
+ import "./chunk-PZ5AY32C.js";
8
+ export {
9
+ getFileName,
10
+ getFileSystem,
11
+ getPath
12
+ };
13
+ //# sourceMappingURL=utils-GYG2FMCZ.js.map