From d522fa163368f64fcfa56faba1dcbfdc3cef335e Mon Sep 17 00:00:00 2001 From: Peter Sutter Date: Tue, 14 May 2024 16:39:31 +0200 Subject: [PATCH] yarn --- .pnp.cjs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ .pnp.loader.mjs | 42 +++++++++++++++++++++++++++++++++---- 2 files changed, 94 insertions(+), 4 deletions(-) diff --git a/.pnp.cjs b/.pnp.cjs index c288887e68..55a66cd241 100644 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -1,5 +1,6 @@ #!/usr/bin/env node /* eslint-disable */ +// @ts-nocheck "use strict"; const RAW_RUNTIME_STATE = @@ -14720,6 +14721,12 @@ class ProxiedFS extends FakeFS { rmdirSync(p, opts) { return this.baseFs.rmdirSync(this.mapToBase(p), opts); } + async rmPromise(p, opts) { + return this.baseFs.rmPromise(this.mapToBase(p), opts); + } + rmSync(p, opts) { + return this.baseFs.rmSync(this.mapToBase(p), opts); + } async linkPromise(existingP, newP) { return this.baseFs.linkPromise(this.mapToBase(existingP), this.mapToBase(newP)); } @@ -15101,6 +15108,18 @@ class NodeFS extends BasePortableFakeFS { rmdirSync(p, opts) { return this.realFs.rmdirSync(npath.fromPortablePath(p), opts); } + async rmPromise(p, opts) { + return await new Promise((resolve, reject) => { + if (opts) { + this.realFs.rm(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject)); + } else { + this.realFs.rm(npath.fromPortablePath(p), this.makeCallback(resolve, reject)); + } + }); + } + rmSync(p, opts) { + return this.realFs.rmSync(npath.fromPortablePath(p), opts); + } async linkPromise(existingP, newP) { return await new Promise((resolve, reject) => { this.realFs.link(npath.fromPortablePath(existingP), npath.fromPortablePath(newP), this.makeCallback(resolve, reject)); @@ -15756,6 +15775,20 @@ class MountFS extends BasePortableFakeFS { return mountFs.rmdirSync(subPath, opts); }); } + async rmPromise(p, opts) { + return await this.makeCallPromise(p, async () => { + return await this.baseFs.rmPromise(p, opts); + }, async (mountFs, { subPath }) => { + return await mountFs.rmPromise(subPath, opts); + }); + } + rmSync(p, opts) { + return this.makeCallSync(p, () => { + return this.baseFs.rmSync(p, opts); + }, (mountFs, { subPath }) => { + return mountFs.rmSync(subPath, opts); + }); + } async linkPromise(existingP, newP) { return await this.makeCallPromise(newP, async () => { return await this.baseFs.linkPromise(existingP, newP); @@ -16394,6 +16427,7 @@ const SYNC_IMPLEMENTATIONS = /* @__PURE__ */ new Set([ `realpathSync`, `renameSync`, `rmdirSync`, + `rmSync`, `statSync`, `symlinkSync`, `truncateSync`, @@ -16429,6 +16463,7 @@ const ASYNC_IMPLEMENTATIONS = /* @__PURE__ */ new Set([ `readlinkPromise`, `renamePromise`, `rmdirPromise`, + `rmPromise`, `statPromise`, `symlinkPromise`, `truncatePromise`, @@ -18454,6 +18489,27 @@ class ZipFS extends BasePortableFakeFS { throw EINVAL(`rmdir '${p}'`); this.deleteEntry(p, index); } + async rmPromise(p, opts) { + return this.rmSync(p, opts); + } + rmSync(p, { recursive = false } = {}) { + if (this.readOnly) + throw EROFS(`rm '${p}'`); + if (recursive) { + this.removeSync(p); + return; + } + const resolvedP = this.resolveFilename(`rm '${p}'`, p); + const directoryListing = this.listings.get(resolvedP); + if (!directoryListing) + throw ENOTDIR(`rm '${p}'`); + if (directoryListing.size > 0) + throw ENOTEMPTY(`rm '${p}'`); + const index = this.entries.get(resolvedP); + if (typeof index === `undefined`) + throw EINVAL(`rm '${p}'`); + this.deleteEntry(p, index); + } hydrateDirectory(resolvedP) { const index = this.libzip.dir.add(this.zip, ppath.relative(PortablePath.root, resolvedP)); if (index === -1) diff --git a/.pnp.loader.mjs b/.pnp.loader.mjs index 81ae9a6b29..6815830b6f 100644 --- a/.pnp.loader.mjs +++ b/.pnp.loader.mjs @@ -1,3 +1,6 @@ +/* eslint-disable */ +// @ts-nocheck + import fs from 'fs'; import { URL as URL$1, fileURLToPath, pathToFileURL } from 'url'; import path from 'path'; @@ -830,6 +833,12 @@ class ProxiedFS extends FakeFS { rmdirSync(p, opts) { return this.baseFs.rmdirSync(this.mapToBase(p), opts); } + async rmPromise(p, opts) { + return this.baseFs.rmPromise(this.mapToBase(p), opts); + } + rmSync(p, opts) { + return this.baseFs.rmSync(this.mapToBase(p), opts); + } async linkPromise(existingP, newP) { return this.baseFs.linkPromise(this.mapToBase(existingP), this.mapToBase(newP)); } @@ -1211,6 +1220,18 @@ class NodeFS extends BasePortableFakeFS { rmdirSync(p, opts) { return this.realFs.rmdirSync(npath.fromPortablePath(p), opts); } + async rmPromise(p, opts) { + return await new Promise((resolve, reject) => { + if (opts) { + this.realFs.rm(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject)); + } else { + this.realFs.rm(npath.fromPortablePath(p), this.makeCallback(resolve, reject)); + } + }); + } + rmSync(p, opts) { + return this.realFs.rmSync(npath.fromPortablePath(p), opts); + } async linkPromise(existingP, newP) { return await new Promise((resolve, reject) => { this.realFs.link(npath.fromPortablePath(existingP), npath.fromPortablePath(newP), this.makeCallback(resolve, reject)); @@ -1403,6 +1424,8 @@ const URL = Number(process.versions.node.split('.', 1)[0]) < 20 ? URL$1 : global 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 === 20 && minor < 6 || major === 19 && minor >= 3; +const SUPPORTS_IMPORT_ATTRIBUTES = major >= 21 || major === 20 && minor >= 10 || major === 18 && minor >= 20; +const SUPPORTS_IMPORT_ATTRIBUTES_ONLY = major >= 22; function readPackageScope(checkPath) { const rootSeparatorIndex = checkPath.indexOf(npath.sep); @@ -1493,10 +1516,21 @@ async function load$1(urlString, context, nextLoad) { const format = getFileFormat(filePath); if (!format) return nextLoad(urlString, context, nextLoad); - if (format === `json` && context.importAssertions?.type !== `json`) { - const err = new TypeError(`[ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "${urlString}" needs an import assertion of type "json"`); - err.code = `ERR_IMPORT_ASSERTION_TYPE_MISSING`; - throw err; + if (format === `json`) { + if (SUPPORTS_IMPORT_ATTRIBUTES_ONLY) { + if (context.importAttributes?.type !== `json`) { + const err = new TypeError(`[ERR_IMPORT_ATTRIBUTE_MISSING]: Module "${urlString}" needs an import attribute of "type: json"`); + err.code = `ERR_IMPORT_ATTRIBUTE_MISSING`; + throw err; + } + } else { + const type = `importAttributes` in context ? context.importAttributes?.type : context.importAssertions?.type; + if (type !== `json`) { + const err = new TypeError(`[ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "${urlString}" needs an import ${SUPPORTS_IMPORT_ATTRIBUTES ? `attribute` : `assertion`} of type "json"`); + err.code = `ERR_IMPORT_ASSERTION_TYPE_MISSING`; + throw err; + } + } } if (process.env.WATCH_REPORT_DEPENDENCIES && process.send) { const pathToSend = pathToFileURL(