Skip to content

Commit 57b4f9b

Browse files
fi3eworkampcode-com
andcommitted
revert: remove rslib underlying rspack version hotfix
Amp-Thread-ID: https://ampcode.com/threads/T-019cb911-c0c6-7646-a61c-a8fc261aeaf5 Co-authored-by: Amp <amp@ampcode.com>
1 parent 892d0c8 commit 57b4f9b

2 files changed

Lines changed: 9 additions & 54 deletions

File tree

tests/rsbuild/plugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export async function test(options: RunOptions) {
8282
},
8383
overrides: {
8484
// not override rslib's rsbuild version
85-
'@rslib/core>@rsbuild/core': '1.7.3',
85+
'@rslib/core>@rsbuild/core': 'latest',
8686
},
8787
test: [
8888
'build',

utils.ts

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ interface RspackPackageData {
6565

6666
let rspackPackageData: RspackPackageData | null = null;
6767

68-
const RSLIB_RSBUILD_COMPAT_VERSION = '1.7.3';
69-
const RSLIB_RSPACK_COMPAT_VERSION = '1.7.6';
70-
7168
export function cd(dir: string) {
7269
cwd = path.resolve(cwd, dir);
7370
}
@@ -331,24 +328,12 @@ async function getRspackPackageData(): Promise<RspackPackageData> {
331328
name: pkg.name,
332329
directory: path.join(stackPath, pkg.directory),
333330
});
334-
const normalizeAndFilterExisting = (pkgList: RspackPackageInfo[]) =>
335-
pkgList.map(normalize).filter((pkg) => {
336-
if (fs.existsSync(pkg.directory)) {
337-
return true;
338-
}
339-
console.warn(
340-
`[ecosystem-ci] skip missing rspack package override: ${pkg.name} -> ${pkg.directory}`,
341-
);
342-
return false;
343-
});
344331
rspackPackageData = {
345-
npm: normalizeAndFilterExisting(
346-
npm[
347-
optionalKey as 'darwin-arm64' | 'darwin-x64' | 'linux-x64' | 'win32-x64'
348-
],
349-
),
350-
binding: normalizeAndFilterExisting(binding),
351-
packages: normalizeAndFilterExisting(packages),
332+
npm: npm[
333+
optionalKey as 'darwin-arm64' | 'darwin-x64' | 'linux-x64' | 'win32-x64'
334+
].map(normalize),
335+
binding: binding.map(normalize),
336+
packages: packages.map(normalize),
352337
};
353338
return rspackPackageData;
354339
}
@@ -477,9 +462,6 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
477462
overrides[pkgInfo.name] ||= pkgInfo.directory;
478463
}
479464
}
480-
if (activeStack === 'rsbuild') {
481-
overrides['@rslib/core>@rsbuild/core'] ||= RSLIB_RSBUILD_COMPAT_VERSION;
482-
}
483465
await applyPackageOverrides({
484466
dir,
485467
pkg,
@@ -521,18 +503,6 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
521503
overrides[pkgInfo.name] ||= pkgInfo.directory;
522504
}
523505
}
524-
overrides['@rslib/core>@rsbuild/core'] ||= RSLIB_RSBUILD_COMPAT_VERSION;
525-
overrides[
526-
`@rsbuild/core@${RSLIB_RSBUILD_COMPAT_VERSION}>@rspack/core`
527-
] ||= RSLIB_RSPACK_COMPAT_VERSION;
528-
overrides[
529-
`@rspack/core@${RSLIB_RSPACK_COMPAT_VERSION}>@rspack/binding`
530-
] ||= RSLIB_RSPACK_COMPAT_VERSION;
531-
for (const pkgInfo of npm) {
532-
overrides[
533-
`@rspack/binding@${RSLIB_RSPACK_COMPAT_VERSION}>${pkgInfo.name}`
534-
] ||= RSLIB_RSPACK_COMPAT_VERSION;
535-
}
536506
await applyPackageOverrides({
537507
dir,
538508
pkg,
@@ -744,15 +714,6 @@ async function applyPackageOverrides({
744714
};
745715
devDependencyStrategy?: 'all' | 'local';
746716
}) {
747-
const isValidManifestDepName = (name: string): boolean => {
748-
if (name.includes('>')) {
749-
return false;
750-
}
751-
if (name.startsWith('@')) {
752-
return name.indexOf('@', 1) === -1;
753-
}
754-
return !name.includes('@');
755-
};
756717
const useFileProtocol = (v: string) =>
757718
isLocalOverride(v) ? `file:${path.resolve(v)}` : v;
758719
const normalizedOverrides = Object.fromEntries(
@@ -763,16 +724,10 @@ async function applyPackageOverrides({
763724

764725
const devOverrides =
765726
devDependencyStrategy === 'all'
766-
? Object.fromEntries(
767-
Object.entries(normalizedOverrides).filter(([key]) =>
768-
isValidManifestDepName(key),
769-
),
770-
)
727+
? normalizedOverrides
771728
: Object.fromEntries(
772-
Object.entries(normalizedOverrides).filter(
773-
([key, value]) =>
774-
isValidManifestDepName(key) &&
775-
(value as string).startsWith('file:'),
729+
Object.entries(normalizedOverrides).filter(([_key, value]) =>
730+
(value as string).startsWith('file:'),
776731
),
777732
);
778733

0 commit comments

Comments
 (0)