@zenfs/core 0.0.3 → 0.0.5

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.
Files changed (47) hide show
  1. package/dist/ApiError.d.ts +1 -1
  2. package/dist/ApiError.js +1 -1
  3. package/dist/backends/AsyncMirror.d.ts +5 -5
  4. package/dist/backends/AsyncMirror.js +5 -5
  5. package/dist/backends/AsyncStore.d.ts +5 -5
  6. package/dist/backends/AsyncStore.js +7 -7
  7. package/dist/backends/FolderAdapter.d.ts +2 -2
  8. package/dist/backends/FolderAdapter.js +4 -4
  9. package/dist/backends/InMemory.d.ts +3 -3
  10. package/dist/backends/InMemory.js +2 -2
  11. package/dist/backends/Locked.d.ts +6 -6
  12. package/dist/backends/Locked.js +1 -1
  13. package/dist/backends/OverlayFS.d.ts +6 -6
  14. package/dist/backends/OverlayFS.js +7 -7
  15. package/dist/backends/SyncStore.d.ts +5 -5
  16. package/dist/backends/SyncStore.js +9 -12
  17. package/dist/backends/backend.d.ts +1 -1
  18. package/dist/backends/backend.js +1 -1
  19. package/dist/backends/index.d.ts +5 -5
  20. package/dist/backends/index.js +4 -4
  21. package/dist/browser.min.js +5 -5
  22. package/dist/browser.min.js.map +4 -4
  23. package/dist/emulation/callbacks.d.ts +4 -4
  24. package/dist/emulation/callbacks.js +4 -4
  25. package/dist/emulation/fs.d.ts +3 -3
  26. package/dist/emulation/fs.js +2 -2
  27. package/dist/emulation/index.d.ts +5 -5
  28. package/dist/emulation/index.js +5 -7
  29. package/dist/emulation/promises.d.ts +5 -5
  30. package/dist/emulation/promises.js +4 -4
  31. package/dist/emulation/shared.d.ts +5 -5
  32. package/dist/emulation/shared.js +5 -4
  33. package/dist/emulation/sync.d.ts +4 -4
  34. package/dist/emulation/sync.js +3 -3
  35. package/dist/file.d.ts +3 -3
  36. package/dist/file.js +4 -4
  37. package/dist/filesystem.d.ts +5 -5
  38. package/dist/filesystem.js +2 -2
  39. package/dist/index.d.ts +14 -14
  40. package/dist/index.js +17 -21
  41. package/dist/inode.d.ts +2 -2
  42. package/dist/inode.js +1 -1
  43. package/dist/stats.d.ts +3 -3
  44. package/dist/stats.js +3 -3
  45. package/dist/utils.d.ts +4 -4
  46. package/dist/utils.js +1 -1
  47. package/package.json +1 -4
@@ -1,8 +1,8 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
3
  import type { FSWatcher, ReadStream, WriteStream, symlink as _symlink } from 'fs';
