diff --git a/.pnp.cjs b/.pnp.cjs index b14967d..1730866 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -36,7 +36,7 @@ const RAW_RUNTIME_STATE = ["@testing-library/react-hooks", "virtual:2a4e9dace022057175a083496c0ac5b75c33c32a608467b972f1b2536df13ef41f37b30a5cc92f9313818befb060475002505ecbb105b86b1a7fbf67cdbfb676#npm:8.0.1"],\ ["@testing-library/user-event", "virtual:2a4e9dace022057175a083496c0ac5b75c33c32a608467b972f1b2536df13ef41f37b30a5cc92f9313818befb060475002505ecbb105b86b1a7fbf67cdbfb676#npm:14.5.2"],\ ["@types/jest", "npm:29.5.11"],\ - ["@types/node", "npm:18.18.9"],\ + ["@types/node", "npm:18.19.9"],\ ["@types/react", "npm:18.2.48"],\ ["@types/react-dom", "npm:18.2.18"],\ ["@typescript-eslint/eslint-plugin", "virtual:2a4e9dace022057175a083496c0ac5b75c33c32a608467b972f1b2536df13ef41f37b30a5cc92f9313818befb060475002505ecbb105b86b1a7fbf67cdbfb676#npm:5.62.0"],\ @@ -2431,10 +2431,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["@types/node", [\ - ["npm:18.18.9", {\ - "packageLocation": "../../../../cache/others/berry/cache/@types-node-npm-18.18.9-db29fe3223-10c0.zip/node_modules/@types/node/",\ + ["npm:18.19.9", {\ + "packageLocation": "../../../../cache/others/berry/cache/@types-node-npm-18.19.9-0cb538efbf-10c0.zip/node_modules/@types/node/",\ "packageDependencies": [\ - ["@types/node", "npm:18.18.9"],\ + ["@types/node", "npm:18.19.9"],\ ["undici-types", "npm:5.26.5"]\ ],\ "linkType": "HARD"\ @@ -10812,7 +10812,7 @@ const RAW_RUNTIME_STATE = ["@testing-library/react-hooks", "virtual:2a4e9dace022057175a083496c0ac5b75c33c32a608467b972f1b2536df13ef41f37b30a5cc92f9313818befb060475002505ecbb105b86b1a7fbf67cdbfb676#npm:8.0.1"],\ ["@testing-library/user-event", "virtual:2a4e9dace022057175a083496c0ac5b75c33c32a608467b972f1b2536df13ef41f37b30a5cc92f9313818befb060475002505ecbb105b86b1a7fbf67cdbfb676#npm:14.5.2"],\ ["@types/jest", "npm:29.5.11"],\ - ["@types/node", "npm:18.18.9"],\ + ["@types/node", "npm:18.19.9"],\ ["@types/react", "npm:18.2.48"],\ ["@types/react-dom", "npm:18.2.18"],\ ["@typescript-eslint/eslint-plugin", "virtual:2a4e9dace022057175a083496c0ac5b75c33c32a608467b972f1b2536df13ef41f37b30a5cc92f9313818befb060475002505ecbb105b86b1a7fbf67cdbfb676#npm:5.62.0"],\ @@ -12692,7 +12692,7 @@ const RAW_RUNTIME_STATE = "packageDependencies": [\ ["vite", "virtual:2a4e9dace022057175a083496c0ac5b75c33c32a608467b972f1b2536df13ef41f37b30a5cc92f9313818befb060475002505ecbb105b86b1a7fbf67cdbfb676#npm:3.2.8"],\ ["@types/less", null],\ - ["@types/node", "npm:18.18.9"],\ + ["@types/node", "npm:18.19.9"],\ ["@types/sass", null],\ ["@types/stylus", null],\ ["@types/sugarss", null],\ @@ -14869,6 +14869,12 @@ class ProxiedFS extends FakeFS { } } +function direntToPortable(dirent) { + const portableDirent = dirent; + if (typeof dirent.path === `string`) + portableDirent.path = npath.toPortablePath(dirent.path); + return portableDirent; +} class NodeFS extends BasePortableFakeFS { constructor(realFs = fs__default.default) { super(); @@ -15195,15 +15201,31 @@ class NodeFS extends BasePortableFakeFS { async readdirPromise(p, opts) { return await new Promise((resolve, reject) => { if (opts) { - this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject)); + if (opts.recursive && process.platform === `win32`) { + if (opts.withFileTypes) { + this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback((results) => resolve(results.map(direntToPortable)), reject)); + } else { + this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback((results) => resolve(results.map(npath.toPortablePath)), reject)); + } + } else { + this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject)); + } } else { - this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback((value) => resolve(value), reject)); + this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback(resolve, reject)); } }); } readdirSync(p, opts) { if (opts) { - return this.realFs.readdirSync(npath.fromPortablePath(p), opts); + if (opts.recursive && process.platform === `win32`) { + if (opts.withFileTypes) { + return this.realFs.readdirSync(npath.fromPortablePath(p), opts).map(direntToPortable); + } else { + return this.realFs.readdirSync(npath.fromPortablePath(p), opts).map(npath.toPortablePath); + } + } else { + return this.realFs.readdirSync(npath.fromPortablePath(p), opts); + } } else { return this.realFs.readdirSync(npath.fromPortablePath(p)); } diff --git a/.pnp.loader.mjs b/.pnp.loader.mjs index 928eae8..fe96ee1 100644 --- a/.pnp.loader.mjs +++ b/.pnp.loader.mjs @@ -902,6 +902,12 @@ class ProxiedFS extends FakeFS { } } +function direntToPortable(dirent) { + const portableDirent = dirent; + if (typeof dirent.path === `string`) + portableDirent.path = npath.toPortablePath(dirent.path); + return portableDirent; +} class NodeFS extends BasePortableFakeFS { constructor(realFs = fs) { super(); @@ -1228,15 +1234,31 @@ class NodeFS extends BasePortableFakeFS { async readdirPromise(p, opts) { return await new Promise((resolve, reject) => { if (opts) { - this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject)); + if (opts.recursive && process.platform === `win32`) { + if (opts.withFileTypes) { + this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback((results) => resolve(results.map(direntToPortable)), reject)); + } else { + this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback((results) => resolve(results.map(npath.toPortablePath)), reject)); + } + } else { + this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject)); + } } else { - this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback((value) => resolve(value), reject)); + this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback(resolve, reject)); } }); } readdirSync(p, opts) { if (opts) { - return this.realFs.readdirSync(npath.fromPortablePath(p), opts); + if (opts.recursive && process.platform === `win32`) { + if (opts.withFileTypes) { + return this.realFs.readdirSync(npath.fromPortablePath(p), opts).map(direntToPortable); + } else { + return this.realFs.readdirSync(npath.fromPortablePath(p), opts).map(npath.toPortablePath); + } + } else { + return this.realFs.readdirSync(npath.fromPortablePath(p), opts); + } } else { return this.realFs.readdirSync(npath.fromPortablePath(p)); } @@ -1372,7 +1394,7 @@ class VirtualFS extends ProxiedFS { const [major, minor] = process.versions.node.split(`.`).map((value) => parseInt(value, 10)); const WATCH_MODE_MESSAGE_USES_ARRAYS = major > 19 || major === 19 && minor >= 2 || major === 18 && minor >= 13; -const HAS_LAZY_LOADED_TRANSLATORS = major > 19 || major === 19 && minor >= 3; +const HAS_LAZY_LOADED_TRANSLATORS = major === 20 && minor < 6 || major === 19 && minor >= 3; function readPackageScope(checkPath) { const rootSeparatorIndex = checkPath.indexOf(npath.sep); @@ -2020,31 +2042,46 @@ async function resolve$1(originalSpecifier, context, nextResolve) { if (!HAS_LAZY_LOADED_TRANSLATORS) { const binding = process.binding(`fs`); - const originalfstat = binding.fstat; - const ZIP_MASK = 4278190080; - const ZIP_MAGIC = 704643072; - binding.fstat = function(...args) { - const [fd, useBigint, req] = args; - if ((fd & ZIP_MASK) === ZIP_MAGIC && useBigint === false && req === void 0) { + const originalReadFile = binding.readFileUtf8 || binding.readFileSync; + if (originalReadFile) { + binding[originalReadFile.name] = function(...args) { try { - const stats = fs.fstatSync(fd); - return new Float64Array([ - stats.dev, - stats.mode, - stats.nlink, - stats.uid, - stats.gid, - stats.rdev, - stats.blksize, - stats.ino, - stats.size, - stats.blocks - ]); + return fs.readFileSync(args[0], { + encoding: `utf8`, + flag: args[1] + }); } catch { } - } - return originalfstat.apply(this, args); - }; + return originalReadFile.apply(this, args); + }; + } else { + const binding2 = process.binding(`fs`); + const originalfstat = binding2.fstat; + const ZIP_MASK = 4278190080; + const ZIP_MAGIC = 704643072; + binding2.fstat = function(...args) { + const [fd, useBigint, req] = args; + if ((fd & ZIP_MASK) === ZIP_MAGIC && useBigint === false && req === void 0) { + try { + const stats = fs.fstatSync(fd); + return new Float64Array([ + stats.dev, + stats.mode, + stats.nlink, + stats.uid, + stats.gid, + stats.rdev, + stats.blksize, + stats.ino, + stats.size, + stats.blocks + ]); + } catch { + } + } + return originalfstat.apply(this, args); + }; + } } const resolve = resolve$1; diff --git a/package.json b/package.json index 5f17bc8..774eb7d 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@testing-library/react-hooks": "8.0.1", "@testing-library/user-event": "14.5.2", "@types/jest": "29.5.11", - "@types/node": "18.18.9", + "@types/node": "18.19.9", "@types/react": "18.2.48", "@types/react-dom": "18.2.18", "@typescript-eslint/eslint-plugin": "5.62.0", diff --git a/yarn.lock b/yarn.lock index 39784c5..b321455 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1908,12 +1908,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:18.18.9": - version: 18.18.9 - resolution: "@types/node@npm:18.18.9" +"@types/node@npm:18.19.9": + version: 18.19.9 + resolution: "@types/node@npm:18.19.9" dependencies: undici-types: "npm:~5.26.4" - checksum: 8d58fba5eede0df009412ee188bc96f4baf340f4fafbda1bc66fb680fa775aedc88f0cb154a2455966443d9538af402fff022fb0632bddb1bd0648e5a86e5db9 + checksum: 7ca4b3f8eb176ef3351292636717649c0e2044109b91453477dbe0a25e4b8febe2bb965e183c24088c41f113256ed87662bfce7782a8ab9b1da19542ed247d00 languageName: node linkType: hard @@ -8986,7 +8986,7 @@ __metadata: "@testing-library/react-hooks": "npm:8.0.1" "@testing-library/user-event": "npm:14.5.2" "@types/jest": "npm:29.5.11" - "@types/node": "npm:18.18.9" + "@types/node": "npm:18.19.9" "@types/react": "npm:18.2.48" "@types/react-dom": "npm:18.2.18" "@typescript-eslint/eslint-plugin": "npm:5.62.0"