UNPKG

1.07 kBPlain TextView Raw
1import type { ValidatedOptions } from "./validation/options";
2import getTargets from "@babel/helper-compilation-targets";
3
4import type { Targets } from "@babel/helper-compilation-targets";
5
6export function resolveBrowserslistConfigFile(
7 // eslint-disable-next-line @typescript-eslint/no-unused-vars
8 browserslistConfigFile: string,
9 // eslint-disable-next-line @typescript-eslint/no-unused-vars
10 configFilePath: string,
11): string | void {
12 return undefined;
13}
14
15export function resolveTargets(
16 options: ValidatedOptions,
17 // eslint-disable-next-line @typescript-eslint/no-unused-vars
18 root: string,
19): Targets {
20 // todo(flow->ts) remove any and refactor to not assign different types into same variable
21 let targets: any = options.targets;
22 if (typeof targets === "string" || Array.isArray(targets)) {
23 targets = { browsers: targets };
24 }
25 if (targets && targets.esmodules) {
26 targets = { ...targets, esmodules: "intersect" };
27 }
28
29 return getTargets(targets, {
30 ignoreBrowserslistConfig: true,
31 browserslistEnv: options.browserslistEnv,
32 });
33}