| 48 | } |
| 49 | |
| 50 | class VMFileSystem { |
| 51 | |
| 52 | constructor({fs: fsModule = fs, path: pathModule = pa} = {}) { |
| 53 | this.fs = fsModule; |
| 54 | this.path = pathModule; |
| 55 | } |
| 56 | |
| 57 | resolve(path) { |
| 58 | return this.path.resolve(path); |
| 59 | } |
| 60 | |
| 61 | // SECURITY: See DefaultFileSystem.realpath. Custom fs modules that omit |
| 62 | // realpathSync will surface the missing-method error here, which the |
| 63 | // resolver translates into a deny-by-default. GHSA-cp6g-6699-wx9c. |
| 64 | realpath(path) { |
| 65 | return this.fs.realpathSync(path); |
| 66 | } |
| 67 | |
| 68 | isSeparator(char) { |
| 69 | return char === '/' || char === this.path.sep; |
| 70 | } |
| 71 | |
| 72 | isAbsolute(path) { |
| 73 | return this.path.isAbsolute(path); |
| 74 | } |
| 75 | |
| 76 | join(...paths) { |
| 77 | return this.path.join(...paths); |
| 78 | } |
| 79 | |
| 80 | basename(path) { |
| 81 | return this.path.basename(path); |
| 82 | } |
| 83 | |
| 84 | dirname(path) { |
| 85 | return this.path.dirname(path); |
| 86 | } |
| 87 | |
| 88 | statSync(path, options) { |
| 89 | return this.fs.statSync(path, options); |
| 90 | } |
| 91 | |
| 92 | readFileSync(path, options) { |
| 93 | return this.fs.readFileSync(path, options); |
| 94 | } |
| 95 | |
| 96 | } |
| 97 | |
| 98 | exports.DefaultFileSystem = DefaultFileSystem; |
| 99 | exports.VMFileSystem = VMFileSystem; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…