From fde9dfafd515704abd8f066f9769d7fe3d9af5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Fri, 25 Mar 2022 17:28:38 +0100 Subject: [PATCH] Removes the compatibility layer for Clipanion 2 (#4262) * Removes the compatibility layer for Clipanion 2 * Removes compat file --- .yarn/versions/6d6580e4.yml | 23 ++++++++++++++++++ .../tools/backportClipanionCompatibility.ts | 24 ------------------- .../tools/getPluginConfiguration.val.js | 4 +--- 3 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 .yarn/versions/6d6580e4.yml delete mode 100644 packages/yarnpkg-cli/sources/tools/backportClipanionCompatibility.ts diff --git a/.yarn/versions/6d6580e4.yml b/.yarn/versions/6d6580e4.yml new file mode 100644 index 000000000000..69dbdb38f160 --- /dev/null +++ b/.yarn/versions/6d6580e4.yml @@ -0,0 +1,23 @@ +releases: + "@yarnpkg/cli": major + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/core" + - "@yarnpkg/doctor" diff --git a/packages/yarnpkg-cli/sources/tools/backportClipanionCompatibility.ts b/packages/yarnpkg-cli/sources/tools/backportClipanionCompatibility.ts deleted file mode 100644 index e9dc34144528..000000000000 --- a/packages/yarnpkg-cli/sources/tools/backportClipanionCompatibility.ts +++ /dev/null @@ -1,24 +0,0 @@ -export function backportClipanionCompatibility(clipanion: any) { - clipanion.Command.Path = (...p: Array) => (instance: any) => { - instance.paths = instance.paths || []; - instance.paths.push(p); - }; - - for (const fn of [`Array`, `Boolean`, `String`, `Proxy`, `Rest`, `Counter`]) { - clipanion.Command[fn] = (...args: Array) => (instance: any, propertyName: any) => { - const value = clipanion.Option[fn](...args); - Object.defineProperty(instance, `__${propertyName}`, { - configurable: false, - enumerable: true, - get() { - return value; - }, - set(value) { - this[propertyName] = value; - }, - }); - }; - } - - return clipanion; -} diff --git a/packages/yarnpkg-cli/sources/tools/getPluginConfiguration.val.js b/packages/yarnpkg-cli/sources/tools/getPluginConfiguration.val.js index 027f0a37f765..3eaf0a6db822 100644 --- a/packages/yarnpkg-cli/sources/tools/getPluginConfiguration.val.js +++ b/packages/yarnpkg-cli/sources/tools/getPluginConfiguration.val.js @@ -7,7 +7,7 @@ module.exports = ({modules, plugins}) => { }).join(``); const moduleSegment = ` modules: new Map([\n${modules.map((request, index) => { - return ` [${JSON.stringify(require(`${request}/package.json`).name)}, ${request === `clipanion` ? `backportClipanionCompatibility` : ``}(_${index})],\n`; + return ` [${JSON.stringify(require(`${request}/package.json`).name)}, _${index}],\n`; }).join(``)} ]),\n`; const pluginSegment = ` plugins: new Set([\n${plugins.map(request => { @@ -16,8 +16,6 @@ module.exports = ({modules, plugins}) => { return { code: [ - `import {backportClipanionCompatibility} from './backportClipanionCompatibility';\n`, - `\n`, importSegment, `export const getPluginConfiguration = () => ({\n`, moduleSegment,