@auto-engineer/file-store 0.1.0
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/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-test.log +19 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/LICENSE +10 -0
- package/dist/src/LightningFileStore.d.ts +16 -0
- package/dist/src/LightningFileStore.d.ts.map +1 -0
- package/dist/src/LightningFileStore.js +74 -0
- package/dist/src/LightningFileStore.js.map +1 -0
- package/dist/src/LightningFileStore.specs.d.ts +2 -0
- package/dist/src/LightningFileStore.specs.d.ts.map +1 -0
- package/dist/src/LightningFileStore.specs.js +86 -0
- package/dist/src/LightningFileStore.specs.js.map +1 -0
- package/dist/src/NodeFileStore.d.ts +12 -0
- package/dist/src/NodeFileStore.d.ts.map +1 -0
- package/dist/src/NodeFileStore.js +70 -0
- package/dist/src/NodeFileStore.js.map +1 -0
- package/dist/src/NodeFileStore.specs.d.ts +2 -0
- package/dist/src/NodeFileStore.specs.d.ts.map +1 -0
- package/dist/src/NodeFileStore.specs.js +66 -0
- package/dist/src/NodeFileStore.specs.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/path.d.ts +4 -0
- package/dist/src/path.d.ts.map +1 -0
- package/dist/src/path.js +15 -0
- package/dist/src/path.js.map +1 -0
- package/dist/src/text-helpers.d.ts +7 -0
- package/dist/src/text-helpers.d.ts.map +1 -0
- package/dist/src/text-helpers.js +9 -0
- package/dist/src/text-helpers.js.map +1 -0
- package/dist/src/types.d.ts +11 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +45 -0
- package/src/LightningFileStore.specs.ts +109 -0
- package/src/LightningFileStore.ts +95 -0
- package/src/NodeFileStore.specs.ts +84 -0
- package/src/NodeFileStore.ts +75 -0
- package/src/index.ts +3 -0
- package/src/path.ts +15 -0
- package/src/text-helpers.ts +16 -0
- package/src/types.ts +6 -0
- package/tsconfig.json +11 -0
- package/tsconfig.test.json +8 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
> @auto-engineer/file-store@0.1.0 test /home/runner/work/auto-engineer/auto-engineer/packages/file-store
|
|
3
|
+
> vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[1m[46m RUN [49m[22m [36mv3.2.4 [39m[90m/home/runner/work/auto-engineer/auto-engineer/packages/file-store[39m
|
|
7
|
+
|
|
8
|
+
[32m✓[39m src/NodeFileStore.specs.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 111[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/LightningFileStore.specs.ts [2m([22m[2m5 tests[22m[2m)[22m[33m 2086[2mms[22m[39m
|
|
10
|
+
[33m[2m✓[22m[39m LightningFS FileStore (basic ops)[2m > [22mchecks file existence [33m 500[2mms[22m[39m
|
|
11
|
+
[33m[2m✓[22m[39m LightningFS FileStore (basic ops)[2m > [22msupports nested directories (mkdir -p style) for write/read [33m 513[2mms[22m[39m
|
|
12
|
+
[33m[2m✓[22m[39m LightningFS FileStore (basic ops)[2m > [22mlists directory contents via listTree() [33m 569[2mms[22m[39m
|
|
13
|
+
[33m[2m✓[22m[39m LightningFS FileStore (complex structure)[2m > [22mcreates and verifies a multi-level project layout [33m 451[2mms[22m[39m
|
|
14
|
+
|
|
15
|
+
[2m Test Files [22m [1m[32m2 passed[39m[22m[90m (2)[39m
|
|
16
|
+
[2m Tests [22m [1m[32m10 passed[39m[22m[90m (10)[39m
|
|
17
|
+
[2m Start at [22m 14:45:43
|
|
18
|
+
[2m Duration [22m 6.28s[2m (transform 449ms, setup 0ms, collect 466ms, tests 2.20s, environment 2.60s, prepare 951ms)[22m
|
|
19
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright 2024 Sam Hatoum
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are licensed under the Elastic License 2.0 (the "License"). You may not use this file except in compliance with the License.
|
|
6
|
+
|
|
7
|
+
You may obtain a copy of the License at:
|
|
8
|
+
https://www.elastic.co/licensing/elastic-license
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IFileStore } from './types';
|
|
2
|
+
export declare class LightningFileStore implements IFileStore {
|
|
3
|
+
private fs;
|
|
4
|
+
private pfs;
|
|
5
|
+
constructor(name?: string);
|
|
6
|
+
write(path: string, data: Uint8Array): Promise<void>;
|
|
7
|
+
read(path: string): Promise<Uint8Array | null>;
|
|
8
|
+
exists(path: string): Promise<boolean>;
|
|
9
|
+
listTree(root?: string): Promise<Array<{
|
|
10
|
+
path: string;
|
|
11
|
+
type: 'file' | 'dir';
|
|
12
|
+
size: number;
|
|
13
|
+
}>>;
|
|
14
|
+
private mkdirp;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=LightningFileStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightningFileStore.d.ts","sourceRoot":"","sources":["../../src/LightningFileStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAoB1C,qBAAa,kBAAmB,YAAW,UAAU;IACnD,OAAO,CAAC,EAAE,CAAsB;IAChC,OAAO,CAAC,GAAG,CAAsB;gBAErB,IAAI,SAAU;IAKpB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAQ9C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOtC,QAAQ,CAAC,IAAI,GAAE,MAAY,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;YA+B1F,MAAM;CAarB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import LightningFS from '@isomorphic-git/lightning-fs';
|
|
2
|
+
import { dirname } from './path.js';
|
|
3
|
+
export class LightningFileStore {
|
|
4
|
+
constructor(name = 'pocfs') {
|
|
5
|
+
this.fs = new LightningFS(name);
|
|
6
|
+
this.pfs = this.fs.promises;
|
|
7
|
+
}
|
|
8
|
+
async write(path, data) {
|
|
9
|
+
await this.mkdirp(dirname(path));
|
|
10
|
+
await this.pfs.writeFile(path, data);
|
|
11
|
+
}
|
|
12
|
+
async read(path) {
|
|
13
|
+
try {
|
|
14
|
+
return await this.pfs.readFile(path);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async exists(path) {
|
|
21
|
+
return await this.pfs
|
|
22
|
+
.stat(path)
|
|
23
|
+
.then(() => true)
|
|
24
|
+
.catch(() => false);
|
|
25
|
+
}
|
|
26
|
+
async listTree(root = '/') {
|
|
27
|
+
const out = [];
|
|
28
|
+
const walk = async (p) => {
|
|
29
|
+
let st = null;
|
|
30
|
+
try {
|
|
31
|
+
st = await this.pfs.stat(p);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (st !== null && st.isDirectory()) {
|
|
37
|
+
out.push({ path: p, type: 'dir', size: 0 });
|
|
38
|
+
let entries = [];
|
|
39
|
+
try {
|
|
40
|
+
entries = await this.pfs.readdir(p);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
/* ignore */
|
|
44
|
+
}
|
|
45
|
+
for (const name of entries) {
|
|
46
|
+
const child = p === '/' ? `/${name}` : `${p}/${name}`;
|
|
47
|
+
await walk(child);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
out.push({ path: p, type: 'file', size: st?.size ?? 0 });
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
await walk(root);
|
|
55
|
+
out.sort((a, b) => (a.type === b.type ? a.path.localeCompare(b.path) : a.type === 'dir' ? -1 : 1));
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
async mkdirp(path) {
|
|
59
|
+
if (!path || path === '/')
|
|
60
|
+
return;
|
|
61
|
+
const parts = path.split('/').filter(Boolean);
|
|
62
|
+
let cur = '';
|
|
63
|
+
for (const part of parts) {
|
|
64
|
+
cur += '/' + part;
|
|
65
|
+
const exists = await this.pfs
|
|
66
|
+
.stat(cur)
|
|
67
|
+
.then(() => true)
|
|
68
|
+
.catch(() => false);
|
|
69
|
+
if (!exists)
|
|
70
|
+
await this.pfs.mkdir(cur);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=LightningFileStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightningFileStore.js","sourceRoot":"","sources":["../../src/LightningFileStore.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAmBjC,MAAM,OAAO,kBAAkB;IAI7B,YAAY,IAAI,GAAG,OAAO;QACxB,IAAI,CAAC,EAAE,GAAG,IAAI,WAAW,CAAC,IAAI,CAAwB,CAAC;QACvD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,QAAQ,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;YACzB,GAAG,IAAI,GAAG,GAAG,IAAI,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG;iBAC1B,IAAI,CAAC,GAAG,CAAC;iBACT,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;iBAChB,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YACtB,IAAI,CAAC,MAAM;gBAAE,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightningFileStore.specs.d.ts","sourceRoot":"","sources":["../../src/LightningFileStore.specs.ts"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
3
|
+
import 'fake-indexeddb/auto';
|
|
4
|
+
import { LightningFileStore } from './LightningFileStore.js';
|
|
5
|
+
const te = new TextEncoder();
|
|
6
|
+
const td = new TextDecoder();
|
|
7
|
+
const resetIDBs = async () => await new Promise((res, rej) => {
|
|
8
|
+
const dbs = ['flowfs-test', 'flowfs-complex-test'];
|
|
9
|
+
let done = 0;
|
|
10
|
+
for (const name of dbs) {
|
|
11
|
+
const req = indexedDB.deleteDatabase(name);
|
|
12
|
+
req.onerror = () => rej(req.error);
|
|
13
|
+
req.onsuccess = () => {
|
|
14
|
+
done += 1;
|
|
15
|
+
if (done === dbs.length)
|
|
16
|
+
res();
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
beforeEach(async () => {
|
|
21
|
+
await resetIDBs();
|
|
22
|
+
});
|
|
23
|
+
describe('LightningFS FileStore (basic ops)', () => {
|
|
24
|
+
it('writes and reads a file', async () => {
|
|
25
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
26
|
+
await fs.write('/test.txt', te.encode('hello world'));
|
|
27
|
+
const buf = await fs.read('/test.txt');
|
|
28
|
+
expect(buf).not.toBeNull();
|
|
29
|
+
expect(td.decode(buf)).toBe('hello world');
|
|
30
|
+
});
|
|
31
|
+
it('checks file existence', async () => {
|
|
32
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
33
|
+
await fs.write('/exists.txt', te.encode('ok'));
|
|
34
|
+
expect(await fs.exists('/exists.txt')).toBe(true);
|
|
35
|
+
expect(await fs.exists('/missing.txt')).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
it('supports nested directories (mkdir -p style) for write/read', async () => {
|
|
38
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
39
|
+
await fs.write('/nested/deep/file.txt', te.encode('nested content'));
|
|
40
|
+
const buf = await fs.read('/nested/deep/file.txt');
|
|
41
|
+
expect(buf).not.toBeNull();
|
|
42
|
+
expect(td.decode(buf)).toBe('nested content');
|
|
43
|
+
});
|
|
44
|
+
it('lists directory contents via listTree()', async () => {
|
|
45
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
46
|
+
await fs.write('/a.txt', te.encode('a'));
|
|
47
|
+
await fs.write('/dir/b.txt', te.encode('b'));
|
|
48
|
+
const tree = await fs.listTree('/');
|
|
49
|
+
const paths = tree.map((e) => e.path).sort();
|
|
50
|
+
expect(paths).toContain('/');
|
|
51
|
+
expect(paths).toContain('/a.txt');
|
|
52
|
+
expect(paths).toContain('/dir');
|
|
53
|
+
expect(paths).toContain('/dir/b.txt');
|
|
54
|
+
const root = tree.find((e) => e.path === '/');
|
|
55
|
+
const dir = tree.find((e) => e.path === '/dir');
|
|
56
|
+
const file = tree.find((e) => e.path === '/a.txt');
|
|
57
|
+
expect(root?.type).toBe('dir');
|
|
58
|
+
expect(dir?.type).toBe('dir');
|
|
59
|
+
expect(file?.type).toBe('file');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('LightningFS FileStore (complex structure)', () => {
|
|
63
|
+
it('creates and verifies a multi-level project layout', async () => {
|
|
64
|
+
const fs = new LightningFileStore('flowfs-complex-test');
|
|
65
|
+
await fs.write('/src/flows/items.flow.ts', te.encode('items flow'));
|
|
66
|
+
await fs.write('/src/flows/orders.flow.ts', te.encode('orders flow'));
|
|
67
|
+
await fs.write('/src/integrations/user.integration.ts', te.encode('user integration'));
|
|
68
|
+
await fs.write('/config/settings.json', te.encode('{"key":"value"}'));
|
|
69
|
+
expect(await fs.exists('/src/flows/items.flow.ts')).toBe(true);
|
|
70
|
+
expect(await fs.exists('/src/flows/orders.flow.ts')).toBe(true);
|
|
71
|
+
expect(await fs.exists('/src/integrations/user.integration.ts')).toBe(true);
|
|
72
|
+
expect(await fs.exists('/config/settings.json')).toBe(true);
|
|
73
|
+
const tree = await fs.listTree('/src');
|
|
74
|
+
const paths = tree.map((e) => e.path);
|
|
75
|
+
expect(paths).toContain('/src');
|
|
76
|
+
expect(paths).toContain('/src/flows');
|
|
77
|
+
expect(paths).toContain('/src/integrations');
|
|
78
|
+
expect(paths).toContain('/src/flows/items.flow.ts');
|
|
79
|
+
expect(paths).toContain('/src/flows/orders.flow.ts');
|
|
80
|
+
// verify content
|
|
81
|
+
const itemsBuf = await fs.read('/src/flows/items.flow.ts');
|
|
82
|
+
expect(itemsBuf).not.toBeNull();
|
|
83
|
+
expect(td.decode(itemsBuf)).toBe('items flow');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=LightningFileStore.specs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightningFileStore.specs.js","sourceRoot":"","sources":["../../src/LightningFileStore.specs.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,EAAE,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,YAAY,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAErD,iBAAiB;QACjB,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAC3D,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAS,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IFileStore } from './types';
|
|
2
|
+
export declare class NodeFileStore implements IFileStore {
|
|
3
|
+
write(p: string, data: Uint8Array): Promise<void>;
|
|
4
|
+
read(p: string): Promise<Uint8Array | null>;
|
|
5
|
+
exists(p: string): Promise<boolean>;
|
|
6
|
+
listTree(root?: string): Promise<Array<{
|
|
7
|
+
path: string;
|
|
8
|
+
type: 'file' | 'dir';
|
|
9
|
+
size: number;
|
|
10
|
+
}>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=NodeFileStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeFileStore.d.ts","sourceRoot":"","sources":["../../src/NodeFileStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAa1C,qBAAa,aAAc,YAAW,UAAU;IACxC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjD,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAU3C,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUnC,QAAQ,CAAC,IAAI,GAAE,MAAY,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAkCzG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { toPosix } from './path.js';
|
|
2
|
+
import * as fsp from 'fs/promises';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import * as url from 'url';
|
|
5
|
+
const toAbs = (p) => {
|
|
6
|
+
if (!p)
|
|
7
|
+
return process.cwd();
|
|
8
|
+
if (p.startsWith('file://'))
|
|
9
|
+
return url.fileURLToPath(p);
|
|
10
|
+
return path.isAbsolute(p) ? p : path.resolve(p);
|
|
11
|
+
};
|
|
12
|
+
export class NodeFileStore {
|
|
13
|
+
async write(p, data) {
|
|
14
|
+
const abs = toAbs(p);
|
|
15
|
+
await fsp.mkdir(path.dirname(abs), { recursive: true });
|
|
16
|
+
await fsp.writeFile(abs, data);
|
|
17
|
+
}
|
|
18
|
+
async read(p) {
|
|
19
|
+
const abs = toAbs(p);
|
|
20
|
+
try {
|
|
21
|
+
const buf = await fsp.readFile(abs);
|
|
22
|
+
return new Uint8Array(buf);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async exists(p) {
|
|
29
|
+
const abs = toAbs(p);
|
|
30
|
+
try {
|
|
31
|
+
await fsp.access(abs);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async listTree(root = '/') {
|
|
39
|
+
const out = [];
|
|
40
|
+
const walk = async (absDir) => {
|
|
41
|
+
let entries;
|
|
42
|
+
try {
|
|
43
|
+
entries = await fsp.readdir(absDir, { withFileTypes: true });
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
out.push({ path: toPosix(absDir), type: 'dir', size: 0 });
|
|
49
|
+
for (const e of entries) {
|
|
50
|
+
const abs = path.join(absDir, e.name);
|
|
51
|
+
if (e.isDirectory()) {
|
|
52
|
+
await walk(abs);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const st = await fsp.stat(abs).catch(() => null);
|
|
56
|
+
out.push({
|
|
57
|
+
path: toPosix(abs),
|
|
58
|
+
type: 'file',
|
|
59
|
+
size: st?.size ?? 0,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const absRoot = toAbs(root);
|
|
65
|
+
await walk(absRoot);
|
|
66
|
+
out.sort((a, b) => (a.type === b.type ? a.path.localeCompare(b.path) : a.type === 'dir' ? -1 : 1));
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=NodeFileStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeFileStore.js","sourceRoot":"","sources":["../../src/NodeFileStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE;IAC1B,IAAI,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;IAC7B,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,GAAG,CAAC,aAAa,CAAC,CAA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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnG,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeFileStore.specs.d.ts","sourceRoot":"","sources":["../../src/NodeFileStore.specs.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
+
import { mkdtemp, rm } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { NodeFileStore } from './NodeFileStore.js';
|
|
6
|
+
import { toPosix } from './path.js';
|
|
7
|
+
const enc = new TextEncoder();
|
|
8
|
+
const dec = new TextDecoder();
|
|
9
|
+
describe('NodeFileStore', () => {
|
|
10
|
+
let root;
|
|
11
|
+
let fs;
|
|
12
|
+
beforeAll(async () => {
|
|
13
|
+
root = await mkdtemp(join(tmpdir(), 'nodefilestore-'));
|
|
14
|
+
fs = new NodeFileStore();
|
|
15
|
+
});
|
|
16
|
+
afterAll(async () => {
|
|
17
|
+
await rm(root, { recursive: true, force: true });
|
|
18
|
+
});
|
|
19
|
+
it('writes and reads a file (binary API)', async () => {
|
|
20
|
+
const p = join(root, 'test.txt');
|
|
21
|
+
await fs.write(p, enc.encode('hello world'));
|
|
22
|
+
const buf = await fs.read(p);
|
|
23
|
+
expect(buf).not.toBeNull();
|
|
24
|
+
expect(dec.decode(buf)).toBe('hello world');
|
|
25
|
+
});
|
|
26
|
+
it('checks file existence', async () => {
|
|
27
|
+
const existsPath = join(root, 'exists.txt');
|
|
28
|
+
const missingPath = join(root, 'missing.txt');
|
|
29
|
+
await fs.write(existsPath, enc.encode('ok'));
|
|
30
|
+
expect(await fs.read(missingPath)).toBeNull();
|
|
31
|
+
expect(await fs.exists(existsPath)).toBe(true);
|
|
32
|
+
expect(await fs.exists(missingPath)).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
it('supports nested directories (mkdir -p style) for write/read', async () => {
|
|
35
|
+
const nested = join(root, 'nested/deep/file.txt');
|
|
36
|
+
await fs.write(nested, enc.encode('nested content'));
|
|
37
|
+
const buf = await fs.read(nested);
|
|
38
|
+
expect(buf).not.toBeNull();
|
|
39
|
+
expect(dec.decode(buf)).toBe('nested content');
|
|
40
|
+
});
|
|
41
|
+
it('lists directory tree', async () => {
|
|
42
|
+
const a = join(root, 'a.txt');
|
|
43
|
+
const dir = join(root, 'dir');
|
|
44
|
+
const b = join(dir, 'b.txt');
|
|
45
|
+
await fs.write(a, enc.encode('a'));
|
|
46
|
+
await fs.write(b, enc.encode('b'));
|
|
47
|
+
const tree = await fs.listTree(root);
|
|
48
|
+
const paths = new Set(tree.map((e) => e.path));
|
|
49
|
+
// expect both directory and files to be present (POSIX paths)
|
|
50
|
+
expect(paths.has(toPosix(root))).toBe(true);
|
|
51
|
+
expect(paths.has(toPosix(a))).toBe(true);
|
|
52
|
+
expect(paths.has(toPosix(dir))).toBe(true);
|
|
53
|
+
expect(paths.has(toPosix(b))).toBe(true);
|
|
54
|
+
const fileEntry = tree.find((e) => e.path === toPosix(b));
|
|
55
|
+
const dirEntry = tree.find((e) => e.path === toPosix(dir));
|
|
56
|
+
expect(fileEntry?.type).toBe('file');
|
|
57
|
+
expect(dirEntry?.type).toBe('dir');
|
|
58
|
+
expect(typeof fileEntry?.size).toBe('number');
|
|
59
|
+
});
|
|
60
|
+
it('non-existent file yields read() = null and exists() = false', async () => {
|
|
61
|
+
const nope = join(root, 'does-not-exist.txt');
|
|
62
|
+
expect(await fs.read(nope)).toBeNull();
|
|
63
|
+
expect(await fs.exists(nope)).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=NodeFileStore.specs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeFileStore.specs.js","sourceRoot":"","sources":["../../src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,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAE3D,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACvC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/path.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,MAAO,MAAM,WAA0B,CAAC;AAE5D,eAAO,MAAM,OAAO,MAAO,MAAM,WAIhC,CAAC;AAEF,eAAO,MAAM,IAAI,aAAc,MAAM,EAAE,WAMtC,CAAC"}
|
package/dist/src/path.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const toPosix = (p) => p.replace(/\\/g, '/');
|
|
2
|
+
export const dirname = (p) => {
|
|
3
|
+
const n = toPosix(p);
|
|
4
|
+
const i = n.lastIndexOf('/');
|
|
5
|
+
return i <= 0 ? '/' : n.slice(0, i);
|
|
6
|
+
};
|
|
7
|
+
export const join = (...parts) => {
|
|
8
|
+
const filtered = parts.filter(Boolean);
|
|
9
|
+
if (!filtered.length)
|
|
10
|
+
return '/';
|
|
11
|
+
const absolute = filtered[0].startsWith('/');
|
|
12
|
+
const joined = toPosix(filtered.map((s) => s.replace(/^\/+|\/+$/g, '')).join('/'));
|
|
13
|
+
return absolute ? `/${joined}` : joined;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/path.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE;IACnC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,KAAe,EAAE,EAAE;IACzC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,GAAG,CAAC;IACjC,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACnF,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function readText(fs: {
|
|
2
|
+
read(path: string): Promise<Uint8Array | null>;
|
|
3
|
+
}, path: string): Promise<string | null>;
|
|
4
|
+
export declare function writeText(fs: {
|
|
5
|
+
write(path: string, data: Uint8Array): Promise<void>;
|
|
6
|
+
}, path: string, text: string): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=text-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-helpers.d.ts","sourceRoot":"","sources":["../../src/text-helpers.ts"],"names":[],"mappings":"AAAA,wBAAsB,QAAQ,CAC5B,EAAE,EAAE;IAAE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA;CAAE,EACtD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGxB;AAED,wBAAsB,SAAS,CAC7B,EAAE,EAAE;IAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,EAC5D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export async function readText(fs, path) {
|
|
2
|
+
const buf = await fs.read(path);
|
|
3
|
+
return buf ? new TextDecoder().decode(buf) : null;
|
|
4
|
+
}
|
|
5
|
+
export async function writeText(fs, path, text) {
|
|
6
|
+
const buf = new TextEncoder().encode(text);
|
|
7
|
+
await fs.write(path, buf);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=text-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-helpers.js","sourceRoot":"","sources":["../../src/text-helpers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,EAAsD,EACtD,IAAY;IAEZ,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,EAA4D,EAC5D,IAAY,EACZ,IAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IFileStore {
|
|
2
|
+
write(path: string, data: Uint8Array): Promise<void>;
|
|
3
|
+
read(path: string): Promise<Uint8Array | null>;
|
|
4
|
+
exists(path: string): Promise<boolean>;
|
|
5
|
+
listTree(root?: string): Promise<Array<{
|
|
6
|
+
path: string;
|
|
7
|
+
type: 'file' | 'dir';
|
|
8
|
+
size: number;
|
|
9
|
+
}>>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CAC/F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/@vitest+pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/types.d.ts","../../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/helpers.d.ts","../../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/index-8b61d5bc.d.ts","../../../node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.d.ts","../../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/tasks.d-CkscK4of.d.ts","../../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts","../../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/diff.d.ts","../../../node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/types.d.ts","../../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/error.d.ts","../../../node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/index.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/optional-types.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/environment.d.cL3nLXbE.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/compatibility/disposable.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/compatibility/indexable.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/compatibility/index.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/ts5.6/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/ts5.6/buffer.buffer.d.ts","../../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/dom-events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/inspector.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@20.19.11/node_modules/@types/node/ts5.6/index.d.ts","../../../node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts","../../../node_modules/.pnpm/rollup@4.48.1/node_modules/rollup/dist/rollup.d.ts","../../../node_modules/.pnpm/rollup@4.48.1/node_modules/rollup/dist/parseAst.d.ts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/types/hmrPayload.d.ts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/types/customEvent.d.ts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/types/hot.d.ts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/dist/node/types.d-aGj9QkWt.d.ts","../../../node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.d.ts","../../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/previous-map.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/input.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/css-syntax-error.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/declaration.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/root.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/warning.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/lazy-result.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/no-work-result.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/processor.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/result.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/document.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/rule.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/node.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/comment.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/container.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/at-rule.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/list.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/postcss.d.ts","../../../node_modules/.pnpm/postcss@8.5.6/node_modules/postcss/lib/postcss.d.mts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/dist/node/runtime.d.ts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/types/importGlob.d.ts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/types/metadata.d.ts","../../../node_modules/.pnpm/vite@5.4.19_@types+node@20.19.11/node_modules/vite/dist/node/index.d.ts","../../../node_modules/.pnpm/@vitest+mocker@3.2.4_vite@5.4.19/node_modules/@vitest/mocker/dist/registry.d-D765pazg.d.ts","../../../node_modules/.pnpm/@vitest+mocker@3.2.4_vite@5.4.19/node_modules/@vitest/mocker/dist/types.d-D_aRZRdy.d.ts","../../../node_modules/.pnpm/@vitest+mocker@3.2.4_vite@5.4.19/node_modules/@vitest/mocker/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/source-map.d.ts","../../../node_modules/.pnpm/vite-node@3.2.4_@types+node@20.19.11/node_modules/vite-node/dist/trace-mapping.d-DLVdEqOp.d.ts","../../../node_modules/.pnpm/vite-node@3.2.4_@types+node@20.19.11/node_modules/vite-node/dist/index.d-DGmxD2U7.d.ts","../../../node_modules/.pnpm/vite-node@3.2.4_@types+node@20.19.11/node_modules/vite-node/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/environment.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/config.d.D2ROskhv.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/worker.d.1GmBbd7G.d.ts","../../../node_modules/.pnpm/@types+deep-eql@4.0.2/node_modules/@types/deep-eql/index.d.ts","../../../node_modules/.pnpm/@types+chai@5.2.2/node_modules/@types/chai/index.d.ts","../../../node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/utils.d.ts","../../../node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/benchmark.d.BwvBVTda.d.ts","../../../node_modules/.pnpm/vite-node@3.2.4_@types+node@20.19.11/node_modules/vite-node/dist/client.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/coverage.d.S9RMNXIe.d.ts","../../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/manager.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/reporters.d.BFLkQcL6.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/worker.d.CKwWzBSj.d.ts","../../../node_modules/.pnpm/@vitest+spy@3.2.4/node_modules/@vitest/spy/dist/index.d.ts","../../../node_modules/.pnpm/@vitest+expect@3.2.4/node_modules/@vitest/expect/dist/index.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/global.d.MAmajcmJ.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/vite.d.CMLlLIFP.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/mocker.d.BE_2ls6u.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/chunks/suite.d.FvehnV49.d.ts","../../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/utils.d.ts","../../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/overloads.d.ts","../../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/branding.d.ts","../../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/messages.d.ts","../../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/index.d.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/dist/index.d.ts","../../../node_modules/.pnpm/@isomorphic-git+lightning-fs@4.6.2/node_modules/@isomorphic-git/lightning-fs/index.d.ts","../src/types.ts","../src/path.ts","../src/LightningFileStore.ts","../src/LightningFileStore.specs.ts","../src/NodeFileStore.ts","../src/NodeFileStore.specs.ts","../src/index.ts","../src/text-helpers.ts","../../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.19.11/node_modules/vitest/globals.d.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"5c54a34e3d91727f7ae840bfe4d5d1c9a2f93c54cb7b6063d06ee4a6c3322656","db4da53b03596668cf6cc9484834e5de3833b9e7e64620cf08399fe069cd398d","ac7c28f153820c10850457994db1462d8c8e462f253b828ad942a979f726f2f9","f9b028d3c3891dd817e24d53102132b8f696269309605e6ed4f0db2c113bbd82","fb7c8d90e52e2884509166f96f3d591020c7b7977ab473b746954b0c8d100960","0bff51d6ed0c9093f6955b9d8258ce152ddb273359d50a897d8baabcb34de2c4","45cec9a1ba6549060552eead8959d47226048e0b71c7d0702ae58b7e16a28912","ef13c73d6157a32933c612d476c1524dd674cf5b9a88571d7d6a0d147544d529","13918e2b81c4288695f9b1f3dcc2468caf0f848d5c1f3dc00071c619d34ff63a","6907b09850f86610e7a528348c15484c1e1c09a18a9c1e98861399dfe4b18b46","12deea8eaa7a4fc1a2908e67da99831e5c5a6b46ad4f4f948fd4759314ea2b80","f0a8b376568a18f9a4976ecb0855187672b16b96c4df1c183a7e52dc1b5d98e8","8124828a11be7db984fcdab052fd4ff756b18edcfa8d71118b55388176210923","092944a8c05f9b96579161e88c6f211d5304a76bd2c47f8d4c30053269146bc8",{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true},"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a",{"version":"613b21ccdf3be6329d56e6caa13b258c842edf8377be7bc9f014ed14cdcfc308","affectsGlobalScope":true},{"version":"109b9c280e8848c08bf4a78fff1fed0750a6ca1735671b5cf08b71bae5448c03","affectsGlobalScope":true},"4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107",{"version":"1ca84b44ad1d8e4576f24904d8b95dd23b94ea67e1575f89614ac90062fc67f4","affectsGlobalScope":true},"6d586db0a09a9495ebb5dece28f54df9684bfbd6e1f568426ca153126dac4a40","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f",{"version":"567b7f607f400873151d7bc63a049514b53c3c00f5f56e9e95695d93b66a138e","affectsGlobalScope":true},"823f9c08700a30e2920a063891df4e357c64333fdba6889522acc5b7ae13fc08","84c1930e33d1bb12ad01bcbe11d656f9646bd21b2fb2afd96e8e10615a021aef",{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true},"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a",{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true},"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","2bf469abae4cc9c0f340d4e05d9d26e37f936f9c8ca8f007a6534f109dcc77e4","4aacb0dd020eeaef65426153686cc639a78ec2885dc72ad220be1d25f1a439df","f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45",{"version":"71450bbc2d82821d24ca05699a533e72758964e9852062c53b30f31c36978ab8","affectsGlobalScope":true},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true},"4c21aaa8257d7950a5b75a251d9075b6a371208fc948c9c8402f6690ef3b5b55","b5895e6353a5d708f55d8685c38a235c3a6d8138e374dee8ceb8ffde5aa8002a","54c4f21f578864961efc94e8f42bc893a53509e886370ec7dd602e0151b9266c","de735eca2c51dd8b860254e9fdb6d9ec19fe402dfe597c23090841ce3937cfc5","4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","5650cf3dace09e7c25d384e3e6b818b938f68f4e8de96f52d9c5a1b3db068e86",{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true},"5155da3047ef977944d791a2188ff6e6c225f6975cc1910ab7bb6838ab84cede","93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5",{"version":"e16d218a30f6a6810b57f7e968124eaa08c7bb366133ea34bbf01e7cd6b8c0ad","affectsGlobalScope":true},{"version":"eb8692dea24c27821f77e397272d9ed2eda0b95e4a75beb0fdda31081d15a8ae","affectsGlobalScope":true},"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","5b6844ad931dcc1d3aca53268f4bd671428421464b1286746027aede398094f2","37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093",{"version":"0225ecb9ed86bdb7a2c7fd01f1556906902929377b44483dc4b83e03b3ef227d","affectsGlobalScope":true},"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb","461e54289e6287e8494a0178ba18182acce51a02bca8dea219149bf2cf96f105",{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true},"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","e31e51c55800014d926e3f74208af49cb7352803619855c89296074d1ecbb524","ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9",{"version":"dfb96ba5177b68003deec9e773c47257da5c4c8a74053d8956389d832df72002","affectsGlobalScope":true},{"version":"92d3070580cf72b4bb80959b7f16ede9a3f39e6f4ef2ac87cfa4561844fdc69f","affectsGlobalScope":true},"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","613deebaec53731ff6b74fe1a89f094b708033db6396b601df3e6d5ab0ec0a47","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"e56eb632f0281c9f8210eb8c86cc4839a427a4ffffcfd2a5e40b956050b3e042","affectsGlobalScope":true},"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","9091e564b81e7b4c382a33c62de704a699e10508190547d4f7c1c3e039d2db2b","151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d",{"version":"8ccaa1a30e1c213a5ea06fc5388cc0846026c179d1400eceef42f94db200fc90","affectsGlobalScope":true},"a660aa95476042d3fdcc1343cf6bb8fdf24772d31712b1db321c5a4dcc325434","282f98006ed7fa9bb2cd9bdbe2524595cfc4bcd58a0bb3232e4519f2138df811","6222e987b58abfe92597e1273ad7233626285bc2d78409d4a7b113d81a83496b","cbe726263ae9a7bf32352380f7e8ab66ee25b3457137e316929269c19e18a2be","8b96046bf5fb0a815cba6b0880d9f97b7f3a93cf187e8dcfe8e2792e97f38f87",{"version":"bacf2c84cf448b2cd02c717ad46c3d7fd530e0c91282888c923ad64810a4d511","affectsGlobalScope":true},"402e5c534fb2b85fa771170595db3ac0dd532112c8fa44fc23f233bc6967488b","8885cf05f3e2abf117590bbb951dcf6359e3e5ac462af1c901cfd24c6a6472e2","333caa2bfff7f06017f114de738050dd99a765c7eb16571c6d25a38c0d5365dc","e61df3640a38d535fd4bc9f4a53aef17c296b58dc4b6394fd576b808dd2fe5e6","459920181700cec8cbdf2a5faca127f3f17fd8dd9d9e577ed3f5f3af5d12a2e4","4719c209b9c00b579553859407a7e5dcfaa1c472994bd62aa5dd3cc0757eb077","7ec359bbc29b69d4063fe7dad0baaf35f1856f914db16b3f4f6e3e1bca4099fa","70790a7f0040993ca66ab8a07a059a0f8256e7bb57d968ae945f696cbff4ac7a","d1b9a81e99a0050ca7f2d98d7eedc6cda768f0eb9fa90b602e7107433e64c04c","a022503e75d6953d0e82c2c564508a5c7f8556fad5d7f971372d2d40479e4034","b215c4f0096f108020f666ffcc1f072c81e9f2f95464e894a5d5f34c5ea2a8b1","644491cde678bd462bb922c1d0cfab8f17d626b195ccb7f008612dc31f445d2d","dfe54dab1fa4961a6bcfba68c4ca955f8b5bbeb5f2ab3c915aa7adaa2eabc03a","1251d53755b03cde02466064260bb88fd83c30006a46395b7d9167340bc59b73","47865c5e695a382a916b1eedda1b6523145426e48a2eae4647e96b3b5e52024f","4cdf27e29feae6c7826cdd5c91751cc35559125e8304f9e7aed8faef97dcf572","331b8f71bfae1df25d564f5ea9ee65a0d847c4a94baa45925b6f38c55c7039bf","2a771d907aebf9391ac1f50e4ad37952943515eeea0dcc7e78aa08f508294668","0146fd6262c3fd3da51cb0254bb6b9a4e42931eb2f56329edd4c199cb9aaf804","183f480885db5caa5a8acb833c2be04f98056bdcc5fb29e969ff86e07efe57ab","82e687ebd99518bc63ea04b0c3810fb6e50aa6942decd0ca6f7a56d9b9a212a6","7f698624bbbb060ece7c0e51b7236520ebada74b747d7523c7df376453ed6fea","8f07f2b6514744ac96e51d7cb8518c0f4de319471237ea10cf688b8d0e9d0225","257b83faa134d971c738a6b9e4c47e59bb7b23274719d92197580dd662bfafc3","b34b5f6b506abb206b1ea73c6a332b9ee9c8c98be0f6d17cdbda9430ecc1efab","75d4c746c3d16af0df61e7b0afe9606475a23335d9f34fcc525d388c21e9058b","fa959bf357232201c32566f45d97e70538c75a093c940af594865d12f31d4912","d2c52abd76259fc39a30dfae70a2e5ce77fd23144457a7ff1b64b03de6e3aec7","e6233e1c976265e85aa8ad76c3881febe6264cb06ae3136f0257e1eab4a6cc5a","f73e2335e568014e279927321770da6fe26facd4ac96cdc22a56687f1ecbb58e","317878f156f976d487e21fd1d58ad0461ee0a09185d5b0a43eedf2a56eb7e4ea","324ac98294dab54fbd580c7d0e707d94506d7b2c3d5efe981a8495f02cf9ad96","9ec72eb493ff209b470467e24264116b6a8616484bca438091433a545dfba17e","d6ee22aba183d5fc0c7b8617f77ee82ecadc2c14359cc51271c135e23f6ed51f","49747416f08b3ba50500a215e7a55d75268b84e31e896a40313c8053e8dec908","81e634f1c5e1ca309e7e3dc69e2732eea932ef07b8b34517d452e5a3e9a36fa3","34f39f75f2b5aa9c84a9f8157abbf8322e6831430e402badeaf58dd284f9b9a6","427fe2004642504828c1476d0af4270e6ad4db6de78c0b5da3e4c5ca95052a99",{"version":"c8905dbea83f3220676a669366cd8c1acef56af4d9d72a8b2241b1d044bb4302","affectsGlobalScope":true},"891694d3694abd66f0b8872997b85fd8e52bc51632ce0f8128c96962b443189f","69bf2422313487956e4dacf049f30cb91b34968912058d244cb19e4baa24da97","971a2c327ff166c770c5fb35699575ba2d13bba1f6d2757309c9be4b30036c8e","4f45e8effab83434a78d17123b01124259fbd1e335732135c213955d85222234","7bd51996fb7717941cbe094b05adc0d80b9503b350a77b789bbb0fc786f28053","b62006bbc815fe8190c7aee262aad6bff993e3f9ade70d7057dfceab6de79d2f","13497c0d73306e27f70634c424cd2f3b472187164f36140b504b3756b0ff476d","bf7a2d0f6d9e72d59044079d61000c38da50328ccdff28c47528a1a139c610ec","04471dc55f802c29791cc75edda8c4dd2a121f71c2401059da61eff83099e8ab",{"version":"120a80aa556732f684db3ed61aeff1d6671e1655bd6cba0aa88b22b88ac9a6b1","affectsGlobalScope":true},{"version":"e58c0b5226aff07b63be6ac6e1bec9d55bc3d2bda3b11b9b68cccea8c24ae839","affectsGlobalScope":true},"a23a08b626aa4d4a1924957bd8c4d38a7ffc032e21407bbd2c97413e1d8c3dbd","5a88655bf852c8cc007d6bc874ab61d1d63fba97063020458177173c454e9b4a","7e4dfae2da12ec71ffd9f55f4641a6e05610ce0d6784838659490e259e4eb13c","c30a41267fc04c6518b17e55dcb2b810f267af4314b0b6d7df1c33a76ce1b330","72422d0bac4076912385d0c10911b82e4694fc106e2d70added091f88f0824ba","da251b82c25bee1d93f9fd80c5a61d945da4f708ca21285541d7aff83ecb8200","4c8ca51077f382498f47074cf304d654aba5d362416d4f809dfdd5d4f6b3aaca","98b94085c9f78eba36d3d2314affe973e8994f99864b8708122750788825c771","13573a613314e40482386fe9c7934f9d86f3e06f19b840466c75391fb833b99b","3168fa4c8f0f49492d3b290908be46b379ef8c447e18814da57c98c2353f0e77",{"version":"b7819623d1175c36cb2d7eee5f5e77d7ebd4c21384c041667e8184bf50f67fa1","signature":"3117c554835ee8e7613f7b9f1a88d822fc592f1f62faaa394fdf9be7a2828cad"},{"version":"db5115fc07689b3588e56e025d5ce740d1399b5b073c50e71eb576b6cc0a66a8","signature":"901e5b4fd3f90d1e7a774d6b95773589b5424e3a62159d81009bb72631cf744c"},{"version":"133811d87f7ec5ec31aeef5f9066ef348ef435804ed5246b15e9f066306ed5e9","signature":"175a82650df7e91434923b4c9230bc1df43a3c69d18c64c88b5fd7f88bbcf28b"},{"version":"db4d35f73b712afd36fa1b41c5780a530268eae97bc82c094aeed59c4242b9eb","signature":"b49fd5d5843c0fc5362222331c9848c9bc0f56fbe08dccadc27b9c227b9875d9"},{"version":"c2389764e852ffcac4c9d73b38f307739e6103adb461a8abaf951872d9edd2af","signature":"82cdbcc91a64143dbe97ced7b90d7cabffe425173b35a39d69398004b701c6f2"},{"version":"1eea077fea95dc103ebfd56378f78f8c654ce7fac901318e6119dc7468d612a6","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},"166eac169f2df5998463173dd0df5daac3dda127f338639ba780f5a6ce8fb8a8",{"version":"7ff67432e176bfb4c53293a9423e8ec5184f508fabd62c90a21159e6a233924c","signature":"ca69c3fcd466084a6116c02322846c2896b3e97a1bdff7655e9adb54333283d7"},{"version":"ed09d42b14a604190e8c9fc972d18ea47d5c03c6c4a0003c9620dca915a1973d","affectsGlobalScope":true}],"root":[[239,246]],"options":{"allowJs":true,"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"inlineSources":false,"module":99,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"target":7},"fileIdsList":[[78,121],[78,121,216],[78,118,121],[78,120,121],[78,121,126,155],[78,121,122,127,133,141,152,163],[78,121,122,123,133,141],[73,74,75,78,121],[78,121,124,164],[78,121,125,126,134,142],[78,121,126,152,160],[78,121,127,129,133,141],[78,120,121,128],[78,121,129,130],[78,121,131,133],[78,120,121,133],[78,121,133,134,135,152,163],[78,121,133,134,135,148,152,155],[78,116,121],[78,121,129,133,136,141,152,163],[78,121,133,134,136,137,141,152,160,163],[78,121,136,138,152,160,163],[78,121,133,139],[78,121,140,163,168],[78,121,129,133,141,152],[78,121,142],[78,121,143],[78,120,121,144],[78,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169],[78,121,146],[78,121,147],[78,121,133,148,149],[78,121,148,150,164,166],[78,121,133,152,153,155],[78,121,154,155],[78,121,152,153],[78,121,155],[78,121,156],[78,118,121,152,157],[78,121,133,158,159],[78,121,158,159],[78,121,126,141,152,160],[78,121,161],[121],[76,77,78,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169],[78,121,141,162],[78,121,136,147,163],[78,121,126,164],[78,121,152,165],[78,121,140,166],[78,121,167],[78,121,133,135,144,152,155,163,166,168],[78,121,152,169],[63,64,67,78,121,226],[78,121,203,204],[64,65,67,68,69,78,121],[64,78,121],[64,65,67,78,121],[64,65,78,121],[78,121,210],[59,78,121,210,211],[59,78,121,210],[59,66,78,121],[60,78,121],[59,60,61,63,78,121],[59,78,121],[78,121,232,233],[78,121,232,233,234,235],[78,121,232,234],[78,121,232],[78,121,194],[78,121,192,194],[78,121,183,191,192,193,195,197],[78,121,181],[78,121,184,189,194,197],[78,121,180,197],[78,121,184,185,188,189,190,197],[78,121,184,185,186,188,189,197],[78,121,181,182,183,184,185,189,190,191,193,194,195,197],[78,121,197],[78,121,179,181,182,183,184,185,186,188,189,190,191,192,193,194,195,196],[78,121,179,197],[78,121,184,186,187,189,190,197],[78,121,188,197],[78,121,189,190,194,197],[78,121,182,192],[78,121,172,201],[78,121,171,172],[62,78,121],[78,88,92,121,163],[78,88,121,152,163],[78,83,121],[78,85,88,121,160,163],[78,121,141,160],[78,121,170],[78,83,121,170],[78,85,88,121,141,163],[78,80,81,84,87,121,133,152,163],[78,88,95,121],[78,80,86,121],[78,88,109,110,121],[78,84,88,121,155,163,170],[78,109,121,170],[78,82,83,121,170],[78,88,121],[78,82,83,84,85,86,87,88,89,90,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,110,111,112,113,114,115,121],[78,88,103,121],[78,88,95,96,121],[78,86,88,96,97,121],[78,87,121],[78,80,83,88,121],[78,88,92,96,97,121],[78,92,121],[78,86,88,91,121,163],[78,80,85,88,95,121],[78,121,152],[78,83,88,109,121,168,170],[78,121,207,208],[78,121,207],[78,121,133,134,136,137,138,141,152,160,163,169,170,172,173,174,175,176,177,178,198,199,200,201],[78,121,174,175,176,177],[78,121,174,175,176],[78,121,174],[78,121,175],[78,121,172],[70,78,121,218,219,228],[59,67,70,78,121,212,213,228],[78,121,221],[71,78,121],[59,70,72,78,121,212,220,227,228],[78,121,205],[59,64,67,70,72,78,121,124,134,152,202,205,206,209,212,214,215,217,220,222,223,228,229],[70,78,121,218,219,220,228],[78,121,202,224,229],[70,72,78,121,209,212,214,228],[78,121,168,215],[59,64,67,70,71,72,78,121,124,134,152,168,202,205,206,209,212,213,214,215,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,236],[78,121,237],[78,121,237,241],[78,121,238,239,240],[78,121,135,142,143,237,240,243],[78,121,134,135,143,163,239,240],[78,121,239,241,243]],"referencedMap":[[238,1],[217,2],[216,1],[171,1],[118,3],[119,3],[120,4],[121,5],[122,6],[123,7],[73,1],[76,8],[74,1],[75,1],[124,9],[125,10],[126,11],[127,12],[128,13],[129,14],[130,14],[132,1],[131,15],[133,16],[134,17],[135,18],[117,19],[136,20],[137,21],[138,22],[139,23],[140,24],[141,25],[142,26],[143,27],[144,28],[145,29],[146,30],[147,31],[148,32],[149,32],[150,33],[151,1],[152,34],[154,35],[153,36],[155,37],[156,38],[157,39],[158,40],[159,41],[160,42],[161,43],[78,44],[77,1],[170,45],[162,46],[163,47],[164,48],[165,49],[166,50],[167,51],[168,52],[169,53],[227,54],[205,55],[203,1],[204,1],[59,1],[70,56],[65,57],[68,58],[218,59],[210,1],[213,60],[212,61],[223,61],[211,62],[226,1],[67,63],[69,63],[61,64],[64,65],[206,64],[66,66],[60,1],[79,1],[178,1],[234,67],[236,68],[235,69],[233,70],[232,1],[195,71],[193,72],[194,73],[182,74],[183,72],[190,75],[181,76],[186,77],[196,1],[187,78],[192,79],[198,80],[197,81],[180,82],[188,83],[189,84],[184,85],[191,71],[185,86],[173,87],[172,88],[179,1],[219,1],[62,1],[63,89],[57,1],[58,1],[10,1],[12,1],[11,1],[2,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[3,1],[21,1],[4,1],[22,1],[26,1],[23,1],[24,1],[25,1],[27,1],[28,1],[29,1],[5,1],[30,1],[31,1],[32,1],[33,1],[6,1],[37,1],[34,1],[35,1],[36,1],[38,1],[7,1],[39,1],[44,1],[45,1],[40,1],[41,1],[42,1],[43,1],[8,1],[49,1],[46,1],[47,1],[48,1],[50,1],[9,1],[51,1],[52,1],[53,1],[56,1],[54,1],[55,1],[1,1],[95,90],[105,91],[94,90],[115,92],[86,93],[85,94],[114,95],[108,96],[113,97],[88,98],[102,99],[87,100],[111,101],[83,102],[82,95],[112,103],[84,104],[89,105],[90,1],[93,105],[80,1],[116,106],[106,107],[97,108],[98,109],[100,110],[96,111],[99,112],[109,95],[91,113],[92,114],[101,115],[81,116],[104,107],[103,105],[107,1],[110,117],[221,118],[208,119],[209,118],[207,1],[202,120],[199,121],[177,122],[175,123],[174,1],[176,124],[200,1],[201,125],[220,126],[214,127],[222,128],[72,129],[228,130],[230,131],[224,132],[231,133],[229,134],[215,135],[225,136],[237,137],[247,138],[71,1],[242,139],[241,140],[244,141],[243,142],[245,143],[240,1],[246,1],[239,1]],"latestChangedDtsFile":"./src/text-helpers.d.ts"},"version":"5.5.4"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@auto-engineer/file-store",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/src/index.js",
|
|
6
|
+
"types": "./dist/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"import": "./dist/src/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"esbuild": "^0.21.0",
|
|
16
|
+
"fake-indexeddb": "^6.0.0"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"esbuild-wasm": "^0.21.0",
|
|
20
|
+
"@isomorphic-git/lightning-fs": "^4.6.0"
|
|
21
|
+
},
|
|
22
|
+
"peerDependenciesMeta": {
|
|
23
|
+
"esbuild-wasm": {
|
|
24
|
+
"optional": true
|
|
25
|
+
},
|
|
26
|
+
"@isomorphic-git/lightning-fs": {
|
|
27
|
+
"optional": true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts",
|
|
35
|
+
"dev": "tsc --watch",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"lint": "eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts",
|
|
38
|
+
"lint:fix": "eslint 'src/**/*.ts' --fix --config ../../eslint.config.ts",
|
|
39
|
+
"type-check": "tsc --noEmit",
|
|
40
|
+
"format": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore",
|
|
41
|
+
"format:fix": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore",
|
|
42
|
+
"link:dev": "pnpm build && pnpm link --global",
|
|
43
|
+
"unlink:dev": "pnpm unlink --global"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
3
|
+
import 'fake-indexeddb/auto';
|
|
4
|
+
import { LightningFileStore } from './LightningFileStore';
|
|
5
|
+
|
|
6
|
+
const te = new TextEncoder();
|
|
7
|
+
const td = new TextDecoder();
|
|
8
|
+
|
|
9
|
+
const resetIDBs = async () =>
|
|
10
|
+
await new Promise<void>((res, rej) => {
|
|
11
|
+
const dbs = ['flowfs-test', 'flowfs-complex-test'];
|
|
12
|
+
let done = 0;
|
|
13
|
+
for (const name of dbs) {
|
|
14
|
+
const req = indexedDB.deleteDatabase(name);
|
|
15
|
+
req.onerror = () => rej(req.error);
|
|
16
|
+
req.onsuccess = () => {
|
|
17
|
+
done += 1;
|
|
18
|
+
if (done === dbs.length) res();
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
beforeEach(async () => {
|
|
24
|
+
await resetIDBs();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('LightningFS FileStore (basic ops)', () => {
|
|
28
|
+
it('writes and reads a file', async () => {
|
|
29
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
30
|
+
|
|
31
|
+
await fs.write('/test.txt', te.encode('hello world'));
|
|
32
|
+
const buf = await fs.read('/test.txt');
|
|
33
|
+
|
|
34
|
+
expect(buf).not.toBeNull();
|
|
35
|
+
expect(td.decode(buf!)).toBe('hello world');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('checks file existence', async () => {
|
|
39
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
40
|
+
|
|
41
|
+
await fs.write('/exists.txt', te.encode('ok'));
|
|
42
|
+
|
|
43
|
+
expect(await fs.exists('/exists.txt')).toBe(true);
|
|
44
|
+
expect(await fs.exists('/missing.txt')).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('supports nested directories (mkdir -p style) for write/read', async () => {
|
|
48
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
49
|
+
|
|
50
|
+
await fs.write('/nested/deep/file.txt', te.encode('nested content'));
|
|
51
|
+
const buf = await fs.read('/nested/deep/file.txt');
|
|
52
|
+
|
|
53
|
+
expect(buf).not.toBeNull();
|
|
54
|
+
expect(td.decode(buf!)).toBe('nested content');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('lists directory contents via listTree()', async () => {
|
|
58
|
+
const fs = new LightningFileStore('flowfs-test');
|
|
59
|
+
|
|
60
|
+
await fs.write('/a.txt', te.encode('a'));
|
|
61
|
+
await fs.write('/dir/b.txt', te.encode('b'));
|
|
62
|
+
|
|
63
|
+
const tree = await fs.listTree('/');
|
|
64
|
+
|
|
65
|
+
const paths = tree.map((e) => e.path).sort();
|
|
66
|
+
expect(paths).toContain('/');
|
|
67
|
+
expect(paths).toContain('/a.txt');
|
|
68
|
+
expect(paths).toContain('/dir');
|
|
69
|
+
expect(paths).toContain('/dir/b.txt');
|
|
70
|
+
|
|
71
|
+
const root = tree.find((e) => e.path === '/');
|
|
72
|
+
const dir = tree.find((e) => e.path === '/dir');
|
|
73
|
+
const file = tree.find((e) => e.path === '/a.txt');
|
|
74
|
+
|
|
75
|
+
expect(root?.type).toBe('dir');
|
|
76
|
+
expect(dir?.type).toBe('dir');
|
|
77
|
+
expect(file?.type).toBe('file');
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('LightningFS FileStore (complex structure)', () => {
|
|
82
|
+
it('creates and verifies a multi-level project layout', async () => {
|
|
83
|
+
const fs = new LightningFileStore('flowfs-complex-test');
|
|
84
|
+
|
|
85
|
+
await fs.write('/src/flows/items.flow.ts', te.encode('items flow'));
|
|
86
|
+
await fs.write('/src/flows/orders.flow.ts', te.encode('orders flow'));
|
|
87
|
+
await fs.write('/src/integrations/user.integration.ts', te.encode('user integration'));
|
|
88
|
+
await fs.write('/config/settings.json', te.encode('{"key":"value"}'));
|
|
89
|
+
|
|
90
|
+
expect(await fs.exists('/src/flows/items.flow.ts')).toBe(true);
|
|
91
|
+
expect(await fs.exists('/src/flows/orders.flow.ts')).toBe(true);
|
|
92
|
+
expect(await fs.exists('/src/integrations/user.integration.ts')).toBe(true);
|
|
93
|
+
expect(await fs.exists('/config/settings.json')).toBe(true);
|
|
94
|
+
|
|
95
|
+
const tree = await fs.listTree('/src');
|
|
96
|
+
const paths = tree.map((e) => e.path);
|
|
97
|
+
|
|
98
|
+
expect(paths).toContain('/src');
|
|
99
|
+
expect(paths).toContain('/src/flows');
|
|
100
|
+
expect(paths).toContain('/src/integrations');
|
|
101
|
+
expect(paths).toContain('/src/flows/items.flow.ts');
|
|
102
|
+
expect(paths).toContain('/src/flows/orders.flow.ts');
|
|
103
|
+
|
|
104
|
+
// verify content
|
|
105
|
+
const itemsBuf = await fs.read('/src/flows/items.flow.ts');
|
|
106
|
+
expect(itemsBuf).not.toBeNull();
|
|
107
|
+
expect(td.decode(itemsBuf!)).toBe('items flow');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import LightningFS from '@isomorphic-git/lightning-fs';
|
|
2
|
+
import type { IFileStore } from './types';
|
|
3
|
+
import { dirname } from './path';
|
|
4
|
+
|
|
5
|
+
interface LightningFSStats {
|
|
6
|
+
isDirectory(): boolean;
|
|
7
|
+
size: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface LightningFSPromises {
|
|
11
|
+
writeFile(path: string, data: Uint8Array): Promise<void>;
|
|
12
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
13
|
+
stat(path: string): Promise<LightningFSStats>;
|
|
14
|
+
readdir(path: string): Promise<string[]>;
|
|
15
|
+
mkdir(path: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface LightningFSInstance {
|
|
19
|
+
promises: LightningFSPromises;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class LightningFileStore implements IFileStore {
|
|
23
|
+
private fs: LightningFSInstance;
|
|
24
|
+
private pfs: LightningFSPromises;
|
|
25
|
+
|
|
26
|
+
constructor(name = 'pocfs') {
|
|
27
|
+
this.fs = new LightningFS(name) as LightningFSInstance;
|
|
28
|
+
this.pfs = this.fs.promises;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async write(path: string, data: Uint8Array): Promise<void> {
|
|
32
|
+
await this.mkdirp(dirname(path));
|
|
33
|
+
await this.pfs.writeFile(path, data);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async read(path: string): Promise<Uint8Array | null> {
|
|
37
|
+
try {
|
|
38
|
+
return await this.pfs.readFile(path);
|
|
39
|
+
} catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async exists(path: string): Promise<boolean> {
|
|
45
|
+
return await this.pfs
|
|
46
|
+
.stat(path)
|
|
47
|
+
.then(() => true)
|
|
48
|
+
.catch(() => false);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async listTree(root: string = '/'): Promise<Array<{ path: string; type: 'file' | 'dir'; size: number }>> {
|
|
52
|
+
const out: Array<{ path: string; type: 'file' | 'dir'; size: number }> = [];
|
|
53
|
+
const walk = async (p: string) => {
|
|
54
|
+
let st: LightningFSStats | null = null;
|
|
55
|
+
try {
|
|
56
|
+
st = await this.pfs.stat(p);
|
|
57
|
+
} catch {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (st !== null && st.isDirectory()) {
|
|
62
|
+
out.push({ path: p, type: 'dir', size: 0 });
|
|
63
|
+
let entries: string[] = [];
|
|
64
|
+
try {
|
|
65
|
+
entries = await this.pfs.readdir(p);
|
|
66
|
+
} catch {
|
|
67
|
+
/* ignore */
|
|
68
|
+
}
|
|
69
|
+
for (const name of entries) {
|
|
70
|
+
const child = p === '/' ? `/${name}` : `${p}/${name}`;
|
|
71
|
+
await walk(child);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
out.push({ path: p, type: 'file', size: st?.size ?? 0 });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
await walk(root);
|
|
78
|
+
out.sort((a, b) => (a.type === b.type ? a.path.localeCompare(b.path) : a.type === 'dir' ? -1 : 1));
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private async mkdirp(path: string): Promise<void> {
|
|
83
|
+
if (!path || path === '/') return;
|
|
84
|
+
const parts = path.split('/').filter(Boolean);
|
|
85
|
+
let cur = '';
|
|
86
|
+
for (const part of parts) {
|
|
87
|
+
cur += '/' + part;
|
|
88
|
+
const exists = await this.pfs
|
|
89
|
+
.stat(cur)
|
|
90
|
+
.then(() => true)
|
|
91
|
+
.catch(() => false);
|
|
92
|
+
if (!exists) await this.pfs.mkdir(cur);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
+
import { mkdtemp, rm } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { NodeFileStore } from './NodeFileStore';
|
|
6
|
+
import { toPosix } from './path';
|
|
7
|
+
|
|
8
|
+
const enc = new TextEncoder();
|
|
9
|
+
const dec = new TextDecoder();
|
|
10
|
+
|
|
11
|
+
describe('NodeFileStore', () => {
|
|
12
|
+
let root: string;
|
|
13
|
+
let fs: NodeFileStore;
|
|
14
|
+
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
root = await mkdtemp(join(tmpdir(), 'nodefilestore-'));
|
|
17
|
+
fs = new NodeFileStore();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterAll(async () => {
|
|
21
|
+
await rm(root, { recursive: true, force: true });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('writes and reads a file (binary API)', async () => {
|
|
25
|
+
const p = join(root, 'test.txt');
|
|
26
|
+
|
|
27
|
+
await fs.write(p, enc.encode('hello world'));
|
|
28
|
+
const buf = await fs.read(p);
|
|
29
|
+
expect(buf).not.toBeNull();
|
|
30
|
+
expect(dec.decode(buf!)).toBe('hello world');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('checks file existence', async () => {
|
|
34
|
+
const existsPath = join(root, 'exists.txt');
|
|
35
|
+
const missingPath = join(root, 'missing.txt');
|
|
36
|
+
|
|
37
|
+
await fs.write(existsPath, enc.encode('ok'));
|
|
38
|
+
expect(await fs.read(missingPath)).toBeNull();
|
|
39
|
+
|
|
40
|
+
expect(await fs.exists(existsPath)).toBe(true);
|
|
41
|
+
expect(await fs.exists(missingPath)).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('supports nested directories (mkdir -p style) for write/read', async () => {
|
|
45
|
+
const nested = join(root, 'nested/deep/file.txt');
|
|
46
|
+
|
|
47
|
+
await fs.write(nested, enc.encode('nested content'));
|
|
48
|
+
|
|
49
|
+
const buf = await fs.read(nested);
|
|
50
|
+
expect(buf).not.toBeNull();
|
|
51
|
+
expect(dec.decode(buf!)).toBe('nested content');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('lists directory tree', async () => {
|
|
55
|
+
const a = join(root, 'a.txt');
|
|
56
|
+
const dir = join(root, 'dir');
|
|
57
|
+
const b = join(dir, 'b.txt');
|
|
58
|
+
|
|
59
|
+
await fs.write(a, enc.encode('a'));
|
|
60
|
+
await fs.write(b, enc.encode('b'));
|
|
61
|
+
|
|
62
|
+
const tree = await fs.listTree(root);
|
|
63
|
+
const paths = new Set(tree.map((e) => e.path));
|
|
64
|
+
|
|
65
|
+
// expect both directory and files to be present (POSIX paths)
|
|
66
|
+
expect(paths.has(toPosix(root))).toBe(true);
|
|
67
|
+
expect(paths.has(toPosix(a))).toBe(true);
|
|
68
|
+
expect(paths.has(toPosix(dir))).toBe(true);
|
|
69
|
+
expect(paths.has(toPosix(b))).toBe(true);
|
|
70
|
+
|
|
71
|
+
const fileEntry = tree.find((e) => e.path === toPosix(b));
|
|
72
|
+
const dirEntry = tree.find((e) => e.path === toPosix(dir));
|
|
73
|
+
|
|
74
|
+
expect(fileEntry?.type).toBe('file');
|
|
75
|
+
expect(dirEntry?.type).toBe('dir');
|
|
76
|
+
expect(typeof fileEntry?.size).toBe('number');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('non-existent file yields read() = null and exists() = false', async () => {
|
|
80
|
+
const nope = join(root, 'does-not-exist.txt');
|
|
81
|
+
expect(await fs.read(nope)).toBeNull();
|
|
82
|
+
expect(await fs.exists(nope)).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { IFileStore } from './types';
|
|
2
|
+
import { toPosix } from './path';
|
|
3
|
+
import * as fsp from 'fs/promises';
|
|
4
|
+
import type { Dirent } from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import * as url from 'url';
|
|
7
|
+
|
|
8
|
+
const toAbs = (p: string) => {
|
|
9
|
+
if (!p) return process.cwd();
|
|
10
|
+
if (p.startsWith('file://')) return url.fileURLToPath(p);
|
|
11
|
+
return path.isAbsolute(p) ? p : path.resolve(p);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export class NodeFileStore implements IFileStore {
|
|
15
|
+
async write(p: string, data: Uint8Array): Promise<void> {
|
|
16
|
+
const abs = toAbs(p);
|
|
17
|
+
await fsp.mkdir(path.dirname(abs), { recursive: true });
|
|
18
|
+
await fsp.writeFile(abs, data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async read(p: string): Promise<Uint8Array | null> {
|
|
22
|
+
const abs = toAbs(p);
|
|
23
|
+
try {
|
|
24
|
+
const buf = await fsp.readFile(abs);
|
|
25
|
+
return new Uint8Array(buf);
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async exists(p: string): Promise<boolean> {
|
|
32
|
+
const abs = toAbs(p);
|
|
33
|
+
try {
|
|
34
|
+
await fsp.access(abs);
|
|
35
|
+
return true;
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async listTree(root: string = '/'): Promise<Array<{ path: string; type: 'file' | 'dir'; size: number }>> {
|
|
42
|
+
const out: Array<{ path: string; type: 'file' | 'dir'; size: number }> = [];
|
|
43
|
+
|
|
44
|
+
const walk = async (absDir: string) => {
|
|
45
|
+
let entries: Dirent[];
|
|
46
|
+
try {
|
|
47
|
+
entries = await fsp.readdir(absDir, { withFileTypes: true });
|
|
48
|
+
} catch {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
out.push({ path: toPosix(absDir), type: 'dir', size: 0 });
|
|
53
|
+
|
|
54
|
+
for (const e of entries) {
|
|
55
|
+
const abs = path.join(absDir, e.name);
|
|
56
|
+
if (e.isDirectory()) {
|
|
57
|
+
await walk(abs);
|
|
58
|
+
} else {
|
|
59
|
+
const st = await fsp.stat(abs).catch(() => null);
|
|
60
|
+
out.push({
|
|
61
|
+
path: toPosix(abs),
|
|
62
|
+
type: 'file',
|
|
63
|
+
size: st?.size ?? 0,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const absRoot = toAbs(root);
|
|
70
|
+
await walk(absRoot);
|
|
71
|
+
|
|
72
|
+
out.sort((a, b) => (a.type === b.type ? a.path.localeCompare(b.path) : a.type === 'dir' ? -1 : 1));
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
}
|
package/src/index.ts
ADDED
package/src/path.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const toPosix = (p: string) => p.replace(/\\/g, '/');
|
|
2
|
+
|
|
3
|
+
export const dirname = (p: string) => {
|
|
4
|
+
const n = toPosix(p);
|
|
5
|
+
const i = n.lastIndexOf('/');
|
|
6
|
+
return i <= 0 ? '/' : n.slice(0, i);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const join = (...parts: string[]) => {
|
|
10
|
+
const filtered = parts.filter(Boolean);
|
|
11
|
+
if (!filtered.length) return '/';
|
|
12
|
+
const absolute = filtered[0].startsWith('/');
|
|
13
|
+
const joined = toPosix(filtered.map((s) => s.replace(/^\/+|\/+$/g, '')).join('/'));
|
|
14
|
+
return absolute ? `/${joined}` : joined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export async function readText(
|
|
2
|
+
fs: { read(path: string): Promise<Uint8Array | null> },
|
|
3
|
+
path: string,
|
|
4
|
+
): Promise<string | null> {
|
|
5
|
+
const buf = await fs.read(path);
|
|
6
|
+
return buf ? new TextDecoder().decode(buf) : null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export async function writeText(
|
|
10
|
+
fs: { write(path: string, data: Uint8Array): Promise<void> },
|
|
11
|
+
path: string,
|
|
12
|
+
text: string,
|
|
13
|
+
): Promise<void> {
|
|
14
|
+
const buf = new TextEncoder().encode(text);
|
|
15
|
+
await fs.write(path, buf);
|
|
16
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface IFileStore {
|
|
2
|
+
write(path: string, data: Uint8Array): Promise<void>;
|
|
3
|
+
read(path: string): Promise<Uint8Array | null>;
|
|
4
|
+
exists(path: string): Promise<boolean>;
|
|
5
|
+
listTree(root?: string): Promise<Array<{ path: string; type: 'file' | 'dir'; size: number }>>;
|
|
6
|
+
}
|
package/tsconfig.json
ADDED