main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 3 months ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | import type { ValidatedOptions } from "./validation/options.ts";
|
---|
2 | import getTargets, {
|
---|
3 | type InputTargets,
|
---|
4 | } from "@babel/helper-compilation-targets";
|
---|
5 |
|
---|
6 | import type { Targets } from "@babel/helper-compilation-targets";
|
---|
7 |
|
---|
8 | export function resolveBrowserslistConfigFile(
|
---|
9 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
---|
10 | browserslistConfigFile: string,
|
---|
11 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
---|
12 | configFilePath: string,
|
---|
13 | ): string | void {
|
---|
14 | return undefined;
|
---|
15 | }
|
---|
16 |
|
---|
17 | export function resolveTargets(
|
---|
18 | options: ValidatedOptions,
|
---|
19 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
---|
20 | root: string,
|
---|
21 | ): Targets {
|
---|
22 | const optTargets = options.targets;
|
---|
23 | let targets: InputTargets;
|
---|
24 |
|
---|
25 | if (typeof optTargets === "string" || Array.isArray(optTargets)) {
|
---|
26 | targets = { browsers: optTargets };
|
---|
27 | } else if (optTargets) {
|
---|
28 | if ("esmodules" in optTargets) {
|
---|
29 | targets = { ...optTargets, esmodules: "intersect" };
|
---|
30 | } else {
|
---|
31 | // https://github.com/microsoft/TypeScript/issues/17002
|
---|
32 | targets = optTargets as InputTargets;
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | return getTargets(targets, {
|
---|
37 | ignoreBrowserslistConfig: true,
|
---|
38 | browserslistEnv: options.browserslistEnv,
|
---|
39 | });
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.