@zenfs/core 1.1.6 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backends/file_index.js +0 -3
- package/dist/backends/overlay.js +0 -8
- package/dist/backends/store/fs.js +4 -17
- package/dist/config.d.ts +24 -1
- package/dist/config.js +5 -0
- package/dist/devices.js +0 -12
- package/dist/emulation/cache.d.ts +21 -0
- package/dist/emulation/cache.js +36 -0
- package/dist/emulation/config.d.ts +10 -0
- package/dist/emulation/config.js +10 -0
- package/dist/emulation/promises.d.ts +9 -14
- package/dist/emulation/promises.js +71 -47
- package/dist/emulation/shared.d.ts +16 -0
- package/dist/emulation/sync.d.ts +11 -20
- package/dist/emulation/sync.js +44 -22
- package/dist/file.d.ts +1 -1
- package/dist/file.js +6 -3
- package/package.json +4 -2
- package/readme.md +1 -1
- package/scripts/test.js +19 -1
- package/src/backends/backend.ts +160 -0
- package/src/backends/fetch.ts +180 -0
- package/src/backends/file_index.ts +206 -0
- package/src/backends/memory.ts +50 -0
- package/src/backends/overlay.ts +560 -0
- package/src/backends/port/fs.ts +335 -0
- package/src/backends/port/readme.md +54 -0
- package/src/backends/port/rpc.ts +167 -0
- package/src/backends/readme.md +3 -0
- package/src/backends/store/fs.ts +700 -0
- package/src/backends/store/readme.md +9 -0
- package/src/backends/store/simple.ts +146 -0
- package/src/backends/store/store.ts +173 -0
- package/src/config.ts +185 -0
- package/src/credentials.ts +31 -0
- package/src/devices.ts +459 -0
- package/src/emulation/async.ts +834 -0
- package/src/emulation/cache.ts +44 -0
- package/src/emulation/config.ts +11 -0
- package/src/emulation/constants.ts +182 -0
- package/src/emulation/dir.ts +138 -0
- package/src/emulation/index.ts +8 -0
- package/src/emulation/path.ts +440 -0
- package/src/emulation/promises.ts +1134 -0
- package/src/emulation/shared.ts +153 -0
- package/src/emulation/streams.ts +34 -0
- package/src/emulation/sync.ts +868 -0
- package/src/emulation/watchers.ts +193 -0
- package/src/error.ts +307 -0
- package/src/file.ts +662 -0
- package/src/filesystem.ts +174 -0
- package/src/index.ts +25 -0
- package/src/inode.ts +132 -0
- package/src/mixins/async.ts +208 -0
- package/src/mixins/index.ts +5 -0
- package/src/mixins/mutexed.ts +257 -0
- package/src/mixins/readonly.ts +96 -0
- package/src/mixins/shared.ts +25 -0
- package/src/mixins/sync.ts +58 -0
- package/src/polyfills.ts +21 -0
- package/src/stats.ts +363 -0
- package/src/utils.ts +288 -0
- package/tests/common.ts +1 -11
- package/tests/fs/directory.test.ts +1 -1
- package/tests/fs/errors.test.ts +1 -1
- package/tests/fs/links.test.ts +1 -1
- package/tests/fs/open.test.ts +1 -1
- package/tests/fs/permissions.test.ts +4 -4
- package/tests/fs/readdir.test.ts +3 -3
- package/tests/fs/rename.test.ts +1 -1
- package/tests/fs/stat.test.ts +1 -1
- package/tests/fs/times.test.ts +2 -2
- package/tests/fs/truncate.test.ts +1 -1
- package/tests/port/channel.test.ts +3 -3
- package/tests/port/config.test.ts +4 -5
- package/tests/port/config.worker.js +5 -0
- package/tests/port/remote.test.ts +4 -5
- package/tests/port/remote.worker.js +5 -0
- package/tests/port/timeout.test.ts +2 -2
- package/tests/setup/common.ts +1 -1
- package/tests/setup/cow+fetch.ts +1 -1
- package/tests/port/config.worker.ts +0 -5
- package/tests/port/remote.worker.ts +0 -5
package/tests/fs/readdir.test.ts
CHANGED
|
@@ -67,9 +67,9 @@ suite('readdir and readdirSync', () => {
|
|
|
67
67
|
|
|
68
68
|
test('readdir returns Dirent recursively', async () => {
|
|
69
69
|
const entries = await fs.promises.readdir(testDir, { recursive: true, withFileTypes: true });
|
|
70
|
-
assert
|
|
71
|
-
assert
|
|
72
|
-
assert
|
|
70
|
+
assert(entries.find(entry => entry.path === 'file1.txt'));
|
|
71
|
+
assert(entries.find(entry => entry.path === 'subdir1/file4.txt'));
|
|
72
|
+
assert(entries.find(entry => entry.path === 'subdir2/file5.txt'));
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
// New test for readdirSync with recursive: true
|
package/tests/fs/rename.test.ts
CHANGED
package/tests/fs/stat.test.ts
CHANGED
package/tests/fs/times.test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { suite, test } from 'node:test';
|
|
3
3
|
import { wait } from 'utilium';
|
|
4
|
-
import { ErrnoError } from '../../
|
|
5
|
-
import { _toUnixTimestamp } from '../../
|
|
4
|
+
import { ErrnoError } from '../../dist/error.js';
|
|
5
|
+
import { _toUnixTimestamp } from '../../dist/utils.js';
|
|
6
6
|
import { fs } from '../common.js';
|
|
7
7
|
|
|
8
8
|
suite('times', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { suite, test } from 'node:test';
|
|
3
|
-
import type { FileHandle } from '../../src/emulation/promises.js';
|
|
4
3
|
import { fs } from '../common.js';
|
|
4
|
+
import type { FileHandle } from '../../dist/emulation/promises.js';
|
|
5
5
|
|
|
6
6
|
const path: string = 'truncate-file.txt',
|
|
7
7
|
size = 1024 * 16,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { suite, test } from 'node:test';
|
|
3
3
|
import { MessageChannel } from 'node:worker_threads';
|
|
4
|
-
import { Port, attachFS } from '../../
|
|
5
|
-
import type { StoreFS } from '../../
|
|
6
|
-
import { InMemory, configureSingle, fs, resolveMountConfig, type InMemoryStore } from '../../
|
|
4
|
+
import { Port, attachFS } from '../../dist/backends/port/fs.js';
|
|
5
|
+
import type { StoreFS } from '../../dist/index.js';
|
|
6
|
+
import { InMemory, configureSingle, fs, resolveMountConfig, type InMemoryStore } from '../../dist/index.js';
|
|
7
7
|
|
|
8
8
|
const { port1, port2 } = new MessageChannel(),
|
|
9
9
|
content = 'FS is in a port';
|
|
@@ -2,14 +2,13 @@ import assert from 'node:assert';
|
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { suite, test } from 'node:test';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import
|
|
6
|
-
import { Port } from '../../
|
|
7
|
-
import { configureSingle, fs } from '../../
|
|
8
|
-
import { createTSWorker } from '../common.js';
|
|
5
|
+
import { Worker } from 'node:worker_threads';
|
|
6
|
+
import { Port } from '../../dist/backends/port/fs.js';
|
|
7
|
+
import { configureSingle, fs } from '../../dist/index.js';
|
|
9
8
|
|
|
10
9
|
const dir = dirname(fileURLToPath(import.meta.url));
|
|
11
10
|
|
|
12
|
-
const port
|
|
11
|
+
const port = new Worker(dir + '/config.worker.js');
|
|
13
12
|
|
|
14
13
|
await suite('Remote FS with resolveRemoteMount', () => {
|
|
15
14
|
const content = 'FS is in a port';
|
|
@@ -2,14 +2,13 @@ import assert from 'node:assert';
|
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { suite, test } from 'node:test';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import
|
|
6
|
-
import { Port } from '../../
|
|
7
|
-
import { configureSingle, fs } from '../../
|
|
8
|
-
import { createTSWorker } from '../common.js';
|
|
5
|
+
import { Worker } from 'node:worker_threads';
|
|
6
|
+
import { Port } from '../../dist/backends/port/fs.js';
|
|
7
|
+
import { configureSingle, fs } from '../../dist/index.js';
|
|
9
8
|
|
|
10
9
|
const dir = dirname(fileURLToPath(import.meta.url));
|
|
11
10
|
|
|
12
|
-
const port
|
|
11
|
+
const port = new Worker(dir + '/remote.worker.js');
|
|
13
12
|
|
|
14
13
|
await suite('Remote FS', () => {
|
|
15
14
|
const content = 'FS is in a port';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { suite, test } from 'node:test';
|
|
3
3
|
import { MessageChannel } from 'node:worker_threads';
|
|
4
|
-
import { Port } from '../../
|
|
5
|
-
import { ErrnoError, InMemory, configure, configureSingle, fs } from '../../
|
|
4
|
+
import { Port } from '../../dist/backends/port/fs.js';
|
|
5
|
+
import { ErrnoError, InMemory, configure, configureSingle, fs } from '../../dist/index.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Tests a mis-configured PortFS using a MessageChannel
|
package/tests/setup/common.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, relative } from 'node:path';
|
|
2
2
|
import { statSync, readFileSync, readdirSync, existsSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { fs } from '../../
|
|
3
|
+
import { fs } from '../../dist/index.js';
|
|
4
4
|
|
|
5
5
|
export const data = join(import.meta.dirname, '../data');
|
|
6
6
|
|
package/tests/setup/cow+fetch.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { execSync } from 'node:child_process';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { createServer } from 'node:http';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
|
-
import { configureSingle, Fetch, InMemory, Overlay } from '../../
|
|
5
|
+
import { configureSingle, Fetch, InMemory, Overlay } from '../../dist/index.js';
|
|
6
6
|
import { data, tmp } from './common.js';
|
|
7
7
|
|
|
8
8
|
const port = 26514,
|