@zenfs/core 0.12.0 → 0.12.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/backend.d.ts +15 -5
- package/dist/backends/index/index.d.ts +5 -0
- package/dist/backends/index/index.js +1 -0
- package/dist/backends/port/fs.d.ts +2 -1
- package/dist/browser.min.js +8 -4
- package/dist/browser.min.js.map +4 -4
- package/dist/config.d.ts +33 -11
- package/dist/config.js +16 -7
- package/dist/emulation/async.d.ts +1 -0
- package/dist/emulation/async.js +3 -2
- package/dist/emulation/path.d.ts +4 -1
- package/dist/emulation/promises.js +26 -14
- package/dist/emulation/sync.js +27 -15
- package/dist/file.js +8 -8
- package/dist/filesystem.d.ts +22 -2
- package/dist/filesystem.js +37 -8
- package/dist/stats.js +1 -1
- package/package.json +2 -2
- package/src/backends/backend.ts +15 -6
- package/src/backends/index/index.ts +5 -0
- package/src/config.ts +62 -21
- package/src/emulation/async.ts +14 -13
- package/src/emulation/path.ts +4 -1
- package/src/emulation/promises.ts +25 -14
- package/src/emulation/sync.ts +29 -18
- package/src/error.ts +1 -1
- package/src/file.ts +9 -8
- package/src/filesystem.ts +106 -51
- package/src/stats.ts +3 -3
|
@@ -4,7 +4,7 @@ type OptionType = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undef
|
|
|
4
4
|
/**
|
|
5
5
|
* Resolves the type of Backend.options from the options interface
|
|
6
6
|
*/
|
|
7
|
-
type OptionsConfig<T> = {
|
|
7
|
+
export type OptionsConfig<T> = {
|
|
8
8
|
[K in keyof T]: {
|
|
9
9
|
/**
|
|
10
10
|
* The basic JavaScript type(s) for this option.
|
|
@@ -54,7 +54,16 @@ export interface Backend<FS extends FileSystem = FileSystem, TOptions extends ob
|
|
|
54
54
|
*/
|
|
55
55
|
isAvailable(): boolean | Promise<boolean>;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Gets the options type of a backend
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export type OptionsOf<T extends Backend> = T extends Backend<FileSystem, infer TOptions> ? TOptions : never;
|
|
62
|
+
/**
|
|
63
|
+
* Gets the FileSystem type for a backend
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export type FilesystemOf<T extends Backend> = T extends Backend<infer FS> ? FS : never;
|
|
58
67
|
/**
|
|
59
68
|
* @internal
|
|
60
69
|
*/
|
|
@@ -63,7 +72,7 @@ export declare function isBackend(arg: unknown): arg is Backend;
|
|
|
63
72
|
* Checks that the given options object is valid for the file system options.
|
|
64
73
|
* @internal
|
|
65
74
|
*/
|
|
66
|
-
export declare function checkOptions<T extends Backend>(backend: T, opts:
|
|
75
|
+
export declare function checkOptions<T extends Backend>(backend: T, opts: Record<string, unknown>): Promise<void>;
|
|
67
76
|
/**
|
|
68
77
|
* Specifies a file system backend type and its options.
|
|
69
78
|
*
|
|
@@ -72,11 +81,12 @@ export declare function checkOptions<T extends Backend>(backend: T, opts: Partia
|
|
|
72
81
|
*
|
|
73
82
|
* The option object for each file system corresponds to that file system's option object passed to its `Create()` method.
|
|
74
83
|
*/
|
|
75
|
-
export type BackendConfiguration<T extends Backend
|
|
84
|
+
export type BackendConfiguration<T extends Backend> = OptionsOf<T> & {
|
|
76
85
|
backend: T;
|
|
86
|
+
disableAsyncCache?: boolean;
|
|
77
87
|
};
|
|
78
88
|
/**
|
|
79
89
|
* @internal
|
|
80
90
|
*/
|
|
81
|
-
export declare function isBackendConfig(arg: unknown): arg is BackendConfiguration
|
|
91
|
+
export declare function isBackendConfig<T extends Backend>(arg: unknown): arg is BackendConfiguration<T>;
|
|
82
92
|
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Stats, StatsLike } from '../../stats.js';
|
|
2
|
+
/**
|
|
3
|
+
* An Index in JSON form
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
2
6
|
export interface IndexData {
|
|
3
7
|
version: 1;
|
|
4
8
|
entries: Record<string, StatsLike<number>>;
|
|
@@ -6,6 +10,7 @@ export interface IndexData {
|
|
|
6
10
|
export declare const version = 1;
|
|
7
11
|
/**
|
|
8
12
|
* An index of files
|
|
13
|
+
* @internal
|
|
9
14
|
*/
|
|
10
15
|
export declare class Index extends Map<string, Stats> {
|
|
11
16
|
constructor();
|
|
@@ -40,7 +40,8 @@ export declare class PortFile extends File {
|
|
|
40
40
|
type FSMethods = ExtractProperties<FileSystem, (...args: any[]) => Promise<any> | FileSystemMetadata>;
|
|
41
41
|
type FSMethod = keyof FSMethods;
|
|
42
42
|
declare const PortFS_base: (abstract new (...args: any[]) => {
|
|
43
|
-
|
|
43
|
+
_disableSync: boolean;
|
|
44
|
+
_sync?: FileSystem | undefined;
|
|
44
45
|
queueDone(): Promise<void>;
|
|
45
46
|
metadata(): FileSystemMetadata;
|
|
46
47
|
ready(): Promise<void>;
|