mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-03-22 23:30:36 +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 -->
28 lines
760 B
TypeScript
28 lines
760 B
TypeScript
export const SUPPORTED_BUNDLERS = ['webpack', 'rspack'] as const;
|
|
|
|
export type Bundler = (typeof SUPPORTED_BUNDLERS)[number];
|
|
|
|
export const DEFAULT_BUNDLER: Bundler = 'rspack';
|
|
|
|
function isBundler(value: string): value is Bundler {
|
|
return SUPPORTED_BUNDLERS.includes(value as Bundler);
|
|
}
|
|
|
|
export function normalizeBundler(input: string | undefined | null): Bundler {
|
|
const value = input?.trim().toLowerCase();
|
|
if (!value) {
|
|
return DEFAULT_BUNDLER;
|
|
}
|
|
if (isBundler(value)) {
|
|
return value;
|
|
}
|
|
|
|
throw new Error(
|
|
`Unsupported AFFINE_BUNDLER: "${input}". Expected one of: ${SUPPORTED_BUNDLERS.join(', ')}.`
|
|
);
|
|
}
|
|
|
|
export function getBundler(env: NodeJS.ProcessEnv = process.env): Bundler {
|
|
return normalizeBundler(env.AFFINE_BUNDLER);
|
|
}
|