@zenfs/core 2.6.6 → 2.7.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/dist/backends/memory.d.ts +1 -1
- package/dist/backends/store/fs.js +4 -4
- package/dist/config.js +7 -7
- package/dist/internal/contexts.d.ts +4 -0
- package/dist/internal/contexts.js +10 -6
- package/dist/internal/filesystem.d.ts +5 -0
- package/dist/internal/filesystem.js +18 -0
- package/dist/internal/inode.d.ts +6 -1
- package/dist/internal/inode.js +12 -3
- package/dist/internal/ioctl.d.ts +148 -0
- package/dist/internal/ioctl.js +368 -0
- package/dist/mixins/async.js +6 -1
- package/dist/mixins/mutexed.d.ts +3 -0
- package/dist/mixins/mutexed.js +29 -1
- package/dist/mixins/shared.d.ts +1 -1
- package/dist/mixins/shared.js +1 -0
- package/dist/mixins/sync.js +3 -0
- package/dist/node/sync.js +8 -8
- package/dist/vfs/async.js +2 -2
- package/dist/vfs/file.js +1 -1
- package/dist/vfs/ioctl.d.ts +8 -85
- package/dist/vfs/ioctl.js +67 -369
- package/dist/vfs/shared.d.ts +2 -0
- package/dist/vfs/shared.js +12 -8
- package/dist/vfs/sync.d.ts +1 -1
- package/dist/vfs/sync.js +11 -11
- package/package.json +10 -1
package/dist/vfs/sync.js
CHANGED
|
@@ -113,11 +113,11 @@ export function resolve($, path, preserveSymlinks, extra) {
|
|
|
113
113
|
* @category VFS
|
|
114
114
|
* @internal
|
|
115
115
|
*/
|
|
116
|
-
export function open(path, opt) {
|
|
116
|
+
export function open($, path, opt) {
|
|
117
117
|
path = normalizePath(path);
|
|
118
118
|
const mode = normalizeMode(opt.mode, 0o644), flag = flags.parse(opt.flag);
|
|
119
|
-
path = opt.preserveSymlinks ? path : resolve(
|
|
120
|
-
const { fs, path: resolved } = resolveMount(path,
|
|
119
|
+
path = opt.preserveSymlinks ? path : resolve($, path).fullPath;
|
|
120
|
+
const { fs, path: resolved } = resolveMount(path, $);
|
|
121
121
|
let stats;
|
|
122
122
|
try {
|
|
123
123
|
stats = fs.statSync(resolved);
|
|
@@ -134,25 +134,25 @@ export function open(path, opt) {
|
|
|
134
134
|
// Create the file
|
|
135
135
|
const parentPath = dirname(resolved);
|
|
136
136
|
const parentStats = fs.statSync(parentPath);
|
|
137
|
-
if (checkAccess && !hasAccess(
|
|
137
|
+
if (checkAccess && !hasAccess($, parentStats, constants.W_OK)) {
|
|
138
138
|
throw UV('EACCES', 'open', path);
|
|
139
139
|
}
|
|
140
140
|
if (!isDirectory(parentStats)) {
|
|
141
141
|
throw UV('ENOTDIR', 'open', path);
|
|
142
142
|
}
|
|
143
|
-
if (!opt.allowDirectory && mode
|
|
143
|
+
if (!opt.allowDirectory && isDirectory({ mode }))
|
|
144
144
|
throw UV('EISDIR', 'open', path);
|
|
145
145
|
// Serialize entry creation with other operations on the parent directory
|
|
146
146
|
const _ = __addDisposableResource(env_1, lockPathSync(fs, parentPath, 'rw', parentStats), false);
|
|
147
|
-
const { euid: uid, egid: gid } = contextOf(
|
|
147
|
+
const { euid: uid, egid: gid } = contextOf($).credentials;
|
|
148
148
|
const inode = fs.createFileSync(resolved, {
|
|
149
149
|
mode,
|
|
150
150
|
uid: parentStats.mode & constants.S_ISUID ? parentStats.uid : uid,
|
|
151
151
|
gid: parentStats.mode & constants.S_ISGID ? parentStats.gid : gid,
|
|
152
152
|
});
|
|
153
153
|
// A new entry in the parent directory, which is a 'rename' event
|
|
154
|
-
emitChange(
|
|
155
|
-
return new Handle(
|
|
154
|
+
emitChange($, 'rename', path);
|
|
155
|
+
return new Handle($, path, resolved, flag, cacheOf(fs).ref(resolved, inode));
|
|
156
156
|
}
|
|
157
157
|
catch (e_1) {
|
|
158
158
|
env_1.error = e_1;
|
|
@@ -162,14 +162,14 @@ export function open(path, opt) {
|
|
|
162
162
|
__disposeResources(env_1);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
if (checkAccess && (!hasAccess(
|
|
165
|
+
if (checkAccess && (!hasAccess($, stats, mode) || !hasAccess($, stats, flags.toMode(flag)))) {
|
|
166
166
|
throw UV('EACCES', 'open', path);
|
|
167
167
|
}
|
|
168
168
|
if (flag & constants.O_EXCL)
|
|
169
169
|
throw UV('EEXIST', 'open', path);
|
|
170
|
-
if (!opt.allowDirectory && stats
|
|
170
|
+
if (!opt.allowDirectory && isDirectory(stats))
|
|
171
171
|
throw UV('EISDIR', 'open', path);
|
|
172
|
-
const file = new Handle(
|
|
172
|
+
const file = new Handle($, path, resolved, flag, cacheOf(fs).ref(resolved, stats));
|
|
173
173
|
if (flag & constants.O_TRUNC)
|
|
174
174
|
file.truncateSync(0);
|
|
175
175
|
return file;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenfs/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "A filesystem, anywhere",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -93,5 +93,14 @@
|
|
|
93
93
|
"typedoc": "^0.28.18",
|
|
94
94
|
"typescript": "^6.0.0",
|
|
95
95
|
"typescript-eslint": "^8.58.0"
|
|
96
|
+
},
|
|
97
|
+
"prettier": {
|
|
98
|
+
"singleQuote": true,
|
|
99
|
+
"useTabs": true,
|
|
100
|
+
"trailingComma": "es5",
|
|
101
|
+
"tabWidth": 4,
|
|
102
|
+
"printWidth": 150,
|
|
103
|
+
"arrowParens": "avoid",
|
|
104
|
+
"experimentalOperatorPosition": "start"
|
|
96
105
|
}
|
|
97
106
|
}
|