diff --git a/wasm/example/.pnp.cjs b/wasm/example/.pnp.cjs index 54c1704..56643dc 100644 --- a/wasm/example/.pnp.cjs +++ b/wasm/example/.pnp.cjs @@ -419,7 +419,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["minipass-pipeline", "npm:1.2.4"],\ ["p-map", "npm:4.0.0"],\ ["ssri", "npm:10.0.5"],\ - ["tar", "npm:6.2.0"],\ + ["tar", "npm:6.2.1"],\ ["unique-filename", "npm:3.0.0"]\ ],\ "linkType": "HARD"\ @@ -1084,7 +1084,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["npmlog", "npm:6.0.2"],\ ["rimraf", "npm:3.0.2"],\ ["semver", "npm:7.5.4"],\ - ["tar", "npm:6.2.0"],\ + ["tar", "npm:6.2.1"],\ ["which", "npm:2.0.2"]\ ],\ "linkType": "HARD"\ @@ -1409,10 +1409,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["tar", [\ - ["npm:6.2.0", {\ - "packageLocation": "./.yarn/cache/tar-npm-6.2.0-3eb25205a7-db4d9fe74a.zip/node_modules/tar/",\ + ["npm:6.2.1", {\ + "packageLocation": "./.yarn/cache/tar-npm-6.2.1-237800bb20-f1322768c9.zip/node_modules/tar/",\ "packageDependencies": [\ - ["tar", "npm:6.2.0"],\ + ["tar", "npm:6.2.1"],\ ["chownr", "npm:2.0.0"],\ ["fs-minipass", "npm:2.1.0"],\ ["minipass", "npm:5.0.0"],\ @@ -3374,7 +3374,8 @@ class ZipFS extends BasePortableFakeFS { stream$1.destroy(); }, bytesRead: 0, - path: p + path: p, + pending: false } ); const immediate = setImmediate(async () => { @@ -3415,11 +3416,12 @@ class ZipFS extends BasePortableFakeFS { } }), { - bytesWritten: 0, - path: p, close() { stream$1.destroy(); - } + }, + bytesWritten: 0, + path: p, + pending: false } ); stream$1.on(`data`, (chunk) => { @@ -4359,18 +4361,10 @@ class ProxiedFS extends FakeFS { return this.baseFs.symlinkSync(mappedTarget, mappedP, type); } async readFilePromise(p, encoding) { - if (encoding === `utf8`) { - return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding); - } else { - return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding); - } + return this.baseFs.readFilePromise(this.fsMapToBase(p), encoding); } readFileSync(p, encoding) { - if (encoding === `utf8`) { - return this.baseFs.readFileSync(this.fsMapToBase(p), encoding); - } else { - return this.baseFs.readFileSync(this.fsMapToBase(p), encoding); - } + return this.baseFs.readFileSync(this.fsMapToBase(p), encoding); } async readdirPromise(p, opts) { return this.baseFs.readdirPromise(this.mapToBase(p), opts); @@ -5096,24 +5090,14 @@ class ZipOpenFS extends BasePortableFakeFS { } async readFilePromise(p, encoding) { return this.makeCallPromise(p, async () => { - switch (encoding) { - case `utf8`: - return await this.baseFs.readFilePromise(p, encoding); - default: - return await this.baseFs.readFilePromise(p, encoding); - } + return await this.baseFs.readFilePromise(p, encoding); }, async (zipFs, { subPath }) => { return await zipFs.readFilePromise(subPath, encoding); }); } readFileSync(p, encoding) { return this.makeCallSync(p, () => { - switch (encoding) { - case `utf8`: - return this.baseFs.readFileSync(p, encoding); - default: - return this.baseFs.readFileSync(p, encoding); - } + return this.baseFs.readFileSync(p, encoding); }, (zipFs, { subPath }) => { return zipFs.readFileSync(subPath, encoding); }); @@ -5805,38 +5789,28 @@ function patchFs(patchedFs, fakeFs) { patchedFs.realpathSync.native = patchedFs.realpathSync; } { - const origEmitWarning = process.emitWarning; - process.emitWarning = () => { - }; - let patchedFsPromises; - try { - patchedFsPromises = patchedFs.promises; - } finally { - process.emitWarning = origEmitWarning; - } - if (typeof patchedFsPromises !== `undefined`) { - for (const fnName of ASYNC_IMPLEMENTATIONS) { - const origName = fnName.replace(/Promise$/, ``); - if (typeof patchedFsPromises[origName] === `undefined`) - continue; - const fakeImpl = fakeFs[fnName]; - if (typeof fakeImpl === `undefined`) - continue; - if (fnName === `open`) - continue; - setupFn(patchedFsPromises, origName, (pathLike, ...args) => { - if (pathLike instanceof FileHandle) { - return pathLike[origName].apply(pathLike, args); - } else { - return fakeImpl.call(fakeFs, pathLike, ...args); - } - }); - } - setupFn(patchedFsPromises, `open`, async (...args) => { - const fd = await fakeFs.openPromise(...args); - return new FileHandle(fd, fakeFs); + const patchedFsPromises = patchedFs.promises; + for (const fnName of ASYNC_IMPLEMENTATIONS) { + const origName = fnName.replace(/Promise$/, ``); + if (typeof patchedFsPromises[origName] === `undefined`) + continue; + const fakeImpl = fakeFs[fnName]; + if (typeof fakeImpl === `undefined`) + continue; + if (fnName === `open`) + continue; + setupFn(patchedFsPromises, origName, (pathLike, ...args) => { + if (pathLike instanceof FileHandle) { + return pathLike[origName].apply(pathLike, args); + } else { + return fakeImpl.call(fakeFs, pathLike, ...args); + } }); } + setupFn(patchedFsPromises, `open`, async (...args) => { + const fd = await fakeFs.openPromise(...args); + return new FileHandle(fd, fakeFs); + }); } { patchedFs.read[nodeUtils.promisify.custom] = async (fd, buffer, ...args) => { @@ -12083,7 +12057,7 @@ function makeManager(pnpapi, opts) { apiEntry.lastRefreshCheck = timeNow; const stats = opts.fakeFs.statSync(pnpApiPath); if (stats.mtime > apiEntry.stats.mtime) { - process.emitWarning(`[Warning] The runtime detected new informations in a PnP file; reloading the API instance (${npath.fromPortablePath(pnpApiPath)})`); + process.emitWarning(`[Warning] The runtime detected new information in a PnP file; reloading the API instance (${npath.fromPortablePath(pnpApiPath)})`); apiEntry.stats = stats; apiEntry.instance = loadApiInstance(pnpApiPath); } diff --git a/wasm/example/yarn.lock b/wasm/example/yarn.lock index 451c737..784fc39 100644 --- a/wasm/example/yarn.lock +++ b/wasm/example/yarn.lock @@ -1266,8 +1266,8 @@ __metadata: linkType: hard "tar@npm:^6.1.11, tar@npm:^6.1.2": - version: 6.2.0 - resolution: "tar@npm:6.2.0" + version: 6.2.1 + resolution: "tar@npm:6.2.1" dependencies: chownr: ^2.0.0 fs-minipass: ^2.0.0 @@ -1275,7 +1275,7 @@ __metadata: minizlib: ^2.1.1 mkdirp: ^1.0.3 yallist: ^4.0.0 - checksum: db4d9fe74a2082c3a5016630092c54c8375ff3b280186938cfd104f2e089c4fd9bad58688ef6be9cf186a889671bf355c7cda38f09bbf60604b281715ca57f5c + checksum: f1322768c9741a25356c11373bce918483f40fa9a25c69c59410c8a1247632487edef5fe76c5f12ac51a6356d2f1829e96d2bc34098668a2fc34d76050ac2b6c languageName: node linkType: hard