@zenfs/core 1.6.6 → 1.6.8

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.
@@ -61,7 +61,7 @@ export interface Backend<FS extends FileSystem = FileSystem, TOptions extends ob
61
61
  * 'false' if the API is unavailable
62
62
  *
63
63
  */
64
- isAvailable(): boolean | Promise<boolean>;
64
+ isAvailable?(): boolean | Promise<boolean>;
65
65
  }
66
66
  /**
67
67
  * Gets the options type of a backend
@@ -2,7 +2,7 @@ import { ErrnoError, Errno } from '../error.js';
2
2
  import { levenshtein } from '../utils.js';
3
3
  /** @internal */
4
4
  export function isBackend(arg) {
5
- return arg != null && typeof arg == 'object' && 'isAvailable' in arg && typeof arg.isAvailable == 'function' && 'create' in arg && typeof arg.create == 'function';
5
+ return arg != null && typeof arg == 'object' && 'create' in arg && typeof arg.create == 'function';
6
6
  }
7
7
  /**
8
8
  * Checks that `options` object is valid for the file system options.
@@ -12,7 +12,6 @@ export declare class InMemoryStore extends Map<bigint, Uint8Array> implements Si
12
12
  }
13
13
  declare const _InMemory: {
14
14
  readonly name: "InMemory";
15
- readonly isAvailable: () => boolean;
16
15
  readonly options: {
17
16
  readonly name: {
18
17
  readonly type: "string";
@@ -18,9 +18,6 @@ export class InMemoryStore extends Map {
18
18
  }
19
19
  const _InMemory = {
20
20
  name: 'InMemory',
21
- isAvailable() {
22
- return true;
23
- },
24
21
  options: {
25
22
  name: { type: 'string', required: false },
26
23
  },
@@ -115,7 +115,6 @@ declare const _Overlay: {
115
115
  readonly required: true;
116
116
  };
117
117
  };
118
- readonly isAvailable: () => boolean;
119
118
  readonly create: (options: OverlayOptions) => OverlayFS;
120
119
  };
121
120
  type _Overlay = typeof _Overlay;
@@ -537,9 +537,6 @@ const _Overlay = {
537
537
  writable: { type: 'object', required: true },
538
538
  readable: { type: 'object', required: true },
539
539
  },
540
- isAvailable() {
541
- return true;
542
- },
543
540
  create(options) {
544
541
  return new OverlayFS(options);
545
542
  },
@@ -102,7 +102,6 @@ declare const _Port: {
102
102
  required: false;
103
103
  };
104
104
  };
105
- isAvailable(): boolean;
106
105
  create(options: RPC.Options): PortFS;
107
106
  };
108
107
  type _Port = typeof _Port;
@@ -220,9 +220,6 @@ const _Port = {
220
220
  },
221
221
  timeout: { type: 'number', required: false },
222
222
  },
223
- isAvailable() {
224
- return true;
225
- },
226
223
  create(options) {
227
224
  return new PortFS(options);
228
225
  },
@@ -1,6 +1,6 @@
1
1
  import type { File } from '../../file.js';
2
2
  import { FileSystem, type FileSystemMetadata } from '../../filesystem.js';
3
- import { Inode } from '../../inode.js';
3
+ import { Inode } from './inode.js';
4
4
  import type { Stats } from '../../stats.js';
5
5
  import type { Store, Transaction } from './store.js';
6
6
  /**
@@ -56,7 +56,7 @@ import { basename, dirname, parse, resolve } from '../../emulation/path.js';
56
56
  import { Errno, ErrnoError } from '../../error.js';
57
57
  import { PreloadFile } from '../../file.js';
58
58
  import { FileSystem } from '../../filesystem.js';
59
- import { Inode, rootIno } from '../../inode.js';
59
+ import { Inode, rootIno } from './inode.js';
60
60
  import { decodeDirListing, encodeDirListing, encodeUTF8, randomBigInt } from '../../utils.js';
61
61
  import { serialize } from 'utilium';
62
62
  const maxInodeAllocTries = 5;
@@ -1,4 +1,4 @@
1
- import { Stats, type StatsLike } from './stats.js';
1
+ import { Stats, type StatsLike } from '../../stats.js';
2
2
  /**
3
3
  * Room inode
4
4
  * @hidden
@@ -37,8 +37,8 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
37
37
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
38
38
  };
39
39
  import { deserialize, sizeof, struct, types as t } from 'utilium';
40
- import { Stats } from './stats.js';
41
- import { randomBigInt } from './utils.js';
40
+ import { Stats } from '../../stats.js';
41
+ import { randomBigInt } from '../../utils.js';
42
42
  /**
43
43
  * Room inode
44
44
  * @hidden
package/dist/config.js CHANGED
@@ -41,7 +41,7 @@ export async function resolveMountConfig(configuration, _depth = 0) {
41
41
  configuration[key] = await resolveMountConfig(value, ++_depth);
42
42
  }
43
43
  const { backend } = configuration;
44
- if (!(await backend.isAvailable())) {
44
+ if (typeof backend.isAvailable == 'function' && !(await backend.isAvailable())) {
45
45
  throw new ErrnoError(Errno.EPERM, 'Backend not available: ' + backend.name);
46
46
  }
47
47
  await checkOptions(backend, configuration);
@@ -518,7 +518,7 @@ export function linkSync(targetPath, linkPath) {
518
518
  if (config.checkAccess && !fs.statSync(path).hasAccess(constants.R_OK, this)) {
519
519
  throw ErrnoError.With('EACCES', path, 'link');
520
520
  }
521
- return fs.linkSync(path, linkPath);
521
+ return fs.linkSync(path, link.path);
522
522
  }
523
523
  catch (e) {
524
524
  throw fixError(e, { [path]: targetPath, [link.path]: linkPath });
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export * from './credentials.js';
14
14
  export * from './devices.js';
15
15
  export * from './file.js';
16
16
  export * from './filesystem.js';
17
- export * from './inode.js';
17
+ export * from './backends/store/inode.js';
18
18
  export * from './mixins/index.js';
19
19
  export * from './stats.js';
20
20
  export * from './utils.js';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ export * from './credentials.js';
14
14
  export * from './devices.js';
15
15
  export * from './file.js';
16
16
  export * from './filesystem.js';
17
- export * from './inode.js';
17
+ export * from './backends/store/inode.js';
18
18
  export * from './mixins/index.js';
19
19
  export * from './stats.js';
20
20
  export * from './utils.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenfs/core",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "A filesystem, anywhere",
5
5
  "funding": {
6
6
  "type": "individual",
package/readme.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # ZenFS
2
2
 
3
- ZenFS is a file system that emulates the [NodeJS filesystem API](http://nodejs.org/api/fs.html).
4
-
5
- It works using a system of backends, which are used by ZenFS to store and retrieve data. ZenFS can also integrate with other tools.
3
+ ZenFS is a file system that emulates the [NodeJS filesystem API](http://nodejs.org/api/fs.html). It works using a system of backends, which are used by ZenFS to store and retrieve data. ZenFS can also integrate with other tools.
6
4
 
7
5
  ## Backends
8
6
 
@@ -27,6 +25,8 @@ For more information, see the [docs](https://zenfs.dev/core).
27
25
  npm install @zenfs/core
28
26
  ```
29
27
 
28
+ If you're using ZenFS, especially for big projects, please consider supporting the project. Thousands of hours have been dedicated to its development, and your acknowledgment or financial support would go a long way toward improving ZenFS and its community.
29
+
30
30
  ## Usage
31
31
 
32
32
  ```js
package/dist/lib.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/lib.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- /* eslint-disable @typescript-eslint/no-empty-object-type */