Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pnp)!: remove fallbacks to react-scripts and gatsby #3004

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions .pnp.cjs

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

28 changes: 25 additions & 3 deletions .pnp.loader.mjs

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

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"
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

Large diffs are not rendered by default.

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 @@ -13,7 +13,6 @@ import * as nodeUtils

export type MakeApiOptions = {
allowDebug?: boolean;
compatibilityMode?: boolean;
fakeFs: FakeFS<PortablePath>;
pnpapiResolution: NativePath;
};
Expand Down Expand Up @@ -47,33 +46,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
2 changes: 2 additions & 0 deletions scripts/e2e-setup-ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

# Run a check, thanks

set -e

HERE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
Expand Down
Loading