@zenfs/core 0.15.0 → 0.15.2
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/fetch.js +3 -0
- package/dist/backends/locked.d.ts +1 -0
- package/dist/backends/locked.js +1 -0
- package/dist/backends/store/store.d.ts +1 -1
- package/dist/backends/store/store.js +1 -1
- package/dist/browser.min.js +2 -2
- package/dist/browser.min.js.map +4 -4
- package/dist/emulation/promises.d.ts +1 -1
- package/dist/emulation/promises.js +1 -1
- package/dist/file.d.ts +1 -1
- package/dist/file.js +1 -1
- package/dist/polyfills.js +20 -0
- package/license.md +1 -1
- package/package.json +2 -2
- package/src/backends/fetch.ts +5 -0
- package/src/backends/locked.ts +1 -0
- package/src/backends/store/store.ts +1 -1
- package/src/emulation/promises.ts +1 -1
- package/src/file.ts +1 -1
- package/src/polyfills.ts +20 -0
- package/dist/symbol-dispose.js +0 -10
- package/src/symbol-dispose.ts +0 -9
- /package/dist/{symbol-dispose.d.ts → polyfills.d.ts} +0 -0
|
@@ -18,7 +18,7 @@ import { BigIntStats, type Stats } from '../stats.js';
|
|
|
18
18
|
import { Dir, Dirent } from './dir.js';
|
|
19
19
|
import { ReadStream, WriteStream } from './streams.js';
|
|
20
20
|
export * as constants from './constants.js';
|
|
21
|
-
import '../
|
|
21
|
+
import '../polyfills.js';
|
|
22
22
|
export declare class FileHandle implements promises.FileHandle {
|
|
23
23
|
/**
|
|
24
24
|
* The file descriptor for this file handle.
|
|
@@ -54,7 +54,7 @@ import { dirname, join, parse } from './path.js';
|
|
|
54
54
|
import { _statfs, cred, fd2file, fdMap, file2fd, fixError, mounts, resolveMount } from './shared.js';
|
|
55
55
|
import { ReadStream, WriteStream } from './streams.js';
|
|
56
56
|
export * as constants from './constants.js';
|
|
57
|
-
import '../
|
|
57
|
+
import '../polyfills.js';
|
|
58
58
|
export class FileHandle {
|
|
59
59
|
constructor(fdOrFile) {
|
|
60
60
|
const isFile = typeof fdOrFile != 'number';
|
package/dist/file.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { FileReadResult } from 'node:fs/promises';
|
|
4
4
|
import type { FileSystem } from './filesystem.js';
|
|
5
5
|
import { Stats, type FileType } from './stats.js';
|
|
6
|
-
import './
|
|
6
|
+
import './polyfills.js';
|
|
7
7
|
declare global {
|
|
8
8
|
interface ArrayBuffer {
|
|
9
9
|
readonly resizable: boolean;
|
package/dist/file.js
CHANGED
|
@@ -2,7 +2,7 @@ import { O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY,
|
|
|
2
2
|
import { Errno, ErrnoError } from './error.js';
|
|
3
3
|
import { size_max } from './inode.js';
|
|
4
4
|
import { Stats } from './stats.js';
|
|
5
|
-
import './
|
|
5
|
+
import './polyfills.js';
|
|
6
6
|
const validFlags = ['r', 'r+', 'rs', 'rs+', 'w', 'wx', 'w+', 'wx+', 'a', 'ax', 'a+', 'ax+'];
|
|
7
7
|
export function parseFlag(flag) {
|
|
8
8
|
if (typeof flag === 'number') {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Promise.withResolvers ?? (Promise.withResolvers = function () {
|
|
2
|
+
let _resolve,
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
_reject;
|
|
5
|
+
const promise = new Promise((resolve, reject) => {
|
|
6
|
+
_resolve = resolve;
|
|
7
|
+
_reject = reject;
|
|
8
|
+
});
|
|
9
|
+
return { promise, resolve: _resolve, reject: _reject };
|
|
10
|
+
});
|
|
11
|
+
/*
|
|
12
|
+
A polyfill for when these symbols are undefined.
|
|
13
|
+
For some reason, NodeJS does not polyfill them in a VM context.
|
|
14
|
+
Since jest uses a VM context for ESM, these need to be here.
|
|
15
|
+
*/
|
|
16
|
+
// @ts-expect-error 2540
|
|
17
|
+
Symbol['dispose'] ?? (Symbol['dispose'] = Symbol('Symbol.dispose'));
|
|
18
|
+
// @ts-expect-error 2540
|
|
19
|
+
Symbol['asyncDispose'] ?? (Symbol['asyncDispose'] = Symbol('Symbol.asyncDispose'));
|
|
20
|
+
export {};
|
package/license.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenfs/core",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "A filesystem, anywhere",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/zen-fs/core/issues"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
37
|
+
"node": ">= 16"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
40
|
".": "./dist/index.js",
|
package/src/backends/fetch.ts
CHANGED
package/src/backends/locked.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { FileSystemMetadata } from '../filesystem.js';
|
|
|
5
5
|
import { FileSystem } from '../filesystem.js';
|
|
6
6
|
import type { Stats } from '../stats.js';
|
|
7
7
|
import type { Backend } from './backend.js';
|
|
8
|
+
import '../polyfills.js';
|
|
8
9
|
|
|
9
10
|
export interface MutexLock extends PromiseWithResolvers<void> {
|
|
10
11
|
[Symbol.dispose](): void;
|
|
@@ -18,7 +18,7 @@ import { dirname, join, parse } from './path.js';
|
|
|
18
18
|
import { _statfs, cred, fd2file, fdMap, file2fd, fixError, mounts, resolveMount } from './shared.js';
|
|
19
19
|
import { ReadStream, WriteStream } from './streams.js';
|
|
20
20
|
export * as constants from './constants.js';
|
|
21
|
-
import '../
|
|
21
|
+
import '../polyfills.js';
|
|
22
22
|
|
|
23
23
|
export class FileHandle implements promises.FileHandle {
|
|
24
24
|
/**
|
package/src/file.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Errno, ErrnoError } from './error.js';
|
|
|
4
4
|
import type { FileSystem } from './filesystem.js';
|
|
5
5
|
import { size_max } from './inode.js';
|
|
6
6
|
import { Stats, type FileType } from './stats.js';
|
|
7
|
-
import './
|
|
7
|
+
import './polyfills.js';
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
Typescript does not include a type declaration for resizable array buffers.
|
package/src/polyfills.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Promise.withResolvers ??= function <T>(): PromiseWithResolvers<T> {
|
|
2
|
+
let _resolve: ((value: T | PromiseLike<T>) => void) | undefined,
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
_reject: ((reason?: any) => void) | undefined;
|
|
5
|
+
const promise = new Promise<T>((resolve, reject) => {
|
|
6
|
+
_resolve = resolve;
|
|
7
|
+
_reject = reject;
|
|
8
|
+
});
|
|
9
|
+
return { promise, resolve: _resolve!, reject: _reject! };
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
A polyfill for when these symbols are undefined.
|
|
14
|
+
For some reason, NodeJS does not polyfill them in a VM context.
|
|
15
|
+
Since jest uses a VM context for ESM, these need to be here.
|
|
16
|
+
*/
|
|
17
|
+
// @ts-expect-error 2540
|
|
18
|
+
Symbol['dispose'] ??= Symbol('Symbol.dispose');
|
|
19
|
+
// @ts-expect-error 2540
|
|
20
|
+
Symbol['asyncDispose'] ??= Symbol('Symbol.asyncDispose');
|
package/dist/symbol-dispose.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
This file acts as a polyfill for when these symbols are undefined.
|
|
3
|
-
For some reason, NodeJS does not polyfill them in a VM context.
|
|
4
|
-
Since jest uses a VM context for ESM, these need to be here.
|
|
5
|
-
*/
|
|
6
|
-
// @ts-expect-error 2540
|
|
7
|
-
Symbol['dispose'] ?? (Symbol['dispose'] = Symbol('Symbol.dispose'));
|
|
8
|
-
// @ts-expect-error 2540
|
|
9
|
-
Symbol['asyncDispose'] ?? (Symbol['asyncDispose'] = Symbol('Symbol.asyncDispose'));
|
|
10
|
-
export {};
|
package/src/symbol-dispose.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
This file acts as a polyfill for when these symbols are undefined.
|
|
3
|
-
For some reason, NodeJS does not polyfill them in a VM context.
|
|
4
|
-
Since jest uses a VM context for ESM, these need to be here.
|
|
5
|
-
*/
|
|
6
|
-
// @ts-expect-error 2540
|
|
7
|
-
Symbol['dispose'] ??= Symbol('Symbol.dispose');
|
|
8
|
-
// @ts-expect-error 2540
|
|
9
|
-
Symbol['asyncDispose'] ??= Symbol('Symbol.asyncDispose');
|
|
File without changes
|