4
- import { BFSCallback, BFSOneArgCallback, BFSThreeArgCallback, FileContents } from '../filesystem';
5
- import { Stats } from '../stats';
4
+ import { BFSCallback, BFSOneArgCallback, BFSThreeArgCallback, FileContents } from '../filesystem.js';
5
+ import { Stats } from '../stats.js';
6
6
  /**
7
7
  * Asynchronous rename. No arguments other than a possible exception are given
8
8
  * to the completion callback.
@@ -1,7 +1,7 @@
1
- import { ApiError, ErrorCode } from '../ApiError';
2
- import { nop, normalizeMode } from './shared';
3
- import * as promises from './promises';
4
- import { R_OK } from './constants';
1
+ import { ApiError, ErrorCode } from '../ApiError.js';
2
+ import { nop, normalizeMode } from './shared.js';
3
+ import * as promises from './promises.js';
4
+ import { R_OK } from './constants.js';
5
5
  /**
6
6
  * Asynchronous rename. No arguments other than a possible exception are given
7
7
  * to the completion callback.
@@ -1,7 +1,7 @@
1
- /// <reference types="node" />
2
- import * as fs_mock from './index';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import * as fs_mock from './index.js';
3
3
  import type * as fs_node from 'node:fs';
4
4
  type ZenFSModule = typeof fs_node & typeof fs_mock;
5
5
  declare const fs: ZenFSModule;
6
- export * from './index';
6
+ export * from './index.js';
7
7
  export default fs;
@@ -1,5 +1,5 @@
1
- import * as fs_mock from './index';
1
+ import * as fs_mock from './index.js';
2
2
  // @ts-expect-error 2322
3
3
  const fs = fs_mock;
4
- export * from './index';
4
+ export * from './index.js';
5
5
  export default fs;
@@ -1,5 +1,5 @@
1
- export * from './callbacks';
2
- export * from './sync';
3
- export * as promises from './promises';
4
- export * as constants from './constants';
5
- export { initialize, getMount, getMounts, mount, umount, _toUnixTimestamp } from './shared';
1
+ export * from './callbacks.js';
2
+ export * from './sync.js';
3
+ export * as promises from './promises.js';
4
+ export * as constants from './constants.js';
5
+ export { initialize, getMount, getMounts, mount, umount, _toUnixTimestamp } from './shared.js';
@@ -1,7 +1,5 @@
1
- export * from './callbacks';
2
- export * from './sync';
3
- import * as promises_1 from './promises';
4
- export { promises_1 as promises };
5
- import * as constants_1 from './constants';
6
- export { constants_1 as constants };
7
- export { initialize, getMount, getMounts, mount, umount, _toUnixTimestamp } from './shared';
1
+ export * from './callbacks.js';
2
+ export * from './sync.js';
3
+ export * as promises from './promises.js';
4
+ export * as constants from './constants.js';
5
+ export { initialize, getMount, getMounts, mount, umount, _toUnixTimestamp } from './shared.js';
@@ -1,10 +1,10 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
3
  import type { ReadStream, WriteStream, FSWatcher, symlink as _symlink } from 'node:fs';
4
- import * as constants from './constants';
4
+ import * as constants from './constants.js';
5
5
  export { constants };
6
- import { FileContents } from '../filesystem';
7
- import { Stats } from '../stats';
6
+ import { FileContents } from '../filesystem.js';
7
+ import { Stats } from '../stats.js';
8
8
  /**
9
9
  * Renames a file
10
10
  * @param oldPath
@@ -7,11 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { ApiError, ErrorCode } from '../ApiError';
11
- import * as constants from './constants';
10
+ import { ApiError, ErrorCode } from '../ApiError.js';
11
+ import * as constants from './constants.js';
12
12
  export { constants };
13
- import { FileFlag } from '../file';
14
- import { normalizePath, normalizeMode, getFdForFile, normalizeOptions, fd2file, fdMap, normalizeTime, cred, nop, resolveFS, fixError, mounts } from './shared';
13
+ import { FileFlag } from '../file.js';
14
+ import { normalizePath, normalizeMode, getFdForFile, normalizeOptions, fd2file, fdMap, normalizeTime, cred, nop, resolveFS, fixError, mounts } from './shared.js';
15
15
  /**
16
16
  * Utility for FS ops. It handles
17
17
  * - path normalization (for the first parameter to the FS op)
@@ -1,8 +1,8 @@
1
- /// <reference types="node" />
2
- import { Cred } from '../cred';
3
- import { FileSystem } from '../filesystem';
4
- import { File } from '../file';
5
- import { BackendConstructor } from '../backends/backend';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Cred } from '../cred.js';
3
+ import { FileSystem } from '../filesystem.js';
4
+ import { File } from '../file.js';
5
+ import { BackendConstructor } from '../backends/backend.js';
6
6
  /**
7
7
  * converts Date or number to a fractional UNIX timestamp
8
8
  * Grabbed from NodeJS sources (lib/fs.js)
@@ -1,8 +1,9 @@
1
1
  // Utilities and shared data
2
2
  import { posix as path } from 'path';
3
- import { ApiError, ErrorCode } from '../ApiError';
4
- //import { BackendConstructor } from '../backends';
5
- import { InMemoryFileSystem } from '../backends/InMemory';
3
+ import { ApiError, ErrorCode } from '../ApiError.js';
4
+ import { Cred } from '../cred.js';
5
+ //import { BackendConstructor } from '../backends.js';
6
+ import { InMemoryFileSystem } from '../backends/InMemory.js';
6
7
  /**
7
8
  * converts Date or number to a fractional UNIX timestamp
8
9
  * Grabbed from NodeJS sources (lib/fs.js)
@@ -84,7 +85,7 @@ export function nop() {
84
85
  // do nothing
85
86
  }
86
87
  // credentials
87
- export let cred;
88
+ export let cred = Cred.Root;
88
89
  export function setCred(val) {
89
90
  cred = val;
90
91
  }
@@ -1,7 +1,7 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { FileContents } from '../filesystem';
4
- import { Stats } from '../stats';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ import { FileContents } from '../filesystem.js';
4
+ import { Stats } from '../stats.js';
5
5
  import type { symlink, ReadSyncOptions } from 'fs';
6
6
  /**
7
7
  * Synchronous rename.
@@ -1,6 +1,6 @@
1
- import { ApiError, ErrorCode } from '../ApiError';
2
- import { FileFlag } from '../file';
3
- import { normalizePath, cred, getFdForFile, normalizeMode, normalizeOptions, fdMap, fd2file, normalizeTime, resolveFS, fixError, mounts } from './shared';
1
+ import { ApiError, ErrorCode } from '../ApiError.js';
2
+ import { FileFlag } from '../file.js';
3
+ import { normalizePath, cred, getFdForFile, normalizeMode, normalizeOptions, fdMap, fd2file, normalizeTime, resolveFS, fixError, mounts } from './shared.js';
4
4
  function doOp(...[name, resolveSymlinks, path, ...args]) {
5
5
  path = normalizePath(path);
6
6
  const { fs, path: resolvedPath } = resolveFS(resolveSymlinks && existsSync(path) ? realpathSync(path) : path);
package/dist/file.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- /// <reference types="node" />
2
- import { Stats } from './stats';
3
- import { FileSystem } from './filesystem';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Stats } from './stats.js';
3
+ import { FileSystem } from './filesystem.js';
4
4
  export declare enum ActionType {
5
5
  NOP = 0,
6
6
  THROW_EXCEPTION = 1,
package/dist/file.js CHANGED
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { ApiError, ErrorCode } from './ApiError';
11
- import { Stats } from './stats';
12
- import { getMount } from './emulation/shared';
10
+ import { ApiError, ErrorCode } from './ApiError.js';
11
+ import { Stats } from './stats.js';
12
+ import { getMount } from './emulation/shared.js';
13
13
  import { Buffer } from 'buffer';
14
14
  export var ActionType;
15
15
  (function (ActionType) {
@@ -21,7 +21,7 @@ export var ActionType;
21
21
  ActionType[ActionType["TRUNCATE_FILE"] = 2] = "TRUNCATE_FILE";
22
22
  // Indicates that the code should create the file.
23
23
  ActionType[ActionType["CREATE_FILE"] = 3] = "CREATE_FILE";
24
- })(ActionType || (ActionType = {}));
24
+ })(ActionType = ActionType || (ActionType = {}));
25
25
  /**
26
26
  * Represents one of the following file flags. A convenience object.
27
27
  *
@@ -1,8 +1,8 @@
1
- /// <reference types="node" />
2
- import { ApiError } from './ApiError';
3
- import { Stats } from './stats';
4
- import { File, FileFlag } from './file';
5
- import { Cred } from './cred';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { ApiError } from './ApiError.js';
3
+ import { Stats } from './stats.js';
4
+ import { File, FileFlag } from './file.js';
5
+ import { Cred } from './cred.js';
6
6
  export type BFSOneArgCallback = (e?: ApiError) => unknown;
7
7
  export type BFSCallback<T> = (e?: ApiError, rv?: T) => unknown;
8
8
  export type BFSThreeArgCallback<T, U> = (e?: ApiError, arg1?: T, arg2?: U) => unknown;
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  });
11
11
  };
12
12
  var _a;
13
- import { ApiError, ErrorCode } from './ApiError';
14
- import { FileFlag, ActionType } from './file';
13
+ import { ApiError, ErrorCode } from './ApiError.js';
14
+ import { FileFlag, ActionType } from './file.js';
15
15
  import * as path from 'path';
16
16
  import { Buffer } from 'buffer';
17
17
  /**
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * ZenFS's main module. This is exposed in the browser via the ZenFS global.
3
3
  */
