forked from web-infra-dev/modern.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pnpmfile.cjs
51 lines (45 loc) · 1.44 KB
/
.pnpmfile.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function readPackage(pkg, _context) {
// Fix: https://github.com/browserify/resolve/issues/264
// `resolve >= 1.21.0` breaks dts-packer, lock the version to 1.20.0.
if (pkg.name === 'dts-packer') {
pkg.dependencies.resolve = '1.20.0';
}
if (pkg.name === 'hast-util-from-html' && pkg.version.startsWith('1.')) {
pkg.dependencies = {
...pkg.dependencies,
'vfile-message': '^3.1.2',
};
}
// Some packages still depend on esbuild < 0.17, so we upgrade it manually.
// ref: https://github.com/lukeed/tsm/issues/48
if (pkg.name === 'tsm' || pkg.name === 'vite') {
pkg.dependencies.esbuild = '0.17.19';
}
// Fix peer dependencies warnings of legacy react libs
if (
pkg.name === 'flux' ||
pkg.name === 'react-inspector' ||
pkg.name === 'react-json-view' ||
pkg.name === '@mdx-js/react' ||
pkg.name === 'react-element-to-jsx-string'
) {
if (pkg.peerDependencies.react) {
pkg.peerDependencies.react = '>= 17';
}
if (pkg.peerDependencies['react-dom']) {
pkg.peerDependencies['react-dom'] = '>= 17';
}
}
if (
(pkg.name?.startsWith('@rspress/') || pkg.name?.startsWith('rspress')) &&
pkg.dependencies
) {
pkg.dependencies = Object.fromEntries(
Object.entries(pkg.dependencies).map(([key, value]) =>
key.startsWith('@modern-js/') ? [key, 'workspace:*'] : [key, value],
),
);
}
return pkg;
}
module.exports = { hooks: { readPackage } };