1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.resolveBrowserslistConfigFile = resolveBrowserslistConfigFile;
|
---|
7 | exports.resolveTargets = resolveTargets;
|
---|
8 |
|
---|
9 | function _path() {
|
---|
10 | const data = require("path");
|
---|
11 |
|
---|
12 | _path = function () {
|
---|
13 | return data;
|
---|
14 | };
|
---|
15 |
|
---|
16 | return data;
|
---|
17 | }
|
---|
18 |
|
---|
19 | function _helperCompilationTargets() {
|
---|
20 | const data = require("@babel/helper-compilation-targets");
|
---|
21 |
|
---|
22 | _helperCompilationTargets = function () {
|
---|
23 | return data;
|
---|
24 | };
|
---|
25 |
|
---|
26 | return data;
|
---|
27 | }
|
---|
28 |
|
---|
29 | ({});
|
---|
30 |
|
---|
31 | function resolveBrowserslistConfigFile(browserslistConfigFile, configFileDir) {
|
---|
32 | return _path().resolve(configFileDir, browserslistConfigFile);
|
---|
33 | }
|
---|
34 |
|
---|
35 | function resolveTargets(options, root) {
|
---|
36 | let targets = options.targets;
|
---|
37 |
|
---|
38 | if (typeof targets === "string" || Array.isArray(targets)) {
|
---|
39 | targets = {
|
---|
40 | browsers: targets
|
---|
41 | };
|
---|
42 | }
|
---|
43 |
|
---|
44 | if (targets && targets.esmodules) {
|
---|
45 | targets = Object.assign({}, targets, {
|
---|
46 | esmodules: "intersect"
|
---|
47 | });
|
---|
48 | }
|
---|
49 |
|
---|
50 | const {
|
---|
51 | browserslistConfigFile
|
---|
52 | } = options;
|
---|
53 | let configFile;
|
---|
54 | let ignoreBrowserslistConfig = false;
|
---|
55 |
|
---|
56 | if (typeof browserslistConfigFile === "string") {
|
---|
57 | configFile = browserslistConfigFile;
|
---|
58 | } else {
|
---|
59 | ignoreBrowserslistConfig = browserslistConfigFile === false;
|
---|
60 | }
|
---|
61 |
|
---|
62 | return (0, _helperCompilationTargets().default)(targets, {
|
---|
63 | ignoreBrowserslistConfig,
|
---|
64 | configFile,
|
---|
65 | configPath: root,
|
---|
66 | browserslistEnv: options.browserslistEnv
|
---|
67 | });
|
---|
68 | } |
---|