@yarnpkg/fslib
Advanced tools
Comparing version 3.0.0-rc.50 to 3.0.0-rc.51
@@ -58,3 +58,4 @@ "use strict"; | ||
return null; | ||
return Object.assign(fakeFs.statSync(fakeFs.pathUtils.join(path, filename)), { | ||
const entryPath = fakeFs.pathUtils.join(path, filename); | ||
return Object.assign(fakeFs.statSync(entryPath), { | ||
name: filename, | ||
@@ -61,0 +62,0 @@ path: undefined, |
@@ -18,7 +18,7 @@ /// <reference types="node" /> | ||
}; | ||
export type Dirent<T extends Path> = Exclude<NodeDirent, 'name'> & { | ||
export type Dirent<T extends Path> = Omit<NodeDirent, 'name' | 'path'> & { | ||
name: Filename; | ||
path: T; | ||
}; | ||
export type DirentNoPath = Exclude<NodeDirent, 'name'> & { | ||
export type DirentNoPath = Omit<NodeDirent, 'name' | 'path'> & { | ||
name: Filename; | ||
@@ -25,0 +25,0 @@ }; |
@@ -39,3 +39,18 @@ "use strict"; | ||
}).then(dir => { | ||
return Object.defineProperty(dir, `path`, { value: p, configurable: true, writable: true }); | ||
// @ts-expect-error | ||
// | ||
// We need a way to tell TS that the values returned by the `read` | ||
// methods are compatible with `Dir`, especially the `name` field. | ||
// | ||
// We also can't use `Object.assign` to set the because the `path` | ||
// field to a Filename, because the property isn't writable, so | ||
// we need to use defineProperty instead. | ||
// | ||
const dirWithFixedPath = dir; | ||
Object.defineProperty(dirWithFixedPath, `path`, { | ||
value: p, | ||
configurable: true, | ||
writable: true, | ||
}); | ||
return dirWithFixedPath; | ||
}); | ||
@@ -47,3 +62,18 @@ } | ||
: this.realFs.opendirSync(path_1.npath.fromPortablePath(p)); | ||
return Object.defineProperty(dir, `path`, { value: p, configurable: true, writable: true }); | ||
// @ts-expect-error | ||
// | ||
// We need a way to tell TS that the values returned by the `read` | ||
// methods are compatible with `Dir`, especially the `name` field. | ||
// | ||
// We also can't use `Object.assign` to set the because the `path` | ||
// field to a Filename, because the property isn't writable, so | ||
// we need to use defineProperty instead. | ||
// | ||
const dirWithFixedPath = dir; | ||
Object.defineProperty(dirWithFixedPath, `path`, { | ||
value: p, | ||
configurable: true, | ||
writable: true, | ||
}); | ||
return dirWithFixedPath; | ||
} | ||
@@ -50,0 +80,0 @@ async readPromise(fd, buffer, offset = 0, length = 0, position = -1) { |
{ | ||
"name": "@yarnpkg/fslib", | ||
"version": "3.0.0-rc.50", | ||
"version": "3.0.0-rc.51", | ||
"stableVersion": "2.10.3", | ||
@@ -16,3 +16,3 @@ "license": "BSD-2-Clause", | ||
"devDependencies": { | ||
"@yarnpkg/libzip": "^3.0.0-rc.50" | ||
"@yarnpkg/libzip": "^3.0.0-rc.51" | ||
}, | ||
@@ -19,0 +19,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
229402
5944