feat(client): migration old package to rspack (#15068)

#### PR Dependency Tree


* **PR #15068** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Upgraded Vitest across packages to 4.1.8 and bumped Tailwind PostCSS
to 4.3.0
* CLI/tooling updated to support the media-capture-playground package
and adjust build/dev server behavior

* **Bug Fixes**
  * Improved workspace deletion reliability in the Electron app

* **Refactor**
* Simplified media capture playground build setup (build/config
adjustments)

* **Tests**
* Made tests more robust by preserving/restoring environment state
during runs
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-06-02 12:00:50 +08:00
committed by GitHub
parent 69c2f09eba
commit aca47445aa
50 changed files with 738 additions and 507 deletions
+37 -5
View File
@@ -194,11 +194,41 @@ function getRspackBundleConfigs(pkg: Package): MultiRspackOptions {
}),
] as MultiRspackOptions;
}
case '@affine/media-capture-playground': {
return [
createRspackHTMLTargetConfig(pkg, pkg.join('web/main.tsx').value, {
template: pkg.join('web/index.html').value,
additionalEntryForSelfhost: false,
copySharedPublicAssets: false,
injectGlobalErrorHandler: false,
emitAssetsManifest: false,
}),
] as MultiRspackOptions;
}
}
throw new Error(`Unsupported package: ${pkg.name}`);
}
function getRspackDevServerConfig(
pkg: Package
): RspackDevServerConfiguration | undefined {
if (pkg.name !== '@affine/media-capture-playground') {
return;
}
return {
proxy: [
{
context: '/api',
target: 'http://localhost:6544',
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
],
};
}
export class BundleCommand extends PackageCommand {
static override paths = [['bundle'], ['pack'], ['bun']];
@@ -214,7 +244,7 @@ export class BundleCommand extends PackageCommand {
const pkg = this.workspace.getPackage(this.package);
if (this.dev) {
await BundleCommand.dev(pkg);
await BundleCommand.dev(pkg, getRspackDevServerConfig(pkg));
} else {
await BundleCommand.build(pkg);
}
@@ -294,10 +324,12 @@ export class BundleCommand extends PackageCommand {
throw new Error('Failed to create rspack compiler');
}
const devServer = new RspackDevServer(
merge({}, DEFAULT_DEV_SERVER_CONFIG, devServerConfig),
compiler
);
const serverConfig = merge({}, DEFAULT_DEV_SERVER_CONFIG, devServerConfig);
if (devServerConfig?.proxy) {
serverConfig.proxy = devServerConfig.proxy;
}
const devServer = new RspackDevServer(serverConfig, compiler);
await devServer.start();
}