@depup/jsonjoy.com__fs-node-to-fsa 4.78.0-depup.0 → 4.79.0-depup.0
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/README.md +2 -2
- package/changes.json +1 -1
- package/lib/NodeFileSystemHandle.d.ts +4 -3
- package/lib/NodeFileSystemHandle.js +11 -24
- package/lib/NodeFileSystemHandle.js.map +1 -1
- package/package.json +8 -8
- package/lib/NodePermissionStatus.d.ts +0 -8
- package/lib/NodePermissionStatus.js +0 -14
- package/lib/NodePermissionStatus.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/jsonjoy.com__fs-node-to-fsa
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@jsonjoy.com/fs-node-to-fsa](https://www.npmjs.com/package/@jsonjoy.com/fs-node-to-fsa) @ 4.
|
|
17
|
-
| Processed | 2026-09-
|
|
16
|
+
| Original | [@jsonjoy.com/fs-node-to-fsa](https://www.npmjs.com/package/@jsonjoy.com/fs-node-to-fsa) @ 4.79.0 |
|
|
17
|
+
| Processed | 2026-09-22 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 0 |
|
|
20
20
|
|
package/changes.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NodePermissionStatus } from './NodePermissionStatus';
|
|
2
1
|
import type { IFileSystemHandle, FileSystemHandlePermissionDescriptor } from '@jsonjoy.com/fs-fsa';
|
|
3
2
|
import type { NodeFsaFs, NodeFsaContext } from './types';
|
|
4
3
|
/**
|
|
@@ -23,7 +22,7 @@ export declare abstract class NodeFileSystemHandle implements IFileSystemHandle
|
|
|
23
22
|
/**
|
|
24
23
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/queryPermission
|
|
25
24
|
*/
|
|
26
|
-
queryPermission(fileSystemHandlePermissionDescriptor
|
|
25
|
+
queryPermission(fileSystemHandlePermissionDescriptor?: FileSystemHandlePermissionDescriptor): Promise<PermissionState>;
|
|
27
26
|
/**
|
|
28
27
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/remove
|
|
29
28
|
*/
|
|
@@ -31,7 +30,9 @@ export declare abstract class NodeFileSystemHandle implements IFileSystemHandle
|
|
|
31
30
|
recursive?: boolean;
|
|
32
31
|
}): Promise<void>;
|
|
33
32
|
/**
|
|
33
|
+
* There is no prompt to show, so this resolves the same way {@link queryPermission} does.
|
|
34
|
+
*
|
|
34
35
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission
|
|
35
36
|
*/
|
|
36
|
-
requestPermission(fileSystemHandlePermissionDescriptor
|
|
37
|
+
requestPermission(fileSystemHandlePermissionDescriptor?: FileSystemHandlePermissionDescriptor): Promise<PermissionState>;
|
|
37
38
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NodeFileSystemHandle = void 0;
|
|
4
|
-
const NodePermissionStatus_1 = require("./NodePermissionStatus");
|
|
5
4
|
/**
|
|
6
5
|
* Represents a File System Access API file handle `FileSystemHandle` object,
|
|
7
6
|
* which was created from a Node.js `fs` module.
|
|
@@ -24,31 +23,17 @@ class NodeFileSystemHandle {
|
|
|
24
23
|
/**
|
|
25
24
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/queryPermission
|
|
26
25
|
*/
|
|
27
|
-
async queryPermission(fileSystemHandlePermissionDescriptor) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const contextMode = this.ctx.mode;
|
|
32
|
-
// If requesting readwrite but context only allows read, deny
|
|
33
|
-
if (requestedMode === 'readwrite' && contextMode === 'read') {
|
|
34
|
-
return new NodePermissionStatus_1.NodePermissionStatus(requestedMode, 'denied');
|
|
35
|
-
}
|
|
26
|
+
async queryPermission(fileSystemHandlePermissionDescriptor = {}) {
|
|
27
|
+
const mode = fileSystemHandlePermissionDescriptor.mode ?? 'read';
|
|
28
|
+
if (mode === 'readwrite' && this.ctx.mode === 'read')
|
|
29
|
+
return 'denied';
|
|
36
30
|
try {
|
|
37
|
-
|
|
38
|
-
let accessMode = 0 /* AMODE.F_OK */;
|
|
39
|
-
if (mode === 'read') {
|
|
40
|
-
accessMode = 4 /* AMODE.R_OK */;
|
|
41
|
-
}
|
|
42
|
-
else if (mode === 'readwrite') {
|
|
43
|
-
accessMode = 4 /* AMODE.R_OK */ | 2 /* AMODE.W_OK */;
|
|
44
|
-
}
|
|
45
|
-
// Use asynchronous access check
|
|
31
|
+
const accessMode = mode === 'readwrite' ? 4 /* AMODE.R_OK */ | 2 /* AMODE.W_OK */ : 4 /* AMODE.R_OK */;
|
|
46
32
|
await this.fs.promises.access(this.__path, accessMode);
|
|
47
|
-
return
|
|
33
|
+
return 'granted';
|
|
48
34
|
}
|
|
49
35
|
catch (error) {
|
|
50
|
-
|
|
51
|
-
return new NodePermissionStatus_1.NodePermissionStatus(mode, 'denied');
|
|
36
|
+
return 'denied';
|
|
52
37
|
}
|
|
53
38
|
}
|
|
54
39
|
/**
|
|
@@ -58,10 +43,12 @@ class NodeFileSystemHandle {
|
|
|
58
43
|
throw new Error('Not implemented');
|
|
59
44
|
}
|
|
60
45
|
/**
|
|
46
|
+
* There is no prompt to show, so this resolves the same way {@link queryPermission} does.
|
|
47
|
+
*
|
|
61
48
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission
|
|
62
49
|
*/
|
|
63
|
-
requestPermission(fileSystemHandlePermissionDescriptor) {
|
|
64
|
-
|
|
50
|
+
async requestPermission(fileSystemHandlePermissionDescriptor = {}) {
|
|
51
|
+
return this.queryPermission(fileSystemHandlePermissionDescriptor);
|
|
65
52
|
}
|
|
66
53
|
}
|
|
67
54
|
exports.NodeFileSystemHandle = NodeFileSystemHandle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeFileSystemHandle.js","sourceRoot":"","sources":["../src/NodeFileSystemHandle.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"NodeFileSystemHandle.js","sourceRoot":"","sources":["../src/NodeFileSystemHandle.ts"],"names":[],"mappings":";;;AAIA;;;;;GAKG;AACH,MAAsB,oBAAoB;IAKxC,YACkB,IAA0B,EAC1B,IAAY;QADZ,SAAI,GAAJ,IAAI,CAAsB;QAC1B,SAAI,GAAJ,IAAI,CAAQ;IAC3B,CAAC;IAEJ;;;;OAIG;IACI,WAAW,CAAC,gBAAmC;QACpD,OAAO,CACL,IAAI,CAAC,WAAW,KAAK,gBAAgB,CAAC,WAAW,IAAK,IAAY,CAAC,MAAM,KAAM,gBAAwB,CAAC,MAAM,CAC/G,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,eAAe,CAC1B,uCAA6E,EAAE;QAE/E,MAAM,IAAI,GAAG,oCAAoC,CAAC,IAAI,IAAI,MAAM,CAAC;QACjE,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,QAAQ,CAAC;QACtE,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,uCAAuB,CAAC,CAAC,mBAAW,CAAC;YAC/E,MAAM,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACvD,OAAO,SAAS,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,KAA8B,EAAE,SAAS,EAAE,KAAK,EAAE;QAC/E,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iBAAiB,CAC5B,uCAA6E,EAAE;QAE/E,OAAO,IAAI,CAAC,eAAe,CAAC,oCAAoC,CAAC,CAAC;IACpE,CAAC;CACF;AAvDD,oDAuDC","sourcesContent":["import { AMODE } from '@jsonjoy.com/fs-node-utils';\nimport type { IFileSystemHandle, FileSystemHandlePermissionDescriptor } from '@jsonjoy.com/fs-fsa';\nimport type { NodeFsaFs, NodeFsaContext } from './types';\n\n/**\n * Represents a File System Access API file handle `FileSystemHandle` object,\n * which was created from a Node.js `fs` module.\n *\n * @see [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle)\n */\nexport abstract class NodeFileSystemHandle implements IFileSystemHandle {\n protected abstract readonly fs: NodeFsaFs;\n protected abstract readonly __path: string;\n protected abstract readonly ctx: NodeFsaContext;\n\n constructor(\n public readonly kind: 'file' | 'directory',\n public readonly name: string,\n ) {}\n\n /**\n * Compares two handles to see if the associated entries (either a file or directory) match.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/isSameEntry\n */\n public isSameEntry(fileSystemHandle: IFileSystemHandle): boolean {\n return (\n this.constructor === fileSystemHandle.constructor && (this as any).__path === (fileSystemHandle as any).__path\n );\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/queryPermission\n */\n public async queryPermission(\n fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor = {},\n ): Promise<PermissionState> {\n const mode = fileSystemHandlePermissionDescriptor.mode ?? 'read';\n if (mode === 'readwrite' && this.ctx.mode === 'read') return 'denied';\n try {\n const accessMode = mode === 'readwrite' ? AMODE.R_OK | AMODE.W_OK : AMODE.R_OK;\n await this.fs.promises.access(this.__path, accessMode);\n return 'granted';\n } catch (error) {\n return 'denied';\n }\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/remove\n */\n public async remove({ recursive }: { recursive?: boolean } = { recursive: false }): Promise<void> {\n throw new Error('Not implemented');\n }\n\n /**\n * There is no prompt to show, so this resolves the same way {@link queryPermission} does.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission\n */\n public async requestPermission(\n fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor = {},\n ): Promise<PermissionState> {\n return this.queryPermission(fileSystemHandlePermissionDescriptor);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/jsonjoy.com__fs-node-to-fsa",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.79.0-depup.0",
|
|
4
4
|
"description": "Adapter to convert Node.js fs API to File System Access API (with updated dependencies)",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "streamich",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@jsonjoy.com/fs-node": "4.
|
|
73
|
+
"@jsonjoy.com/fs-node": "4.79.0",
|
|
74
74
|
"@types/jest": "^29.0.0",
|
|
75
75
|
"@types/node": "^20.0.0",
|
|
76
76
|
"jest": "^29.0.0",
|
|
77
|
-
"memfs": "4.
|
|
77
|
+
"memfs": "4.79.0",
|
|
78
78
|
"rimraf": "^5.0.0",
|
|
79
79
|
"ts-jest": "^29.4.2",
|
|
80
80
|
"ts-node": "^10.9.2",
|
|
@@ -84,16 +84,16 @@
|
|
|
84
84
|
"tslib": "2"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@jsonjoy.com/fs-fsa": "4.
|
|
88
|
-
"@jsonjoy.com/fs-node-builtins": "4.
|
|
89
|
-
"@jsonjoy.com/fs-node-utils": "4.
|
|
87
|
+
"@jsonjoy.com/fs-fsa": "4.79.0",
|
|
88
|
+
"@jsonjoy.com/fs-node-builtins": "4.79.0",
|
|
89
|
+
"@jsonjoy.com/fs-node-utils": "4.79.0"
|
|
90
90
|
},
|
|
91
91
|
"depup": {
|
|
92
92
|
"changes": {},
|
|
93
93
|
"depsUpdated": 0,
|
|
94
94
|
"originalPackage": "@jsonjoy.com/fs-node-to-fsa",
|
|
95
|
-
"originalVersion": "4.
|
|
96
|
-
"processedAt": "2026-09-
|
|
95
|
+
"originalVersion": "4.79.0",
|
|
96
|
+
"processedAt": "2026-09-22T16:11:12.431Z",
|
|
97
97
|
"smokeTest": "passed"
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @see [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus)
|
|
3
|
-
*/
|
|
4
|
-
export declare class NodePermissionStatus {
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly state: 'granted' | 'denied' | 'prompt';
|
|
7
|
-
constructor(name: string, state: 'granted' | 'denied' | 'prompt');
|
|
8
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodePermissionStatus = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @see [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus)
|
|
6
|
-
*/
|
|
7
|
-
class NodePermissionStatus {
|
|
8
|
-
constructor(name, state) {
|
|
9
|
-
this.name = name;
|
|
10
|
-
this.state = state;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.NodePermissionStatus = NodePermissionStatus;
|
|
14
|
-
//# sourceMappingURL=NodePermissionStatus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodePermissionStatus.js","sourceRoot":"","sources":["../src/NodePermissionStatus.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,oBAAoB;IAC/B,YACkB,IAAY,EACZ,KAAsC;QADtC,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAiC;IACrD,CAAC;CACL;AALD,oDAKC","sourcesContent":["/**\n * @see [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus)\n */\nexport class NodePermissionStatus {\n constructor(\n public readonly name: string,\n public readonly state: 'granted' | 'denied' | 'prompt',\n ) {}\n}\n"]}
|