4
- import fs from './emulation/fs';
5
- import { FileSystem, type BFSOneArgCallback, type BFSCallback } from './filesystem';
6
- import { backends } from './backends';
4
+ import fs from './emulation/fs.js';
5
+ import { FileSystem, type BFSOneArgCallback, type BFSCallback } from './filesystem.js';
6
+ import { backends } from './backends/index.js';
7
7
  /**
8
8
  * Initializes ZenFS with the given file systems.
9
9
  */
@@ -63,16 +63,16 @@ export interface FileSystemConfiguration {
63
63
  */
64
64
  export declare function getFileSystem(config: FileSystemConfiguration): Promise<FileSystem>;
65
65
  export declare function getFileSystem(config: FileSystemConfiguration, cb: BFSCallback<FileSystem>): void;
66
- export * from './backends';
67
- export * from './backends/AsyncStore';
68
- export * from './backends/SyncStore';
69
- export * from './ApiError';
70
- export * from './cred';
71
- export * from './file';
72
- export * from './filesystem';
73
- export * from './inode';
74
- export * from './mutex';
75
- export * from './stats';
76
- export * from './utils';
66
+ export * from './backends/index.js';
67
+ export * from './backends/AsyncStore.js';
68
+ export * from './backends/SyncStore.js';
69
+ export * from './ApiError.js';
70
+ export * from './cred.js';
71
+ export * from './file.js';
72
+ export * from './filesystem.js';
73
+ export * from './inode.js';
74
+ export * from './mutex.js';
75
+ export * from './stats.js';
76
+ export * from './utils.js';
77
77
  export { fs };
78
78
  export default fs;
package/dist/index.js CHANGED
@@ -10,16 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  step((generator = generator.apply(thisArg, _arguments || [])).next());
11
11
  });
