@zenfs/core 0.0.2 → 0.0.4

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 (45) hide show
  1. package/dist/ApiError.d.ts +1 -1
  2. package/dist/backends/AsyncMirror.d.ts +5 -5
  3. package/dist/backends/AsyncMirror.js +5 -5
  4. package/dist/backends/AsyncStore.d.ts +5 -5
  5. package/dist/backends/AsyncStore.js +7 -7
  6. package/dist/backends/FolderAdapter.d.ts +2 -2
  7. package/dist/backends/FolderAdapter.js +4 -4
  8. package/dist/backends/InMemory.d.ts +3 -3
  9. package/dist/backends/InMemory.js +2 -2
  10. package/dist/backends/Locked.d.ts +6 -6
  11. package/dist/backends/Locked.js +1 -1
  12. package/dist/backends/OverlayFS.d.ts +6 -6
  13. package/dist/backends/OverlayFS.js +7 -7
  14. package/dist/backends/SyncStore.d.ts +5 -5
  15. package/dist/backends/SyncStore.js +7 -7
  16. package/dist/backends/backend.d.ts +1 -1
  17. package/dist/backends/backend.js +1 -1
  18. package/dist/backends/index.d.ts +5 -5
  19. package/dist/backends/index.js +4 -4
  20. package/dist/browser.min.js.map +1 -1
  21. package/dist/emulation/callbacks.d.ts +4 -4
  22. package/dist/emulation/callbacks.js +4 -4
  23. package/dist/emulation/fs.d.ts +3 -3
  24. package/dist/emulation/fs.js +2 -2
  25. package/dist/emulation/index.d.ts +5 -5
  26. package/dist/emulation/index.js +5 -5
  27. package/dist/emulation/promises.d.ts +5 -5
  28. package/dist/emulation/promises.js +4 -4
  29. package/dist/emulation/shared.d.ts +5 -5
  30. package/dist/emulation/shared.js +3 -3
  31. package/dist/emulation/sync.d.ts +4 -4
  32. package/dist/emulation/sync.js +3 -3
  33. package/dist/file.d.ts +3 -3
  34. package/dist/file.js +3 -3
  35. package/dist/filesystem.d.ts +5 -5
  36. package/dist/filesystem.js +2 -2
  37. package/dist/index.d.ts +14 -14
  38. package/dist/index.js +17 -17
  39. package/dist/inode.d.ts +2 -2
  40. package/dist/inode.js +1 -1
  41. package/dist/stats.d.ts +3 -3
  42. package/dist/stats.js +2 -2
  43. package/dist/utils.d.ts +4 -4
  44. package/dist/utils.js +1 -1
  45. package/package.json +8 -1
@@ -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,7 @@
1
- export * from './callbacks';
2
- export * from './sync';
3
- import * as promises_1 from './promises';
1
+ export * from './callbacks.js';
2
+ export * from './sync.js';
3
+ import * as promises_1 from './promises.js';
4
4
  export { promises_1 as promises };
5
- import * as constants_1 from './constants';
5
+ import * as constants_1 from './constants.js';
6
6
  export { constants_1 as constants };
7
- export { initialize, getMount, getMounts, mount, umount, _toUnixTimestamp } from './shared';
7
+ 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,8 @@
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 { BackendConstructor } from '../backends.js';
5
+ import { InMemoryFileSystem } from '../backends/InMemory.js';
6
6
  /**
7
7
  * converts Date or number to a fractional UNIX timestamp
8
8
  * Grabbed from NodeJS sources (lib/fs.js)
@@ -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) {
@@ -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,13 +10,13 @@ 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';
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
18
  import * as process from 'process';
19
- import { setCred } from './emulation/shared';
19
+ import { setCred } from './emulation/shared.js';
20
20
  if (process && process['initializeTTYs']) {
21
21
  process['initializeTTYs']();
22
22
  }
@@ -98,16 +98,16 @@ export function getFileSystem(config, cb) {
98
98
  .catch(err => cb(err));
99
99
  return;
100
100
  }
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';
101
+ export * from './backends/index.js';
102
+ export * from './backends/AsyncStore.js';
103
+ export * from './backends/SyncStore.js';
104
+ export * from './ApiError.js';
105
+ export * from './cred.js';
106
+ export * from './file.js';
107
+ export * from './filesystem.js';
108
+ export * from './inode.js';
109
+ export * from './mutex.js';
110
+ export * from './stats.js';
111
+ export * from './utils.js';
112
112
  export { fs };
113
113
  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
  */
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.2",
3
+ "version": "0.0.4",
4
4
  "description": "A filesystem in your browser",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist",
@@ -26,6 +26,13 @@
26
26
  "exports": {
27
27
  "./*": "./dist/*"
28
28
  },
29
+ "typesVersions": {
30
+ "*": {
31
+ "*": [
32
+ "./dist/*"
33
+ ]
34
+ }
35
+ },
29
36
  "scripts": {
30
37
  "format": "prettier --write src test",
31
38
  "format:check": "prettier --check src test",