@fireproof/core 0.19.121-dev → 0.19.122
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/deno.json +3 -3
- package/index.cjs +600 -1004
- package/index.cjs.map +1 -1
- package/index.d.cts +26 -60
- package/index.d.ts +26 -60
- package/index.js +392 -97
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/node/index.cjs +374 -0
- package/node/index.cjs.map +1 -0
- package/node/index.d.cts +43 -0
- package/node/index.d.ts +43 -0
- package/node/index.js +279 -0
- package/node/index.js.map +1 -0
- package/node/{mem-filesystem.js → mem-filesystem-LPPT7QV5.js} +1 -1
- package/node/metafile-cjs.json +1 -1
- package/node/metafile-esm.json +1 -1
- package/package.json +17 -15
- package/react/index.cjs +91 -26
- package/react/index.cjs.map +1 -1
- package/react/index.d.cts +16 -1
- package/react/index.d.ts +16 -1
- package/react/index.js +92 -27
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/blockstore/keyed-crypto.test.ts +4 -2
- package/tests/fireproof/config.test.ts +133 -142
- package/web/{gateway-impl.cjs → index.cjs} +58 -9
- package/web/index.cjs.map +1 -0
- package/web/index.d.cts +44 -0
- package/web/index.d.ts +44 -0
- package/web/{gateway-impl.js → index.js} +52 -5
- package/web/index.js.map +1 -0
- package/web/metafile-cjs.json +1 -1
- package/web/metafile-esm.json +1 -1
- package/chunk-7EWIAXTM.js +0 -7
- package/chunk-7EWIAXTM.js.map +0 -1
- package/chunk-F4FC6B2T.js +0 -63
- package/chunk-F4FC6B2T.js.map +0 -1
- package/chunk-PZ5AY32C.js +0 -10
- package/chunk-PZ5AY32C.js.map +0 -1
- package/chunk-RXC4JGJT.js +0 -301
- package/chunk-RXC4JGJT.js.map +0 -1
- package/gateway-C62S56GY.js +0 -66
- package/gateway-C62S56GY.js.map +0 -1
- package/gateway-VVS4QWDA.js +0 -145
- package/gateway-VVS4QWDA.js.map +0 -1
- package/key-bag-file-PWZ3QE7B.js +0 -55
- package/key-bag-file-PWZ3QE7B.js.map +0 -1
- package/key-bag-indexdb-SYG3YD4D.js +0 -51
- package/key-bag-indexdb-SYG3YD4D.js.map +0 -1
- package/node/mem-filesystem.cjs +0 -72
- package/node/mem-filesystem.cjs.map +0 -1
- package/node/mem-filesystem.d.cts +0 -25
- package/node/mem-filesystem.d.ts +0 -25
- package/node/node-filesystem.cjs +0 -86
- package/node/node-filesystem.cjs.map +0 -1
- package/node/node-filesystem.d.cts +0 -35
- package/node/node-filesystem.d.ts +0 -35
- package/node/node-filesystem.js +0 -44
- package/node/node-filesystem.js.map +0 -1
- package/utils-ZVVGAXFE.js +0 -13
- package/utils-ZVVGAXFE.js.map +0 -1
- package/web/gateway-impl.cjs.map +0 -1
- package/web/gateway-impl.d.cts +0 -31
- package/web/gateway-impl.d.ts +0 -31
- package/web/gateway-impl.js.map +0 -1
- /package/node/{mem-filesystem.js.map → mem-filesystem-LPPT7QV5.js.map} +0 -0
package/gateway-VVS4QWDA.js
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
FILESTORE_VERSION
|
3
|
-
} from "./chunk-7EWIAXTM.js";
|
4
|
-
import {
|
5
|
-
getFileName,
|
6
|
-
getFileSystem,
|
7
|
-
getPath
|
8
|
-
} from "./chunk-F4FC6B2T.js";
|
9
|
-
import {
|
10
|
-
NotFoundError,
|
11
|
-
ensureLogger,
|
12
|
-
exceptionWrapper,
|
13
|
-
isNotFoundError
|
14
|
-
} from "./chunk-RXC4JGJT.js";
|
15
|
-
import "./chunk-PZ5AY32C.js";
|
16
|
-
|
17
|
-
// src/runtime/gateways/file/gateway.ts
|
18
|
-
import { exception2Result, KeyedResolvOnce, Result } from "@adviser/cement";
|
19
|
-
var versionFiles = new KeyedResolvOnce();
|
20
|
-
var FileGateway = class {
|
21
|
-
get fs() {
|
22
|
-
if (!this._fs) throw this.logger.Error().Msg("fs not initialized").AsError();
|
23
|
-
return this._fs;
|
24
|
-
}
|
25
|
-
constructor(sthis) {
|
26
|
-
this.sthis = sthis;
|
27
|
-
this.logger = sthis.logger;
|
28
|
-
}
|
29
|
-
async getVersionFromFile(path, logger) {
|
30
|
-
return versionFiles.get(path).once(async () => {
|
31
|
-
await this.fs.mkdir(path, { recursive: true });
|
32
|
-
const vFile = this.sthis.pathOps.join(path, "version");
|
33
|
-
const vFileStat = await this.fs.stat(vFile).catch(() => void 0);
|
34
|
-
if (!vFileStat) {
|
35
|
-
await this.fs.writefile(this.sthis.pathOps.join(path, "version"), FILESTORE_VERSION);
|
36
|
-
return FILESTORE_VERSION;
|
37
|
-
} else if (!vFileStat.isFile()) {
|
38
|
-
throw logger.Error().Str("file", vFile).Msg(`version file is a directory`).AsError();
|
39
|
-
}
|
40
|
-
const v = await this.fs.readfile(vFile);
|
41
|
-
const vStr = this.sthis.txt.decode(v);
|
42
|
-
if (vStr !== FILESTORE_VERSION) {
|
43
|
-
logger.Warn().Str("file", vFile).Str("from", vStr).Str("expected", FILESTORE_VERSION).Msg(`version mismatch`);
|
44
|
-
}
|
45
|
-
return vStr;
|
46
|
-
});
|
47
|
-
}
|
48
|
-
start(baseURL) {
|
49
|
-
return exception2Result(async () => {
|
50
|
-
this._fs = await getFileSystem(baseURL);
|
51
|
-
await this.fs.start();
|
52
|
-
const url = baseURL.build();
|
53
|
-
url.defParam("version", FILESTORE_VERSION);
|
54
|
-
const dbUrl = await this.buildUrl(url.URI(), "dummy");
|
55
|
-
const dbdirFile = this.getFilePath(dbUrl.Ok());
|
56
|
-
await this.fs.mkdir(this.sthis.pathOps.dirname(dbdirFile), { recursive: true });
|
57
|
-
const dbroot = this.sthis.pathOps.dirname(dbdirFile);
|
58
|
-
this.logger.Debug().Url(url.URI()).Str("dbroot", dbroot).Msg("start");
|
59
|
-
url.setParam("version", await this.getVersionFromFile(dbroot, this.logger));
|
60
|
-
return url.URI();
|
61
|
-
});
|
62
|
-
}
|
63
|
-
async buildUrl(baseUrl, key) {
|
64
|
-
return Result.Ok(baseUrl.build().setParam("key", key).URI());
|
65
|
-
}
|
66
|
-
async close() {
|
67
|
-
return Result.Ok(void 0);
|
68
|
-
}
|
69
|
-
// abstract buildUrl(baseUrl: URL, key: string): Promise<Result<URL>>;
|
70
|
-
getFilePath(url) {
|
71
|
-
const key = url.getParam("key");
|
72
|
-
if (!key) throw this.logger.Error().Url(url).Msg(`key not found`).AsError();
|
73
|
-
return this.sthis.pathOps.join(getPath(url, this.sthis), getFileName(url, this.sthis));
|
74
|
-
}
|
75
|
-
async put(url, body) {
|
76
|
-
return exception2Result(async () => {
|
77
|
-
const file = await this.getFilePath(url);
|
78
|
-
this.logger.Debug().Str("url", url.toString()).Str("file", file).Msg("put");
|
79
|
-
await this.fs.writefile(file, body);
|
80
|
-
});
|
81
|
-
}
|
82
|
-
async get(url) {
|
83
|
-
return exceptionWrapper(async () => {
|
84
|
-
const file = this.getFilePath(url);
|
85
|
-
try {
|
86
|
-
const res = await this.fs.readfile(file);
|
87
|
-
this.logger.Debug().Url(url.asURL()).Str("file", file).Msg("get");
|
88
|
-
return Result.Ok(new Uint8Array(res));
|
89
|
-
} catch (e) {
|
90
|
-
if (isNotFoundError(e)) {
|
91
|
-
return Result.Err(new NotFoundError(`file not found: ${file}`));
|
92
|
-
}
|
93
|
-
return Result.Err(e);
|
94
|
-
}
|
95
|
-
});
|
96
|
-
}
|
97
|
-
async delete(url) {
|
98
|
-
return exception2Result(async () => {
|
99
|
-
await this.fs.unlink(this.getFilePath(url));
|
100
|
-
});
|
101
|
-
}
|
102
|
-
async destroy(baseURL) {
|
103
|
-
const url = await this.buildUrl(baseURL, "x");
|
104
|
-
if (url.isErr()) return url;
|
105
|
-
const filepath = this.sthis.pathOps.dirname(this.getFilePath(url.Ok()));
|
106
|
-
let files = [];
|
107
|
-
try {
|
108
|
-
files = await this.fs.readdir(filepath);
|
109
|
-
} catch (e) {
|
110
|
-
if (!isNotFoundError(e)) {
|
111
|
-
throw this.logger.Error().Err(e).Str("dir", filepath).Msg("destroy:readdir").AsError();
|
112
|
-
}
|
113
|
-
}
|
114
|
-
for (const file of files) {
|
115
|
-
const pathed = this.sthis.pathOps.join(filepath, file);
|
116
|
-
try {
|
117
|
-
await this.fs.unlink(pathed);
|
118
|
-
} catch (e) {
|
119
|
-
if (!isNotFoundError(e)) {
|
120
|
-
throw this.logger.Error().Err(e).Str("file", pathed).Msg("destroy:unlink").AsError();
|
121
|
-
}
|
122
|
-
}
|
123
|
-
}
|
124
|
-
return Result.Ok(void 0);
|
125
|
-
}
|
126
|
-
};
|
127
|
-
var FileTestStore = class {
|
128
|
-
constructor(sthis) {
|
129
|
-
this.logger = ensureLogger(sthis, "FileTestStore");
|
130
|
-
this.sthis = sthis;
|
131
|
-
}
|
132
|
-
async get(iurl, key) {
|
133
|
-
const url = iurl.build().setParam("key", key).URI();
|
134
|
-
const dbFile = this.sthis.pathOps.join(getPath(url, this.sthis), getFileName(url, this.sthis));
|
135
|
-
this.logger.Debug().Url(url).Str("dbFile", dbFile).Msg("get");
|
136
|
-
const buffer = await (await getFileSystem(url)).readfile(dbFile);
|
137
|
-
this.logger.Debug().Url(url).Str("dbFile", dbFile).Len(buffer).Msg("got");
|
138
|
-
return buffer;
|
139
|
-
}
|
140
|
-
};
|
141
|
-
export {
|
142
|
-
FileGateway,
|
143
|
-
FileTestStore
|
144
|
-
};
|
145
|
-
//# sourceMappingURL=gateway-VVS4QWDA.js.map
|
package/gateway-VVS4QWDA.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/runtime/gateways/file/gateway.ts"],"sourcesContent":["import { FILESTORE_VERSION } from \"./version.js\";\nimport { exception2Result, KeyedResolvOnce, Logger, Result, URI } from \"@adviser/cement\";\nimport { ensureLogger, exceptionWrapper, isNotFoundError, NotFoundError } from \"../../../utils.js\";\nimport { Gateway, GetResult, TestGateway } from \"../../../blockstore/gateway.js\";\nimport { getFileName, getPath } from \"./utils.js\";\nimport { getFileSystem } from \"./get-file-system-static.js\";\nimport { SuperThis, SysFileSystem } from \"../../../types.js\";\n\nconst versionFiles = new KeyedResolvOnce<string>();\n\nexport class FileGateway implements Gateway {\n // abstract readonly storeType: StoreType;\n readonly logger: Logger;\n readonly sthis: SuperThis;\n\n _fs?: SysFileSystem;\n\n get fs(): SysFileSystem {\n if (!this._fs) throw this.logger.Error().Msg(\"fs not initialized\").AsError();\n return this._fs;\n }\n\n constructor(sthis: SuperThis) {\n this.sthis = sthis;\n this.logger = sthis.logger;\n }\n\n async getVersionFromFile(path: string, logger: Logger): Promise<string> {\n return versionFiles.get(path).once(async () => {\n await this.fs.mkdir(path, { recursive: true });\n const vFile = this.sthis.pathOps.join(path, \"version\");\n const vFileStat = await this.fs.stat(vFile).catch(() => undefined);\n if (!vFileStat) {\n await this.fs.writefile(this.sthis.pathOps.join(path, \"version\"), FILESTORE_VERSION);\n return FILESTORE_VERSION;\n } else if (!vFileStat.isFile()) {\n throw logger.Error().Str(\"file\", vFile).Msg(`version file is a directory`).AsError();\n }\n const v = await this.fs.readfile(vFile);\n const vStr = this.sthis.txt.decode(v);\n if (vStr !== FILESTORE_VERSION) {\n logger.Warn().Str(\"file\", vFile).Str(\"from\", vStr).Str(\"expected\", FILESTORE_VERSION).Msg(`version mismatch`);\n }\n return vStr;\n });\n }\n\n start(baseURL: URI): Promise<Result<URI>> {\n return exception2Result(async () => {\n this._fs = await getFileSystem(baseURL);\n await this.fs.start();\n const url = baseURL.build();\n url.defParam(\"version\", FILESTORE_VERSION);\n // url.defParam(\"store\", this.storeType);\n const dbUrl = await this.buildUrl(url.URI(), \"dummy\");\n const dbdirFile = this.getFilePath(dbUrl.Ok());\n await this.fs.mkdir(this.sthis.pathOps.dirname(dbdirFile), { recursive: true });\n const dbroot = this.sthis.pathOps.dirname(dbdirFile);\n this.logger.Debug().Url(url.URI()).Str(\"dbroot\", dbroot).Msg(\"start\");\n url.setParam(\"version\", await this.getVersionFromFile(dbroot, this.logger));\n return url.URI();\n });\n }\n\n async buildUrl(baseUrl: URI, key: string): Promise<Result<URI>> {\n return Result.Ok(baseUrl.build().setParam(\"key\", key).URI());\n }\n\n async close(): Promise<Result<void>> {\n return Result.Ok(undefined);\n }\n // abstract buildUrl(baseUrl: URL, key: string): Promise<Result<URL>>;\n\n getFilePath(url: URI): string {\n const key = url.getParam(\"key\");\n if (!key) throw this.logger.Error().Url(url).Msg(`key not found`).AsError();\n return this.sthis.pathOps.join(getPath(url, this.sthis), getFileName(url, this.sthis));\n }\n\n async put(url: URI, body: Uint8Array): Promise<Result<void>> {\n return exception2Result(async () => {\n const file = await this.getFilePath(url);\n this.logger.Debug().Str(\"url\", url.toString()).Str(\"file\", file).Msg(\"put\");\n await this.fs.writefile(file, body);\n });\n }\n\n async get(url: URI): Promise<GetResult> {\n return exceptionWrapper(async () => {\n const file = this.getFilePath(url);\n try {\n const res = await this.fs.readfile(file);\n this.logger.Debug().Url(url.asURL()).Str(\"file\", file).Msg(\"get\");\n return Result.Ok(new Uint8Array(res));\n } catch (e: unknown) {\n // this.logger.Error().Err(e).Str(\"file\", file).Msg(\"get\");\n if (isNotFoundError(e)) {\n return Result.Err(new NotFoundError(`file not found: ${file}`));\n }\n return Result.Err(e as Error);\n }\n });\n }\n\n async delete(url: URI): Promise<Result<void>> {\n return exception2Result(async () => {\n await this.fs.unlink(this.getFilePath(url));\n });\n }\n\n async destroy(baseURL: URI): Promise<Result<void>> {\n const url = await this.buildUrl(baseURL, \"x\");\n if (url.isErr()) return url;\n const filepath = this.sthis.pathOps.dirname(this.getFilePath(url.Ok()));\n let files: string[] = [];\n try {\n files = await this.fs.readdir(filepath);\n } catch (e: unknown) {\n if (!isNotFoundError(e)) {\n throw this.logger.Error().Err(e).Str(\"dir\", filepath).Msg(\"destroy:readdir\").AsError();\n }\n }\n for (const file of files) {\n const pathed = this.sthis.pathOps.join(filepath, file);\n try {\n await this.fs.unlink(pathed);\n } catch (e: unknown) {\n if (!isNotFoundError(e)) {\n throw this.logger.Error().Err(e).Str(\"file\", pathed).Msg(\"destroy:unlink\").AsError();\n }\n }\n }\n return Result.Ok(undefined);\n }\n}\n\nexport class FileTestStore implements TestGateway {\n readonly logger: Logger;\n readonly sthis: SuperThis;\n constructor(sthis: SuperThis) {\n this.logger = ensureLogger(sthis, \"FileTestStore\");\n this.sthis = sthis;\n }\n\n async get(iurl: URI, key: string) {\n const url = iurl.build().setParam(\"key\", key).URI();\n const dbFile = this.sthis.pathOps.join(getPath(url, this.sthis), getFileName(url, this.sthis));\n this.logger.Debug().Url(url).Str(\"dbFile\", dbFile).Msg(\"get\");\n const buffer = await (await getFileSystem(url)).readfile(dbFile);\n this.logger.Debug().Url(url).Str(\"dbFile\", dbFile).Len(buffer).Msg(\"got\");\n return buffer;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,SAAS,kBAAkB,iBAAyB,cAAmB;AAOvE,IAAM,eAAe,IAAI,gBAAwB;AAE1C,IAAM,cAAN,MAAqC;AAAA,EAO1C,IAAI,KAAoB;AACtB,QAAI,CAAC,KAAK,IAAK,OAAM,KAAK,OAAO,MAAM,EAAE,IAAI,oBAAoB,EAAE,QAAQ;AAC3E,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,OAAkB;AAC5B,SAAK,QAAQ;AACb,SAAK,SAAS,MAAM;AAAA,EACtB;AAAA,EAEA,MAAM,mBAAmB,MAAc,QAAiC;AACtE,WAAO,aAAa,IAAI,IAAI,EAAE,KAAK,YAAY;AAC7C,YAAM,KAAK,GAAG,MAAM,MAAM,EAAE,WAAW,KAAK,CAAC;AAC7C,YAAM,QAAQ,KAAK,MAAM,QAAQ,KAAK,MAAM,SAAS;AACrD,YAAM,YAAY,MAAM,KAAK,GAAG,KAAK,KAAK,EAAE,MAAM,MAAM,MAAS;AACjE,UAAI,CAAC,WAAW;AACd,cAAM,KAAK,GAAG,UAAU,KAAK,MAAM,QAAQ,KAAK,MAAM,SAAS,GAAG,iBAAiB;AACnF,eAAO;AAAA,MACT,WAAW,CAAC,UAAU,OAAO,GAAG;AAC9B,cAAM,OAAO,MAAM,EAAE,IAAI,QAAQ,KAAK,EAAE,IAAI,6BAA6B,EAAE,QAAQ;AAAA,MACrF;AACA,YAAM,IAAI,MAAM,KAAK,GAAG,SAAS,KAAK;AACtC,YAAM,OAAO,KAAK,MAAM,IAAI,OAAO,CAAC;AACpC,UAAI,SAAS,mBAAmB;AAC9B,eAAO,KAAK,EAAE,IAAI,QAAQ,KAAK,EAAE,IAAI,QAAQ,IAAI,EAAE,IAAI,YAAY,iBAAiB,EAAE,IAAI,kBAAkB;AAAA,MAC9G;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,SAAoC;AACxC,WAAO,iBAAiB,YAAY;AAClC,WAAK,MAAM,MAAM,cAAc,OAAO;AACtC,YAAM,KAAK,GAAG,MAAM;AACpB,YAAM,MAAM,QAAQ,MAAM;AAC1B,UAAI,SAAS,WAAW,iBAAiB;AAEzC,YAAM,QAAQ,MAAM,KAAK,SAAS,IAAI,IAAI,GAAG,OAAO;AACpD,YAAM,YAAY,KAAK,YAAY,MAAM,GAAG,CAAC;AAC7C,YAAM,KAAK,GAAG,MAAM,KAAK,MAAM,QAAQ,QAAQ,SAAS,GAAG,EAAE,WAAW,KAAK,CAAC;AAC9E,YAAM,SAAS,KAAK,MAAM,QAAQ,QAAQ,SAAS;AACnD,WAAK,OAAO,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC,EAAE,IAAI,UAAU,MAAM,EAAE,IAAI,OAAO;AACpE,UAAI,SAAS,WAAW,MAAM,KAAK,mBAAmB,QAAQ,KAAK,MAAM,CAAC;AAC1E,aAAO,IAAI,IAAI;AAAA,IACjB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,SAAS,SAAc,KAAmC;AAC9D,WAAO,OAAO,GAAG,QAAQ,MAAM,EAAE,SAAS,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,EAC7D;AAAA,EAEA,MAAM,QAA+B;AACnC,WAAO,OAAO,GAAG,MAAS;AAAA,EAC5B;AAAA;AAAA,EAGA,YAAY,KAAkB;AAC5B,UAAM,MAAM,IAAI,SAAS,KAAK;AAC9B,QAAI,CAAC,IAAK,OAAM,KAAK,OAAO,MAAM,EAAE,IAAI,GAAG,EAAE,IAAI,eAAe,EAAE,QAAQ;AAC1E,WAAO,KAAK,MAAM,QAAQ,KAAK,QAAQ,KAAK,KAAK,KAAK,GAAG,YAAY,KAAK,KAAK,KAAK,CAAC;AAAA,EACvF;AAAA,EAEA,MAAM,IAAI,KAAU,MAAyC;AAC3D,WAAO,iBAAiB,YAAY;AAClC,YAAM,OAAO,MAAM,KAAK,YAAY,GAAG;AACvC,WAAK,OAAO,MAAM,EAAE,IAAI,OAAO,IAAI,SAAS,CAAC,EAAE,IAAI,QAAQ,IAAI,EAAE,IAAI,KAAK;AAC1E,YAAM,KAAK,GAAG,UAAU,MAAM,IAAI;AAAA,IACpC,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAI,KAA8B;AACtC,WAAO,iBAAiB,YAAY;AAClC,YAAM,OAAO,KAAK,YAAY,GAAG;AACjC,UAAI;AACF,cAAM,MAAM,MAAM,KAAK,GAAG,SAAS,IAAI;AACvC,aAAK,OAAO,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,EAAE,IAAI,QAAQ,IAAI,EAAE,IAAI,KAAK;AAChE,eAAO,OAAO,GAAG,IAAI,WAAW,GAAG,CAAC;AAAA,MACtC,SAAS,GAAY;AAEnB,YAAI,gBAAgB,CAAC,GAAG;AACtB,iBAAO,OAAO,IAAI,IAAI,cAAc,mBAAmB,IAAI,EAAE,CAAC;AAAA,QAChE;AACA,eAAO,OAAO,IAAI,CAAU;AAAA,MAC9B;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,OAAO,KAAiC;AAC5C,WAAO,iBAAiB,YAAY;AAClC,YAAM,KAAK,GAAG,OAAO,KAAK,YAAY,GAAG,CAAC;AAAA,IAC5C,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ,SAAqC;AACjD,UAAM,MAAM,MAAM,KAAK,SAAS,SAAS,GAAG;AAC5C,QAAI,IAAI,MAAM,EAAG,QAAO;AACxB,UAAM,WAAW,KAAK,MAAM,QAAQ,QAAQ,KAAK,YAAY,IAAI,GAAG,CAAC,CAAC;AACtE,QAAI,QAAkB,CAAC;AACvB,QAAI;AACF,cAAQ,MAAM,KAAK,GAAG,QAAQ,QAAQ;AAAA,IACxC,SAAS,GAAY;AACnB,UAAI,CAAC,gBAAgB,CAAC,GAAG;AACvB,cAAM,KAAK,OAAO,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,OAAO,QAAQ,EAAE,IAAI,iBAAiB,EAAE,QAAQ;AAAA,MACvF;AAAA,IACF;AACA,eAAW,QAAQ,OAAO;AACxB,YAAM,SAAS,KAAK,MAAM,QAAQ,KAAK,UAAU,IAAI;AACrD,UAAI;AACF,cAAM,KAAK,GAAG,OAAO,MAAM;AAAA,MAC7B,SAAS,GAAY;AACnB,YAAI,CAAC,gBAAgB,CAAC,GAAG;AACvB,gBAAM,KAAK,OAAO,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,QAAQ,MAAM,EAAE,IAAI,gBAAgB,EAAE,QAAQ;AAAA,QACrF;AAAA,MACF;AAAA,IACF;AACA,WAAO,OAAO,GAAG,MAAS;AAAA,EAC5B;AACF;AAEO,IAAM,gBAAN,MAA2C;AAAA,EAGhD,YAAY,OAAkB;AAC5B,SAAK,SAAS,aAAa,OAAO,eAAe;AACjD,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,MAAM,IAAI,MAAW,KAAa;AAChC,UAAM,MAAM,KAAK,MAAM,EAAE,SAAS,OAAO,GAAG,EAAE,IAAI;AAClD,UAAM,SAAS,KAAK,MAAM,QAAQ,KAAK,QAAQ,KAAK,KAAK,KAAK,GAAG,YAAY,KAAK,KAAK,KAAK,CAAC;AAC7F,SAAK,OAAO,MAAM,EAAE,IAAI,GAAG,EAAE,IAAI,UAAU,MAAM,EAAE,IAAI,KAAK;AAC5D,UAAM,SAAS,OAAO,MAAM,cAAc,GAAG,GAAG,SAAS,MAAM;AAC/D,SAAK,OAAO,MAAM,EAAE,IAAI,GAAG,EAAE,IAAI,UAAU,MAAM,EAAE,IAAI,MAAM,EAAE,IAAI,KAAK;AACxE,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/key-bag-file-PWZ3QE7B.js
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
isNotFoundError
|
3
|
-
} from "./chunk-RXC4JGJT.js";
|
4
|
-
import "./chunk-PZ5AY32C.js";
|
5
|
-
|
6
|
-
// src/runtime/key-bag-file.ts
|
7
|
-
var KeyBagProviderFile = class {
|
8
|
-
async _prepare(id) {
|
9
|
-
await this.sthis.start();
|
10
|
-
let sysFS;
|
11
|
-
switch (this.url.protocol) {
|
12
|
-
case "file:": {
|
13
|
-
const { getFileSystem } = await import("./utils-ZVVGAXFE.js");
|
14
|
-
sysFS = await getFileSystem(this.url);
|
15
|
-
break;
|
16
|
-
}
|
17
|
-
default:
|
18
|
-
throw this.logger.Error().Url(this.url).Msg("unsupported protocol").AsError();
|
19
|
-
}
|
20
|
-
const dirName = this.url.pathname;
|
21
|
-
await sysFS.mkdir(dirName, { recursive: true });
|
22
|
-
return {
|
23
|
-
dirName,
|
24
|
-
sysFS,
|
25
|
-
fName: this.sthis.pathOps.join(dirName, `${id.replace(/[^a-zA-Z0-9]/g, "_")}.json`)
|
26
|
-
};
|
27
|
-
}
|
28
|
-
constructor(url, sthis) {
|
29
|
-
this.url = url;
|
30
|
-
this.sthis = sthis;
|
31
|
-
this.logger = sthis.logger;
|
32
|
-
}
|
33
|
-
async get(id) {
|
34
|
-
const ctx = await this._prepare(id);
|
35
|
-
try {
|
36
|
-
const p = await ctx.sysFS.readfile(ctx.fName);
|
37
|
-
const ki = JSON.parse(this.sthis.txt.decode(p));
|
38
|
-
return ki;
|
39
|
-
} catch (e) {
|
40
|
-
if (isNotFoundError(e)) {
|
41
|
-
return void 0;
|
42
|
-
}
|
43
|
-
throw this.logger.Error().Err(e).Str("file", ctx.dirName).Msg("read bag failed").AsError();
|
44
|
-
}
|
45
|
-
}
|
46
|
-
async set(id, item) {
|
47
|
-
const ctx = await this._prepare(id);
|
48
|
-
const p = this.sthis.txt.encode(JSON.stringify(item, null, 2));
|
49
|
-
await ctx.sysFS.writefile(ctx.fName, p);
|
50
|
-
}
|
51
|
-
};
|
52
|
-
export {
|
53
|
-
KeyBagProviderFile
|
54
|
-
};
|
55
|
-
//# sourceMappingURL=key-bag-file-PWZ3QE7B.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/runtime/key-bag-file.ts"],"sourcesContent":["import { URI } from \"@adviser/cement\";\nimport { isNotFoundError, Logger } from \"../utils.js\";\nimport { KeyBagProvider, KeyItem } from \"./key-bag.js\";\nimport { SuperThis, SysFileSystem } from \"../types.js\";\n\ninterface KeyBagCtx {\n readonly dirName: string;\n readonly sysFS: SysFileSystem;\n readonly fName: string;\n}\n\nexport class KeyBagProviderFile implements KeyBagProvider {\n async _prepare(id: string): Promise<KeyBagCtx> {\n await this.sthis.start();\n let sysFS: SysFileSystem;\n switch (this.url.protocol) {\n case \"file:\": {\n const { getFileSystem } = await import(\"./gateways/file/utils.js\");\n sysFS = await getFileSystem(this.url);\n break;\n }\n default:\n throw this.logger.Error().Url(this.url).Msg(\"unsupported protocol\").AsError();\n }\n const dirName = this.url.pathname;\n await sysFS.mkdir(dirName, { recursive: true });\n return {\n dirName,\n sysFS,\n fName: this.sthis.pathOps.join(dirName, `${id.replace(/[^a-zA-Z0-9]/g, \"_\")}.json`),\n };\n }\n\n private readonly url: URI;\n readonly logger: Logger;\n readonly sthis: SuperThis;\n constructor(url: URI, sthis: SuperThis) {\n this.url = url;\n this.sthis = sthis;\n this.logger = sthis.logger;\n }\n\n async get(id: string): Promise<KeyItem | undefined> {\n const ctx = await this._prepare(id);\n try {\n const p = await ctx.sysFS.readfile(ctx.fName);\n const ki = JSON.parse(this.sthis.txt.decode(p)) as KeyItem;\n return ki;\n } catch (e) {\n if (isNotFoundError(e)) {\n return undefined;\n }\n throw this.logger.Error().Err(e).Str(\"file\", ctx.dirName).Msg(\"read bag failed\").AsError();\n }\n }\n\n async set(id: string, item: KeyItem): Promise<void> {\n const ctx = await this._prepare(id);\n const p = this.sthis.txt.encode(JSON.stringify(item, null, 2));\n await ctx.sysFS.writefile(ctx.fName, p);\n }\n}\n"],"mappings":";;;;;;AAWO,IAAM,qBAAN,MAAmD;AAAA,EACxD,MAAM,SAAS,IAAgC;AAC7C,UAAM,KAAK,MAAM,MAAM;AACvB,QAAI;AACJ,YAAQ,KAAK,IAAI,UAAU;AAAA,MACzB,KAAK,SAAS;AACZ,cAAM,EAAE,cAAc,IAAI,MAAM,OAAO,qBAA0B;AACjE,gBAAQ,MAAM,cAAc,KAAK,GAAG;AACpC;AAAA,MACF;AAAA,MACA;AACE,cAAM,KAAK,OAAO,MAAM,EAAE,IAAI,KAAK,GAAG,EAAE,IAAI,sBAAsB,EAAE,QAAQ;AAAA,IAChF;AACA,UAAM,UAAU,KAAK,IAAI;AACzB,UAAM,MAAM,MAAM,SAAS,EAAE,WAAW,KAAK,CAAC;AAC9C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,OAAO,KAAK,MAAM,QAAQ,KAAK,SAAS,GAAG,GAAG,QAAQ,iBAAiB,GAAG,CAAC,OAAO;AAAA,IACpF;AAAA,EACF;AAAA,EAKA,YAAY,KAAU,OAAkB;AACtC,SAAK,MAAM;AACX,SAAK,QAAQ;AACb,SAAK,SAAS,MAAM;AAAA,EACtB;AAAA,EAEA,MAAM,IAAI,IAA0C;AAClD,UAAM,MAAM,MAAM,KAAK,SAAS,EAAE;AAClC,QAAI;AACF,YAAM,IAAI,MAAM,IAAI,MAAM,SAAS,IAAI,KAAK;AAC5C,YAAM,KAAK,KAAK,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC;AAC9C,aAAO;AAAA,IACT,SAAS,GAAG;AACV,UAAI,gBAAgB,CAAC,GAAG;AACtB,eAAO;AAAA,MACT;AACA,YAAM,KAAK,OAAO,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,QAAQ,IAAI,OAAO,EAAE,IAAI,iBAAiB,EAAE,QAAQ;AAAA,IAC3F;AAAA,EACF;AAAA,EAEA,MAAM,IAAI,IAAY,MAA8B;AAClD,UAAM,MAAM,MAAM,KAAK,SAAS,EAAE;AAClC,UAAM,IAAI,KAAK,MAAM,IAAI,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;AAC7D,UAAM,IAAI,MAAM,UAAU,IAAI,OAAO,CAAC;AAAA,EACxC;AACF;","names":[]}
|
@@ -1,51 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
getPath
|
3
|
-
} from "./chunk-F4FC6B2T.js";
|
4
|
-
import "./chunk-RXC4JGJT.js";
|
5
|
-
import "./chunk-PZ5AY32C.js";
|
6
|
-
|
7
|
-
// src/runtime/key-bag-indexdb.ts
|
8
|
-
import { openDB } from "idb";
|
9
|
-
import { ResolveOnce } from "@adviser/cement";
|
10
|
-
var KeyBagProviderIndexDB = class {
|
11
|
-
constructor(url, sthis) {
|
12
|
-
this._db = new ResolveOnce();
|
13
|
-
this.sthis = sthis;
|
14
|
-
this.logger = sthis.logger;
|
15
|
-
this.url = url;
|
16
|
-
this.dbName = getPath(this.url, this.sthis);
|
17
|
-
}
|
18
|
-
async _prepare() {
|
19
|
-
return this._db.once(async () => {
|
20
|
-
return await openDB(this.dbName, 1, {
|
21
|
-
upgrade(db) {
|
22
|
-
["bag"].map((store) => {
|
23
|
-
db.createObjectStore(store, {
|
24
|
-
autoIncrement: false
|
25
|
-
});
|
26
|
-
});
|
27
|
-
}
|
28
|
-
});
|
29
|
-
});
|
30
|
-
}
|
31
|
-
async get(id) {
|
32
|
-
const db = await this._prepare();
|
33
|
-
const tx = db.transaction(["bag"], "readonly");
|
34
|
-
const keyItem = await tx.objectStore("bag").get(id);
|
35
|
-
await tx.done;
|
36
|
-
if (!keyItem) {
|
37
|
-
return void 0;
|
38
|
-
}
|
39
|
-
return keyItem;
|
40
|
-
}
|
41
|
-
async set(id, item) {
|
42
|
-
const db = await this._prepare();
|
43
|
-
const tx = db.transaction(["bag"], "readwrite");
|
44
|
-
await tx.objectStore("bag").put(item, id);
|
45
|
-
await tx.done;
|
46
|
-
}
|
47
|
-
};
|
48
|
-
export {
|
49
|
-
KeyBagProviderIndexDB
|
50
|
-
};
|
51
|
-
//# sourceMappingURL=key-bag-indexdb-SYG3YD4D.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/runtime/key-bag-indexdb.ts"],"sourcesContent":["import { IDBPDatabase, openDB } from \"idb\";\nimport { KeyBagProvider, KeyItem } from \"./key-bag.js\";\nimport { getPath } from \"./gateways/file/utils.js\";\nimport { Logger, ResolveOnce, URI } from \"@adviser/cement\";\nimport type { SuperThis } from \"../types.js\";\n\nexport class KeyBagProviderIndexDB implements KeyBagProvider {\n readonly _db: ResolveOnce<IDBPDatabase<unknown>> = new ResolveOnce<IDBPDatabase<unknown>>();\n\n readonly dbName: string;\n readonly url: URI;\n readonly logger: Logger;\n readonly sthis: SuperThis;\n constructor(url: URI, sthis: SuperThis) {\n this.sthis = sthis;\n this.logger = sthis.logger;\n this.url = url;\n this.dbName = getPath(this.url, this.sthis);\n }\n\n async _prepare(): Promise<IDBPDatabase<unknown>> {\n return this._db.once(async () => {\n return await openDB(this.dbName, 1, {\n upgrade(db) {\n // console.log('upgrade:', dbName);\n [\"bag\"].map((store) => {\n db.createObjectStore(store, {\n autoIncrement: false,\n });\n });\n },\n });\n });\n }\n\n async get(id: string): Promise<KeyItem | undefined> {\n const db = await this._prepare();\n const tx = db.transaction([\"bag\"], \"readonly\");\n const keyItem = await tx.objectStore(\"bag\").get(id);\n await tx.done;\n if (!keyItem) {\n return undefined;\n }\n return keyItem;\n }\n\n async set(id: string, item: KeyItem): Promise<void> {\n const db = await this._prepare();\n const tx = db.transaction([\"bag\"], \"readwrite\");\n await tx.objectStore(\"bag\").put(item, id);\n await tx.done;\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAuB,cAAc;AAGrC,SAAiB,mBAAwB;AAGlC,IAAM,wBAAN,MAAsD;AAAA,EAO3D,YAAY,KAAU,OAAkB;AANxC,SAAS,MAA0C,IAAI,YAAmC;AAOxF,SAAK,QAAQ;AACb,SAAK,SAAS,MAAM;AACpB,SAAK,MAAM;AACX,SAAK,SAAS,QAAQ,KAAK,KAAK,KAAK,KAAK;AAAA,EAC5C;AAAA,EAEA,MAAM,WAA2C;AAC/C,WAAO,KAAK,IAAI,KAAK,YAAY;AAC/B,aAAO,MAAM,OAAO,KAAK,QAAQ,GAAG;AAAA,QAClC,QAAQ,IAAI;AAEV,WAAC,KAAK,EAAE,IAAI,CAAC,UAAU;AACrB,eAAG,kBAAkB,OAAO;AAAA,cAC1B,eAAe;AAAA,YACjB,CAAC;AAAA,UACH,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAI,IAA0C;AAClD,UAAM,KAAK,MAAM,KAAK,SAAS;AAC/B,UAAM,KAAK,GAAG,YAAY,CAAC,KAAK,GAAG,UAAU;AAC7C,UAAM,UAAU,MAAM,GAAG,YAAY,KAAK,EAAE,IAAI,EAAE;AAClD,UAAM,GAAG;AACT,QAAI,CAAC,SAAS;AACZ,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,IAAI,IAAY,MAA8B;AAClD,UAAM,KAAK,MAAM,KAAK,SAAS;AAC/B,UAAM,KAAK,GAAG,YAAY,CAAC,KAAK,GAAG,WAAW;AAC9C,UAAM,GAAG,YAAY,KAAK,EAAE,IAAI,MAAM,EAAE;AACxC,UAAM,GAAG;AAAA,EACX;AACF;","names":[]}
|
package/node/mem-filesystem.cjs
DELETED
@@ -1,72 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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 \"@fireproof/core\";\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":[]}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
|
2
|
-
import { IReaddirOptions } from 'memfs/lib/node/types/options.js';
|
3
|
-
import { SysFileSystem } from '@fireproof/core';
|
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'
|
package/node/mem-filesystem.d.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
|
2
|
-
import { IReaddirOptions } from 'memfs/lib/node/types/options.js';
|
3
|
-
import { SysFileSystem } from '@fireproof/core';
|
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'
|
package/node/node-filesystem.cjs
DELETED
@@ -1,86 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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 \"@fireproof/core\";\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":[]}
|
@@ -1,35 +0,0 @@
|
|
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 { SysFileSystem } from '@fireproof/core';
|
4
|
-
|
5
|
-
declare class NodeFileSystem implements SysFileSystem {
|
6
|
-
fs?: {
|
7
|
-
mkdir: typeof mkdir;
|
8
|
-
readdir: typeof readdir;
|
9
|
-
rm: typeof rm;
|
10
|
-
copyFile: typeof copyFile;
|
11
|
-
readFile: typeof readFile;
|
12
|
-
stat: typeof stat;
|
13
|
-
unlink: typeof unlink;
|
14
|
-
writeFile: typeof writeFile;
|
15
|
-
};
|
16
|
-
start(): Promise<SysFileSystem>;
|
17
|
-
mkdir(path: PathLike, options?: {
|
18
|
-
recursive: boolean;
|
19
|
-
}): Promise<string | undefined>;
|
20
|
-
readdir(path: PathLike, options?: ObjectEncodingOptions): Promise<string[]>;
|
21
|
-
rm(path: PathLike, options?: MakeDirectoryOptions & {
|
22
|
-
recursive: boolean;
|
23
|
-
}): Promise<void>;
|
24
|
-
copyFile(source: PathLike, destination: PathLike): Promise<void>;
|
25
|
-
readfile(path: PathLike, options?: {
|
26
|
-
encoding: BufferEncoding;
|
27
|
-
flag?: string;
|
28
|
-
}): Promise<Uint8Array>;
|
29
|
-
stat(path: PathLike): Promise<Stats>;
|
30
|
-
unlink(path: PathLike): Promise<void>;
|
31
|
-
writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
|
32
|
-
}
|
33
|
-
|
34
|
-
export { NodeFileSystem };
|
35
|
-
declare module '@fireproof/core/node'
|
@@ -1,35 +0,0 @@
|
|
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 { SysFileSystem } from '@fireproof/core';
|
4
|
-
|
5
|
-
declare class NodeFileSystem implements SysFileSystem {
|
6
|
-
fs?: {
|
7
|
-
mkdir: typeof mkdir;
|
8
|
-
readdir: typeof readdir;
|
9
|
-
rm: typeof rm;
|
10
|
-
copyFile: typeof copyFile;
|
11
|
-
readFile: typeof readFile;
|
12
|
-
stat: typeof stat;
|
13
|
-
unlink: typeof unlink;
|
14
|
-
writeFile: typeof writeFile;
|
15
|
-
};
|
16
|
-
start(): Promise<SysFileSystem>;
|
17
|
-
mkdir(path: PathLike, options?: {
|
18
|
-
recursive: boolean;
|
19
|
-
}): Promise<string | undefined>;
|
20
|
-
readdir(path: PathLike, options?: ObjectEncodingOptions): Promise<string[]>;
|
21
|
-
rm(path: PathLike, options?: MakeDirectoryOptions & {
|
22
|
-
recursive: boolean;
|
23
|
-
}): Promise<void>;
|
24
|
-
copyFile(source: PathLike, destination: PathLike): Promise<void>;
|
25
|
-
readfile(path: PathLike, options?: {
|
26
|
-
encoding: BufferEncoding;
|
27
|
-
flag?: string;
|
28
|
-
}): Promise<Uint8Array>;
|
29
|
-
stat(path: PathLike): Promise<Stats>;
|
30
|
-
unlink(path: PathLike): Promise<void>;
|
31
|
-
writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
|
32
|
-
}
|
33
|
-
|
34
|
-
export { NodeFileSystem };
|
35
|
-
declare module '@fireproof/core/node'
|
package/node/node-filesystem.js
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
toArrayBuffer
|
3
|
-
} from "./chunk-4A4RAVNS.js";
|
4
|
-
|
5
|
-
// src/runtime/gateways/file/node/node-filesystem.ts
|
6
|
-
import { runtimeFn } from "@adviser/cement";
|
7
|
-
var NodeFileSystem = class {
|
8
|
-
async start() {
|
9
|
-
this.fs = await import("node:fs/promises");
|
10
|
-
return this;
|
11
|
-
}
|
12
|
-
async mkdir(path, options) {
|
13
|
-
return this.fs?.mkdir(path, options);
|
14
|
-
}
|
15
|
-
async readdir(path, options) {
|
16
|
-
return this.fs?.readdir(path, options);
|
17
|
-
}
|
18
|
-
async rm(path, options) {
|
19
|
-
return this.fs?.rm(path, options);
|
20
|
-
}
|
21
|
-
async copyFile(source, destination) {
|
22
|
-
return this.fs?.copyFile(source, destination);
|
23
|
-
}
|
24
|
-
async readfile(path, options) {
|
25
|
-
const ret = await this.fs?.readFile(path, options);
|
26
|
-
return toArrayBuffer(ret);
|
27
|
-
}
|
28
|
-
stat(path) {
|
29
|
-
return this.fs?.stat(path);
|
30
|
-
}
|
31
|
-
async unlink(path) {
|
32
|
-
return this.fs?.unlink(path);
|
33
|
-
}
|
34
|
-
async writefile(path, data) {
|
35
|
-
if (runtimeFn().isDeno) {
|
36
|
-
return this.fs?.writeFile(path, data);
|
37
|
-
}
|
38
|
-
return this.fs?.writeFile(path, Buffer.from(data));
|
39
|
-
}
|
40
|
-
};
|
41
|
-
export {
|
42
|
-
NodeFileSystem
|
43
|
-
};
|
44
|
-
//# sourceMappingURL=node-filesystem.js.map
|
@@ -1 +0,0 @@
|
|
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 \"@fireproof/core\";\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":[]}
|