@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/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(this, path).fullPath;
120
- const { fs, path: resolved } = resolveMount(path, this);
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(this, parentStats, constants.W_OK)) {
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 & constants.S_IFDIR)
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(this).credentials;
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(this, 'rename', path);
155
- return new Handle(this, path, resolved, flag, cacheOf(fs).ref(resolved, inode));
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(this, stats, mode) || !hasAccess(this, stats, flags.toMode(flag)))) {
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.mode & constants.S_IFDIR)
170
+ if (!opt.allowDirectory && isDirectory(stats))
171
171
  throw UV('EISDIR', 'open', path);
172
- const file = new Handle(this, path, resolved, flag, cacheOf(fs).ref(resolved, stats));
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.6.6",
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
  }