Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 52 53 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 19x 19x 19x 19x 19x 11x 11x 8x 8x 1x 25x 25x 25x 25x 3x 3x 25x 11x 11x 11x 25x 3x 3x 8x 8x | import type { BuildTarget } from '../rspack/build-target'; export type TargetPreset = 'compatible' | 'modern'; export type TargetSpec = TargetPreset | string[]; export type TargetSetting = | TargetSpec | Partial<Record<BuildTarget, TargetSpec>>; export const PRESET_TARGETS = { compatible: { client: ['chrome>=64', 'edge>=79', 'firefox>=67', 'safari>=11.1'], server: ['node>=24'], node: ['node>=24'] }, modern: { client: ['chrome>=89', 'edge>=89', 'firefox>=108', 'safari>=16.4'], server: ['node>=24'], node: ['node>=24'] } } as const; function resolveTargetSpec( spec: TargetSpec, buildTarget: BuildTarget ): string[] { if (typeof spec === 'string') { return [...PRESET_TARGETS[spec][buildTarget]]; } return spec; } export function getTargetSetting( setting: TargetSetting | undefined, buildTarget: BuildTarget ): string[] { if (!setting) { return [...PRESET_TARGETS.compatible[buildTarget]]; } if (typeof setting === 'string' || Array.isArray(setting)) { return resolveTargetSpec(setting, buildTarget); } const targetSpec = setting[buildTarget]; if (!targetSpec) { return [...PRESET_TARGETS.compatible[buildTarget]]; } return resolveTargetSpec(targetSpec, buildTarget); } |