Skip to content

Commit

Permalink
chore(pnp)!: remove fallbacks to react-scripts and gatsby
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Sep 2, 2022
1 parent 4c8ab43 commit 1a18d3c
Show file tree
Hide file tree
Showing 8 changed files with 861 additions and 715 deletions.
1,512 changes: 829 additions & 683 deletions .pnp.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/versions/f63ca7e8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
releases:
"@yarnpkg/cli": major
"@yarnpkg/plugin-pnp": major
"@yarnpkg/pnp": major

declined:
- "@yarnpkg/esbuild-plugin-pnp"
- "@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"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https:
- Some legacy layers have been sunset:
- Plugins cannot access the Clipanion 2 APIs anymore (upgrade to [Clipanion 3](https://github.com/arcanis/clipanion))
- Plugins cannot access the internal copy of Yup anymore (use [Typanion](https://github.com/arcanis/typanion) instead)
- PnP fallbacks to `react-scripts` and `gatsby`'s dependencies has been removed since they cause hard to debug issues and those projects should work without them nowadays
- The network settings configuration option has been renamed from `caFilePath` to `httpsCaFilePath`.
- Set `nmMode` to `hardlinks-local` by default.
- `yarn workspaces foreach` now automatically enables the `-v,--verbose` flag in interactive terminal environments.
Expand Down
2 changes: 1 addition & 1 deletion packages/yarnpkg-core/sources/worker-zip/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/yarnpkg-pnp/sources/esm-loader/built-loader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/yarnpkg-pnp/sources/hook.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/yarnpkg-pnp/sources/hydratePnpApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export function hydratePnpSource(source: string, {basePath, fakeFs, pnpapiResolu
});

return makeApi(runtimeState, {
compatibilityMode: true,
fakeFs,
pnpapiResolution,
});
Expand Down
28 changes: 0 additions & 28 deletions packages/yarnpkg-pnp/sources/loader/makeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as nodeUtils

export type MakeApiOptions = {
allowDebug?: boolean;
compatibilityMode?: boolean;
fakeFs: FakeFS<PortablePath>;
pnpapiResolution: NativePath;
};
Expand Down Expand Up @@ -45,33 +44,6 @@ export function makeApi(runtimeState: RuntimeState, opts: MakeApiOptions): PnpAp
if (runtimeState.enableTopLevelFallback === true)
fallbackLocators.push(topLevelLocator);

if (opts.compatibilityMode !== false) {
// ESLint currently doesn't have any portable way for shared configs to
// specify their own plugins that should be used (cf issue #10125). This
// will likely get fixed at some point but it'll take time, so in the
// meantime we'll just add additional fallback entries for common shared
// configs.

// Similarly, Gatsby generates files within the `public` folder located
// within the project, but doesn't pre-resolve the `require` calls to use
// its own dependencies. Meaning that when PnP see a file from the `public`
// folder making a require, it thinks that your project forgot to list one
// of your dependencies.

for (const name of [`react-scripts`, `gatsby`]) {
const packageStore = runtimeState.packageRegistry.get(name);
if (packageStore) {
for (const reference of packageStore.keys()) {
if (reference === null) {
throw new Error(`Assertion failed: This reference shouldn't be null`);
} else {
fallbackLocators.push({name, reference});
}
}
}
}
}

/**
* The setup code will be injected here. The tables listed below are guaranteed to be filled after the call to
* the $$DYNAMICALLY_GENERATED_CODE function.
Expand Down

0 comments on commit 1a18d3c

Please sign in to comment.