Skip to content

Commit 06df849

Browse files
authored
chore: Bump Yarn to 4.16.0 (#4019)
This bumps Yarn to `4.16.0`. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Small plugin-only change to dependency loading; no auth, data, or product logic touched. > > **Overview** > Updates the local **`plugin-workspaces-filter`** plugin so it stays compatible with **Yarn 4.16.0** after the bump. > > In both **`FilterListCommand`** and **`FilterRunCommand`**, **`minimatch`** is no longer loaded with dynamic **`import('minimatch')`**. It now uses Node’s **`createRequire(__filename)`** so the dependency resolves from the repo (e.g. root **`devDependencies`**) instead of Yarn’s restricted plugin **`require`** sandbox. > > No runtime behavior change for **`--include` / `--exclude`** glob filtering—only how **`minimatch`** is resolved at command execution time. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit cb3187c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 33458a1 commit 06df849

6 files changed

Lines changed: 15 additions & 951 deletions

File tree

.yarn/plugins/local/plugin-workspaces-filter.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ module.exports = {
7171
}
7272

7373
async execute() {
74-
// Note: We have to import `minimatch` here, because Yarn will always
74+
// Note: We have to require `minimatch` here, because Yarn will always
7575
// load the plugin, even if the command is not used, and `minimatch`
76-
// may not be installed.
77-
const { minimatch } = await import('minimatch');
76+
// may not be installed. We use `createRequire` from Node's built-in
77+
// `module` package to bypass Yarn's restricted plugin `require`, which
78+
// only allows access to Yarn's own bundled packages.
79+
const { createRequire } = require('module');
80+
const { minimatch } = createRequire(__filename)('minimatch');
7881

7982
const configuration = await Configuration.find(
8083
this.context.cwd,
@@ -203,10 +206,13 @@ module.exports = {
203206
}
204207

205208
async execute() {
206-
// Note: We have to import `minimatch` here, because Yarn will always
209+
// Note: We have to require `minimatch` here, because Yarn will always
207210
// load the plugin, even if the command is not used, and `minimatch`
208-
// may not be installed.
209-
const { minimatch } = await import('minimatch');
211+
// may not be installed. We use `createRequire` from Node's built-in
212+
// `module` package to bypass Yarn's restricted plugin `require`, which
213+
// only allows access to Yarn's own bundled packages.
214+
const { createRequire } = require('module');
215+
const { minimatch } = createRequire(__filename)('minimatch');
210216

211217
const configuration = await Configuration.find(
212218
this.context.cwd,

0 commit comments

Comments
 (0)