@zenfs/core 1.2.0 → 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/config.d.ts +13 -4
- package/dist/config.js +2 -1
- package/dist/emulation/config.d.ts +10 -0
- package/dist/emulation/config.js +10 -0
- package/dist/emulation/promises.js +2 -1
- package/dist/emulation/shared.d.ts +0 -6
- package/dist/emulation/shared.js +0 -6
- package/dist/emulation/sync.js +2 -1
- package/dist/file.d.ts +1 -1
- package/dist/file.js +6 -3
- package/package.json +1 -1
- package/readme.md +1 -1
- package/scripts/test.js +5 -0
- package/src/config.ts +17 -5
- package/src/emulation/config.ts +11 -0
- package/src/emulation/promises.ts +2 -1
- package/src/emulation/shared.ts +0 -7
- package/src/emulation/sync.ts +2 -1
- package/src/file.ts +4 -3
- 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/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/dist/config.d.ts
CHANGED
|
@@ -34,24 +34,33 @@ export interface Configuration<T extends ConfigMounts> extends SharedConfig {
|
|
|
34
34
|
gid: number;
|
|
35
35
|
/**
|
|
36
36
|
* Whether to automatically add normal Linux devices
|
|
37
|
-
* @default false
|
|
38
37
|
* @experimental
|
|
38
|
+
* @default false
|
|
39
39
|
*/
|
|
40
40
|
addDevices: boolean;
|
|
41
41
|
/**
|
|
42
42
|
* If true, enables caching stats for certain operations.
|
|
43
43
|
* This should reduce the number of stat calls performed.
|
|
44
|
-
* @default false
|
|
45
44
|
* @experimental
|
|
45
|
+
* @default false
|
|
46
46
|
*/
|
|
47
47
|
cacheStats: boolean;
|
|
48
48
|
/**
|
|
49
49
|
* If true, disables *all* permissions checking.
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
*
|
|
51
|
+
* This can increase performance.
|
|
52
52
|
* @experimental
|
|
53
|
+
* @default false
|
|
53
54
|
*/
|
|
54
55
|
disableAccessChecks: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* If true, disables `read` and `readSync` from immediately syncing the updated atime to the file system.
|
|
58
|
+
*
|
|
59
|
+
* This can increase performance.
|
|
60
|
+
* @experimental
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
disableSyncOnRead: boolean;
|
|
55
64
|
}
|
|
56
65
|
/**
|
|
57
66
|
* Configures ZenFS with single mount point /
|
package/dist/config.js
CHANGED
|
@@ -3,7 +3,7 @@ import { credentials } from './credentials.js';
|
|
|
3
3
|
import { DeviceFS, fullDevice, nullDevice, randomDevice, zeroDevice } from './devices.js';
|
|
4
4
|
import * as cache from './emulation/cache.js';
|
|
5
5
|
import * as fs from './emulation/index.js';
|
|
6
|
-
import { config } from './emulation/
|
|
6
|
+
import { config } from './emulation/config.js';
|
|
7
7
|
import { Errno, ErrnoError } from './error.js';
|
|
8
8
|
import { FileSystem } from './filesystem.js';
|
|
9
9
|
function isMountConfig(arg) {
|
|
@@ -70,6 +70,7 @@ export async function configure(configuration) {
|
|
|
70
70
|
Object.assign(credentials, { uid, gid, suid: uid, sgid: gid, euid: uid, egid: gid });
|
|
71
71
|
cache.setEnabled(configuration.cacheStats ?? false);
|
|
72
72
|
config.checkAccess = !configuration.disableAccessChecks;
|
|
73
|
+
config.syncOnRead = !configuration.disableSyncOnRead;
|
|
73
74
|
if (configuration.addDevices) {
|
|
74
75
|
const devfs = new DeviceFS();
|
|
75
76
|
devfs.createDevice('/null', nullDevice);
|
|
@@ -56,7 +56,8 @@ import * as cache from './cache.js';
|
|
|
56
56
|
import * as constants from './constants.js';
|
|
57
57
|
import { Dir, Dirent } from './dir.js';
|
|
58
58
|
import { dirname, join, parse } from './path.js';
|
|
59
|
-
import { _statfs,
|
|
59
|
+
import { _statfs, fd2file, fdMap, file2fd, fixError, mounts, resolveMount } from './shared.js';
|
|
60
|
+
import { config } from './config.js';
|
|
60
61
|
import { ReadStream, WriteStream } from './streams.js';
|
|
61
62
|
import { FSWatcher, emitChange } from './watchers.js';
|
|
62
63
|
export * as constants from './constants.js';
|
|
@@ -43,12 +43,6 @@ export declare function mountObject(mounts: MountObject): void;
|
|
|
43
43
|
* @hidden
|
|
44
44
|
*/
|
|
45
45
|
export declare function _statfs<const T extends boolean>(fs: FileSystem, bigint?: T): T extends true ? BigIntStatsFs : StatsFs;
|
|
46
|
-
export declare const config: {
|
|
47
|
-
/**
|
|
48
|
-
* Whether to perform access checks
|
|
49
|
-
*/
|
|
50
|
-
checkAccess: boolean;
|
|
51
|
-
};
|
|
52
46
|
/**
|
|
53
47
|
* Options used for caching, among other things.
|
|
54
48
|
* @internal *UNSTABLE*
|
package/dist/emulation/shared.js
CHANGED
package/dist/emulation/sync.js
CHANGED
|
@@ -53,7 +53,8 @@ import { decodeUTF8, normalizeMode, normalizeOptions, normalizePath, normalizeTi
|
|
|
53
53
|
import * as constants from './constants.js';
|
|
54
54
|
import { Dir, Dirent } from './dir.js';
|
|
55
55
|
import { dirname, join, parse } from './path.js';
|
|
56
|
-
import { _statfs,
|
|
56
|
+
import { _statfs, fd2file, fdMap, file2fd, fixError, mounts, resolveMount } from './shared.js';
|
|
57
|
+
import { config } from './config.js';
|
|
57
58
|
import { emitChange } from './watchers.js';
|
|
58
59
|
import * as cache from './cache.js';
|
|
59
60
|
export function renameSync(oldPath, newPath) {
|
package/dist/file.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FileReadResult } from 'node:fs/promises';
|
|
2
2
|
import type { FileSystem } from './filesystem.js';
|
|
3
|
-
import { Stats, type FileType } from './stats.js';
|
|
4
3
|
import './polyfills.js';
|
|
4
|
+
import { Stats, type FileType } from './stats.js';
|
|
5
5
|
/**
|
|
6
6
|
Typescript does not include a type declaration for resizable array buffers.
|
|
7
7
|
It has been standardized into ECMAScript though
|
package/dist/file.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY, S_IFMT, size_max } from './emulation/constants.js';
|
|
2
|
+
import { config } from './emulation/config.js';
|
|
2
3
|
import { Errno, ErrnoError } from './error.js';
|
|
3
|
-
import { Stats } from './stats.js';
|
|
4
4
|
import './polyfills.js';
|
|
5
|
+
import { Stats } from './stats.js';
|
|
5
6
|
const validFlags = ['r', 'r+', 'rs', 'rs+', 'w', 'wx', 'w+', 'wx+', 'a', 'ax', 'a+', 'ax+'];
|
|
6
7
|
export function parseFlag(flag) {
|
|
7
8
|
if (typeof flag === 'number') {
|
|
@@ -383,7 +384,8 @@ export class PreloadFile extends File {
|
|
|
383
384
|
*/
|
|
384
385
|
async read(buffer, offset, length, position) {
|
|
385
386
|
const bytesRead = this._read(buffer, offset, length, position);
|
|
386
|
-
|
|
387
|
+
if (config.syncOnRead)
|
|
388
|
+
await this.sync();
|
|
387
389
|
return { bytesRead, buffer };
|
|
388
390
|
}
|
|
389
391
|
/**
|
|
@@ -397,7 +399,8 @@ export class PreloadFile extends File {
|
|
|
397
399
|
*/
|
|
398
400
|
readSync(buffer, offset, length, position) {
|
|
399
401
|
const bytesRead = this._read(buffer, offset, length, position);
|
|
400
|
-
|
|
402
|
+
if (config.syncOnRead)
|
|
403
|
+
this.syncSync();
|
|
401
404
|
return bytesRead;
|
|
402
405
|
}
|
|
403
406
|
async chmod(mode) {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -32,7 +32,7 @@ npm install @zenfs/core
|
|
|
32
32
|
```js
|
|
33
33
|
import { fs } from '@zenfs/core'; // You can also use the default export
|
|
34
34
|
|
|
35
|
-
fs.writeFileSync('/test.txt', 'You can do this
|
|
35
|
+
fs.writeFileSync('/test.txt', 'You can do this anywhere, including browsers!');
|
|
36
36
|
|
|
37
37
|
const contents = fs.readFileSync('/test.txt', 'utf-8');
|
|
38
38
|
console.log(contents);
|
package/scripts/test.js
CHANGED
|
@@ -31,6 +31,11 @@ options:
|
|
|
31
31
|
|
|
32
32
|
if (options.verbose) console.debug('Forcing tests to exit (--test-force-exit)');
|
|
33
33
|
|
|
34
|
+
if (!existsSync(join(import.meta.dirname, '../dist'))) {
|
|
35
|
+
console.log('ERROR: Missing build. If you are using an installed package, please submit a bug report.');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
const testsGlob = join(import.meta.dirname, `../tests/fs/${options.test || '*'}.test.ts`);
|
|
35
40
|
|
|
36
41
|
for (const setupFile of positionals) {
|
package/src/config.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { DeviceFS, fullDevice, nullDevice, randomDevice, zeroDevice } from './de
|
|
|
5
5
|
import * as cache from './emulation/cache.js';
|
|
6
6
|
import * as fs from './emulation/index.js';
|
|
7
7
|
import type { AbsolutePath } from './emulation/path.js';
|
|
8
|
-
import {
|
|
8
|
+
import { type MountObject } from './emulation/shared.js';
|
|
9
|
+
import { config } from './emulation/config.js';
|
|
9
10
|
import { Errno, ErrnoError } from './error.js';
|
|
10
11
|
import { FileSystem } from './filesystem.js';
|
|
11
12
|
|
|
@@ -95,26 +96,36 @@ export interface Configuration<T extends ConfigMounts> extends SharedConfig {
|
|
|
95
96
|
|
|
96
97
|
/**
|
|
97
98
|
* Whether to automatically add normal Linux devices
|
|
98
|
-
* @default false
|
|
99
99
|
* @experimental
|
|
100
|
+
* @default false
|
|
100
101
|
*/
|
|
101
102
|
addDevices: boolean;
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
105
|
* If true, enables caching stats for certain operations.
|
|
105
106
|
* This should reduce the number of stat calls performed.
|
|
106
|
-
* @default false
|
|
107
107
|
* @experimental
|
|
108
|
+
* @default false
|
|
108
109
|
*/
|
|
109
110
|
cacheStats: boolean;
|
|
110
111
|
|
|
111
112
|
/**
|
|
112
113
|
* If true, disables *all* permissions checking.
|
|
113
|
-
*
|
|
114
|
-
*
|
|
114
|
+
*
|
|
115
|
+
* This can increase performance.
|
|
115
116
|
* @experimental
|
|
117
|
+
* @default false
|
|
116
118
|
*/
|
|
117
119
|
disableAccessChecks: boolean;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* If true, disables `read` and `readSync` from immediately syncing the updated atime to the file system.
|
|
123
|
+
*
|
|
124
|
+
* This can increase performance.
|
|
125
|
+
* @experimental
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
disableSyncOnRead: boolean;
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
/**
|
|
@@ -142,6 +153,7 @@ export async function configure<T extends ConfigMounts>(configuration: Partial<C
|
|
|
142
153
|
|
|
143
154
|
cache.setEnabled(configuration.cacheStats ?? false);
|
|
144
155
|
config.checkAccess = !configuration.disableAccessChecks;
|
|
156
|
+
config.syncOnRead = !configuration.disableSyncOnRead;
|
|
145
157
|
|
|
146
158
|
if (configuration.addDevices) {
|
|
147
159
|
const devfs = new DeviceFS();
|
|
@@ -16,7 +16,8 @@ import * as cache from './cache.js';
|
|
|
16
16
|
import * as constants from './constants.js';
|
|
17
17
|
import { Dir, Dirent } from './dir.js';
|
|
18
18
|
import { dirname, join, parse } from './path.js';
|
|
19
|
-
import { _statfs,
|
|
19
|
+
import { _statfs, fd2file, fdMap, file2fd, fixError, mounts, resolveMount, type InternalOptions, type ReaddirOptions } from './shared.js';
|
|
20
|
+
import { config } from './config.js';
|
|
20
21
|
import { ReadStream, WriteStream } from './streams.js';
|
|
21
22
|
import { FSWatcher, emitChange } from './watchers.js';
|
|
22
23
|
export * as constants from './constants.js';
|
package/src/emulation/shared.ts
CHANGED
|
@@ -134,13 +134,6 @@ export function _statfs<const T extends boolean>(fs: FileSystem, bigint?: T): T
|
|
|
134
134
|
} as T extends true ? BigIntStatsFs : StatsFs;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
export const config = {
|
|
138
|
-
/**
|
|
139
|
-
* Whether to perform access checks
|
|
140
|
-
*/
|
|
141
|
-
checkAccess: true,
|
|
142
|
-
};
|
|
143
|
-
|
|
144
137
|
/**
|
|
145
138
|
* Options used for caching, among other things.
|
|
146
139
|
* @internal *UNSTABLE*
|
package/src/emulation/sync.ts
CHANGED
|
@@ -9,7 +9,8 @@ import { decodeUTF8, normalizeMode, normalizeOptions, normalizePath, normalizeTi
|
|
|
9
9
|
import * as constants from './constants.js';
|
|
10
10
|
import { Dir, Dirent } from './dir.js';
|
|
11
11
|
import { dirname, join, parse } from './path.js';
|
|
12
|
-
import { _statfs,
|
|
12
|
+
import { _statfs, fd2file, fdMap, file2fd, fixError, mounts, resolveMount, type InternalOptions, type ReaddirOptions } from './shared.js';
|
|
13
|
+
import { config } from './config.js';
|
|
13
14
|
import { emitChange } from './watchers.js';
|
|
14
15
|
import * as cache from './cache.js';
|
|
15
16
|
|
package/src/file.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { FileReadResult } from 'node:fs/promises';
|
|
2
2
|
import { O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY, S_IFMT, size_max } from './emulation/constants.js';
|
|
3
|
+
import { config } from './emulation/config.js';
|
|
3
4
|
import { Errno, ErrnoError } from './error.js';
|
|
4
5
|
import type { FileSystem } from './filesystem.js';
|
|
5
|
-
import { Stats, type FileType } from './stats.js';
|
|
6
6
|
import './polyfills.js';
|
|
7
|
+
import { Stats, type FileType } from './stats.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
Typescript does not include a type declaration for resizable array buffers.
|
|
@@ -541,7 +542,7 @@ export class PreloadFile<FS extends FileSystem> extends File {
|
|
|
541
542
|
*/
|
|
542
543
|
public async read<TBuffer extends ArrayBufferView>(buffer: TBuffer, offset?: number, length?: number, position?: number): Promise<{ bytesRead: number; buffer: TBuffer }> {
|
|
543
544
|
const bytesRead = this._read(buffer, offset, length, position);
|
|
544
|
-
await this.sync();
|
|
545
|
+
if (config.syncOnRead) await this.sync();
|
|
545
546
|
return { bytesRead, buffer };
|
|
546
547
|
}
|
|
547
548
|
|
|
@@ -556,7 +557,7 @@ export class PreloadFile<FS extends FileSystem> extends File {
|
|
|
556
557
|
*/
|
|
557
558
|
public readSync(buffer: ArrayBufferView, offset?: number, length?: number, position?: number): number {
|
|
558
559
|
const bytesRead = this._read(buffer, offset, length, position);
|
|
559
|
-
this.
|
|
560
|
+
if (config.syncOnRead) this.syncSync();
|
|
560
561
|
return bytesRead;
|
|
561
562
|
}
|
|
562
563
|
|
package/tests/common.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { join, resolve } from 'node:path';
|
|
2
|
-
import {
|
|
3
|
-
import { fs } from '../src/index.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a Typescript Worker
|
|
7
|
-
* @see https://github.com/privatenumber/tsx/issues/354
|
|
8
|
-
* @see https://github.com/nodejs/node/issues/47747#issuecomment-2287745567
|
|
9
|
-
*/
|
|
10
|
-
export function createTSWorker(source: string): Worker {
|
|
11
|
-
return new Worker(`import('tsx/esm/api').then(tsx => {tsx.register();import('${source}');});`, { eval: true });
|
|
12
|
-
}
|
|
2
|
+
import { fs } from '../dist/index.js';
|
|
13
3
|
|
|
14
4
|
const setupPath = resolve(process.env.SETUP || join(import.meta.dirname, 'setup/memory.ts'));
|
|
15
5
|
|
package/tests/fs/errors.test.ts
CHANGED
package/tests/fs/links.test.ts
CHANGED
package/tests/fs/open.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { suite, test } from 'node:test';
|
|
3
|
-
import { R_OK, W_OK, X_OK } from '../../
|
|
4
|
-
import { join } from '../../
|
|
5
|
-
import { ErrnoError } from '../../
|
|
6
|
-
import { encodeUTF8 } from '../../
|
|
3
|
+
import { R_OK, W_OK, X_OK } from '../../dist/emulation/constants.js';
|
|
4
|
+
import { join } from '../../dist/emulation/path.js';
|
|
5
|
+
import { ErrnoError } from '../../dist/error.js';
|
|
6
|
+
import { encodeUTF8 } from '../../dist/utils.js';
|
|
7
7
|
import { fs } from '../common.js';
|
|
8
8
|
|
|
9
9
|
suite('Permissions', () => {
|
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,
|