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 Nov 4, 2023
1 parent 29fa245 commit bbd61f3
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 52 deletions.
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

0 comments on commit bbd61f3

Please sign in to comment.