From fe834db970bd415effc76ba1e04861c52d441bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Mon, 25 Oct 2021 15:54:08 +0200 Subject: [PATCH] Renames pnpEnableExperimentalEsm into pnpEnableEsmLoader (#3635) --- .yarn/versions/84ac6b01.yml | 23 +++++++++++++++++++ .yarnrc.yml | 2 +- .../pkg-tests-specs/sources/pnp-esm.test.ts | 4 ++-- .../gatsby/static/configuration/yarnrc.json | 2 +- packages/plugin-pnp/sources/PnpLinker.ts | 4 ++-- packages/plugin-pnp/sources/index.ts | 4 ++-- 6 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .yarn/versions/84ac6b01.yml diff --git a/.yarn/versions/84ac6b01.yml b/.yarn/versions/84ac6b01.yml new file mode 100644 index 000000000000..9a2bf7f3eea5 --- /dev/null +++ b/.yarn/versions/84ac6b01.yml @@ -0,0 +1,23 @@ +releases: + "@yarnpkg/cli": patch + "@yarnpkg/plugin-pnp": patch + +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-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/core" + - "@yarnpkg/doctor" diff --git a/.yarnrc.yml b/.yarnrc.yml index 9f16ff0015d6..2e9c590928aa 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -3,7 +3,7 @@ changesetIgnorePatterns: enableGlobalCache: false -pnpEnableExperimentalEsm: false +pnpEnableEsmLoader: false immutablePatterns: - .pnp.* diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts index 9d7cf1640c20..3fffd7f139fe 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts @@ -273,7 +273,7 @@ describe(`Plug'n'Play - ESM`, () => { makeTemporaryEnv( { }, { - pnpEnableExperimentalEsm: true, + pnpEnableEsmLoader: true, }, async ({path, run, source}) => { await xfs.writeFilePromise(ppath.join(path, `index` as Filename), `console.log(typeof require === 'undefined')`); @@ -371,7 +371,7 @@ describe(`Plug'n'Play - ESM`, () => { }, }, { - pnpEnableExperimentalEsm: true, + pnpEnableEsmLoader: true, }, async ({path, run, source}) => { await xfs.writeFilePromise(ppath.join(path, `index.js` as Filename), `import('no-deps').then(() => console.log(42))`); diff --git a/packages/gatsby/static/configuration/yarnrc.json b/packages/gatsby/static/configuration/yarnrc.json index 8542f3668225..519402e04204 100644 --- a/packages/gatsby/static/configuration/yarnrc.json +++ b/packages/gatsby/static/configuration/yarnrc.json @@ -556,7 +556,7 @@ "format": "uri-reference", "default": "./.pnp.data.json" }, - "pnpEnableExperimentalEsm": { + "pnpEnableEsmLoader": { "_package": "@yarnpkg/plugin-pnp", "description": "If true, Yarn will generate an experimental ESM loader (`.pnp.loader.mjs`). Yarn tries to automatically detect whether ESM support is required.", "type": "boolean", diff --git a/packages/plugin-pnp/sources/PnpLinker.ts b/packages/plugin-pnp/sources/PnpLinker.ts index 0a526419410b..dec07bf1c6bb 100644 --- a/packages/plugin-pnp/sources/PnpLinker.ts +++ b/packages/plugin-pnp/sources/PnpLinker.ts @@ -294,8 +294,8 @@ export class PnpInstaller implements Installer { } private isEsmEnabled() { - if (this.opts.project.configuration.sources.has(`pnpEnableExperimentalEsm`)) - return this.opts.project.configuration.get(`pnpEnableExperimentalEsm`); + if (this.opts.project.configuration.sources.has(`pnpEnableEsmLoader`)) + return this.opts.project.configuration.get(`pnpEnableEsmLoader`); if (this.isESMLoaderRequired) return true; diff --git a/packages/plugin-pnp/sources/index.ts b/packages/plugin-pnp/sources/index.ts index f63d78f96b5f..01d234c72e35 100644 --- a/packages/plugin-pnp/sources/index.ts +++ b/packages/plugin-pnp/sources/index.ts @@ -64,7 +64,7 @@ declare module '@yarnpkg/core' { pnpMode: string; pnpShebang: string; pnpIgnorePatterns: Array; - pnpEnableExperimentalEsm: boolean + pnpEnableEsmLoader: boolean pnpEnableInlining: boolean; pnpFallbackMode: string; pnpUnpluggedFolder: PortablePath; @@ -99,7 +99,7 @@ const plugin: Plugin = { default: [], isArray: true, }, - pnpEnableExperimentalEsm: { + pnpEnableEsmLoader: { description: `If true, Yarn will generate an ESM loader (\`.pnp.loader.mjs\`). If this is not explicitly set Yarn tries to automatically detect whether ESM support is required.`, type: SettingsType.BOOLEAN, default: false,