// We use this under tsdown (Rolldown), not Rollup. The `rollup` peer is only used for one TypeScript type, and it being missing apparently makes no difference in our usage.
// Forbid `@wordpress/scripts`. Brings in too many different versions of deps, like (as of March 2025) eslint 8 when we've already updated to eslint 9.
if(k.startsWith('@wordpress/scripts@')){
thrownewError(
"Please don't bring in `@wordpress/scripts`. It brings in different versions of a lot of dependencies, and we generally have our own way to do the things that it tries to do.\nFor example, instead of `wp-scripts build`, run `webpack` directly with a config based on our monorepo-internal `@automattic/jetpack-webpack-config` package."
);
}
// Encourage `sass-embedded` over `sass`. Supposed to be faster, and it would be easy for `sass` to leak in.
`Please use \`sass-embedded\` rather than \`${k.replace(/@.*/,'')}\`. We've standardized on the former.`
);
}
// We want to use `@jest/environment-jsdom-abstract` instead to allow for using newer `jsdom`.
if(k.startsWith('jest-environment-jsdom@')){
thrownewError(
// prettier-ignore
`You don't need \`jest-environment-jsdom\`. Our base config in \`tools/js-tools/jest/config.base.js\` already sets up a JSDOM environment from \`tools/js-tools/jest/fix-environment-jsdom.mjs\`, use that instead. pdWQjU-1vl-p2`
);
}
// Forbid installing webpack without webpack-cli. It results in lots of spurious lockfile changes.
"Something you've done is trying to add a dependency on webpack without webpack-cli.\nThis is not allowed, as it tends to result in pnpm lockfile flip-flopping.\nSee https://github.com/pnpm/pnpm/issues/3935 for the upstream bug report.\n"
);
}
}
for(constdeplistofwpPkgs){
for(constdepofdeplist.slice(0,deplist.length-1)){
if(!wpPkgFetches[dep]){
context.log(
// prettier-ignore
`pnpmfile hack needs updating: wpPkgs entry [ ${deplist.join(', ')} ] was not used. Is it obsolete?`