Skip to content

Commit

Permalink
Renames pnpEnableExperimentalEsm into pnpEnableEsmLoader (#3635)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored Oct 25, 2021
1 parent 8a11db0 commit fe834db
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
23 changes: 23 additions & 0 deletions .yarn/versions/84ac6b01.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ changesetIgnorePatterns:

enableGlobalCache: false

pnpEnableExperimentalEsm: false
pnpEnableEsmLoader: false

immutablePatterns:
- .pnp.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')`);
Expand Down Expand Up @@ -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))`);
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/static/configuration/yarnrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-pnp/sources/PnpLinker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-pnp/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ declare module '@yarnpkg/core' {
pnpMode: string;
pnpShebang: string;
pnpIgnorePatterns: Array<string>;
pnpEnableExperimentalEsm: boolean
pnpEnableEsmLoader: boolean
pnpEnableInlining: boolean;
pnpFallbackMode: string;
pnpUnpluggedFolder: PortablePath;
Expand Down Expand Up @@ -99,7 +99,7 @@ const plugin: Plugin<CoreHooks & StageHooks> = {
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,
Expand Down

0 comments on commit fe834db

Please sign in to comment.