@yarnpkg/fslib
Advanced tools
@@ -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, |
+2
-2
@@ -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 @@ }; |
+32
-2
@@ -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) { |
+2
-2
| { | ||
| "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": { |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
229402
0.51%5944
0.52%