12
12
  };
13
- import fs from './emulation/fs';
14
- import { FileSystem } from './filesystem';
15
- import { backends } from './backends';
16
- import { ErrorCode, ApiError } from './ApiError';
17
- import { Cred } from './cred';
18
- import * as process from 'process';
19
- import { setCred } from './emulation/shared';
20
- if (process && process['initializeTTYs']) {
21
- process['initializeTTYs']();
22
- }
13
+ import fs from './emulation/fs.js';
14
+ import { FileSystem } from './filesystem.js';
15
+ import { backends } from './backends/index.js';
16
+ import { ErrorCode, ApiError } from './ApiError.js';
17
+ import { Cred } from './cred.js';
18
+ import { setCred } from './emulation/shared.js';
23
19
  /**
24
20
  * Initializes ZenFS with the given file systems.
25
21
  */
@@ -98,16 +94,16 @@ export function getFileSystem(config, cb) {
98
94
  .catch(err => cb(err));
99
95
  return;
100
96
  }
101
- export * from './backends';
102
- export * from './backends/AsyncStore';
103
- export * from './backends/SyncStore';
104
- export * from './ApiError';
105
- export * from './cred';
106
- export * from './file';
107
- export * from './filesystem';
108
- export * from './inode';
109
- export * from './mutex';
110
- export * from './stats';
111
- export * from './utils';
97
+ export * from './backends/index.js';
98
+ export * from './backends/AsyncStore.js';
99
+ export * from './backends/SyncStore.js';
100
+ export * from './ApiError.js';
101
+ export * from './cred.js';
102
+ export * from './file.js';
103
+ export * from './filesystem.js';
104
+ export * from './inode.js';
105
+ export * from './mutex.js';
106
+ export * from './stats.js';
107
+ export * from './utils.js';
112
108
  export { fs };
