mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-21 08:17:10 +08:00
#### PR Dependency Tree * **PR #14434** 👈 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 * **New Features** * Introduced rspack bundler as an alternative to webpack for optimized builds. * **Tests & Quality** * Added comprehensive editor semantic tests covering markdown, hotkeys, and slash-menu operations. * Expanded CI cross-browser testing to Chromium, Firefox, and WebKit; improved shape-rendering tests to account for zoom. * **Bug Fixes** * Corrected CSS overlay styling for development servers. * Fixed TypeScript typings for build tooling. * **Other** * Document duplication now produces consistent "(n)" suffixes. * French i18n completeness increased to 100%. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
101 lines
2.5 KiB
TypeScript
101 lines
2.5 KiB
TypeScript
function testPackageName(regexp: RegExp): (module: any) => boolean {
|
|
return (module: any) =>
|
|
module.nameForCondition && regexp.test(module.nameForCondition());
|
|
}
|
|
|
|
// https://hackernoon.com/the-100-correct-way-to-split-your-chunks-with-webpack-f8a9df5b7758
|
|
export const productionCacheGroups = {
|
|
i18n: {
|
|
test: /frontend[\\/]i18n[\\/]/,
|
|
name: (module: any) => {
|
|
const name = module.resource.match(/[\\/]([^\\/]+)\.json$/)?.[1];
|
|
if (name && name !== 'en') {
|
|
return `i18n-langs.${name}`;
|
|
}
|
|
|
|
return 'i18n';
|
|
},
|
|
priority: 200,
|
|
enforce: true,
|
|
},
|
|
asyncVendor: {
|
|
test: /[\\/]node_modules[\\/]/,
|
|
name(module: any) {
|
|
const modulePath =
|
|
module?.nameForCondition?.() || module?.context || module?.resource;
|
|
|
|
if (!modulePath || typeof modulePath !== 'string') {
|
|
return 'app-async';
|
|
}
|
|
|
|
// monorepo linked in node_modules, so it's not a npm package
|
|
if (!modulePath.includes('node_modules')) {
|
|
return `app-async`;
|
|
}
|
|
const name = modulePath.match(
|
|
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
|
|
)?.[1];
|
|
return `npm-async-${name}`;
|
|
},
|
|
priority: Number.MAX_SAFE_INTEGER,
|
|
chunks: 'async' as const,
|
|
},
|
|
blocksuite: {
|
|
name: `npm-blocksuite`,
|
|
test: testPackageName(/[\\/]node_modules[\\/](@blocksuite)[\\/]/),
|
|
priority: 200,
|
|
enforce: true,
|
|
},
|
|
react: {
|
|
name: `npm-react`,
|
|
test: testPackageName(
|
|
/[\\/]node_modules[\\/](react|react-dom|scheduler)[\\/]/
|
|
),
|
|
priority: 200,
|
|
enforce: true,
|
|
},
|
|
jotai: {
|
|
name: `npm-jotai`,
|
|
test: testPackageName(/[\\/]node_modules[\\/](jotai)[\\/]/),
|
|
priority: 200,
|
|
enforce: true,
|
|
},
|
|
rxjs: {
|
|
name: `npm-rxjs`,
|
|
test: testPackageName(/[\\/]node_modules[\\/]rxjs[\\/]/),
|
|
priority: 200,
|
|
enforce: true,
|
|
},
|
|
lodash: {
|
|
name: `npm-lodash`,
|
|
test: testPackageName(/[\\/]node_modules[\\/]lodash[\\/]/),
|
|
priority: 200,
|
|
enforce: true,
|
|
},
|
|
emotion: {
|
|
name: `npm-emotion`,
|
|
test: testPackageName(/[\\/]node_modules[\\/](@emotion)[\\/]/),
|
|
priority: 200,
|
|
enforce: true,
|
|
},
|
|
vendor: {
|
|
name: 'vendor',
|
|
test: /[\\/]node_modules[\\/]/,
|
|
priority: 190,
|
|
enforce: true,
|
|
},
|
|
styles: {
|
|
name: 'styles',
|
|
test: (module: any) =>
|
|
module.nameForCondition &&
|
|
module.nameForCondition()?.endsWith('.css') &&
|
|
!module.type.startsWith('javascript'),
|
|
chunks: 'all' as const,
|
|
minSize: 1,
|
|
minChunks: 1,
|
|
reuseExistingChunk: true,
|
|
priority: 1000,
|
|
enforce: true,
|
|
},
|
|
};
|