113
109
  export default fs;
package/dist/inode.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /// <reference types="node" />
2
- import { Stats } from './stats';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Stats } from './stats.js';
3
3
  /**
4
4
  * Generic inode definition that can easily be serialized.
5
5
  */
package/dist/inode.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Stats, FileType } from './stats';
1
+ import { Stats, FileType } from './stats.js';
2
2
  import { Buffer } from 'buffer';
3
3
  /**
4
4
  * Generic inode definition that can easily be serialized.
package/dist/stats.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
3
  import type { StatsBase } from 'fs';
4
- import { Cred } from './cred';
4
+ import { Cred } from './cred.js';
5
5
  /**
6
6
  * Indicates the type of the given file. Applied to 'mode'.
7
7
  */
package/dist/stats.js CHANGED
@@ -1,6 +1,6 @@
1
- import { Cred } from './cred';
1
+ import { Cred } from './cred.js';
2
2
  import { Buffer } from 'buffer';
3
- import { S_IFDIR, S_IFLNK, S_IFMT, S_IFREG } from './emulation/constants';
3
+ import { S_IFDIR, S_IFLNK, S_IFMT, S_IFREG } from './emulation/constants.js';
4
4
  /**
5
5
  * Indicates the type of the given file. Applied to 'mode'.
6
6
  */
@@ -9,7 +9,7 @@ export var FileType;
9
9
  FileType[FileType["FILE"] = S_IFREG] = "FILE";
10
10
  FileType[FileType["DIRECTORY"] = S_IFDIR] = "DIRECTORY";
11
11
  FileType[FileType["SYMLINK"] = S_IFLNK] = "SYMLINK";
12
- })(FileType || (FileType = {}));
12
+ })(FileType = FileType || (FileType = {}));
13
13
  /**
14
14
  * Implementation of Node's `Stats`.
15
15
  *
package/dist/utils.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  /**
3
3
  * Grab bag of utility functions used across the code.
4
4
  */
5
- import { FileSystem } from './filesystem';
6
- import { Cred } from './cred';
7
- import type { BaseBackendConstructor } from './backends/backend';
5
+ import { FileSystem } from './filesystem.js';
6
+ import { Cred } from './cred.js';
7
+ import type { BaseBackendConstructor } from './backends/backend.js';
8
8
  /**
9
9
  * Synchronous recursive makedir.
10
10
  * @internal
package/dist/utils.js CHANGED
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { ErrorCode, ApiError } from './ApiError';
10
+ import { ErrorCode, ApiError } from './ApiError.js';
11
11
  import * as path from 'path';
12
12
  import { Buffer } from 'buffer';
13
13
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenfs/core",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "A filesystem in your browser",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist",
@@ -50,8 +50,6 @@
50
50
  "@typescript-eslint/eslint-plugin": "^5.55.0",
51
51
  "@typescript-eslint/parser": "^5.55.0",
52
52
  "archiver": "~2.1.1",
53
- "bfs-path": "~0.1.2",
54
- "bfs-process": "~0.1.6",
55
53
  "buffer": "~5.1.0",
56
54
  "cross-env": "^7.0.3",
57
55
  "esbuild": "^0.17.18",
@@ -60,7 +58,6 @@
60
58
  "jest": "^29.5.0",
61
59
  "path": "^0.12.7",
62
60
  "prettier": "^2.8.7",
63
- "source-map-loader": "~0.2.3",
64
61
  "ts-jest": "^29.1.0",
65
62
  "typedoc": "^0.25.1",
66
63
  "typescript": "^4.9.5"