Sha256: 68fb5c8a4d491acd547872f7224869bff47d0d5a4a7a4490b85be92863ad84e7

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

// @flow

import typeof * as browserType from "./resolve-targets-browser";
import typeof * as nodeType from "./resolve-targets";

// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of index-browser, since this file may be replaced at bundle time with index-browser.
((({}: any): $Exact<browserType>): $Exact<nodeType>);

import type { ValidatedOptions } from "./validation/options";
import path from "path";
import getTargets, { type Targets } from "@babel/helper-compilation-targets";

export function resolveTargets(
  options: ValidatedOptions,
  root: string,
  filename: string | void,
): Targets {
  let { targets } = options;
  if (typeof targets === "string" || Array.isArray(targets)) {
    targets = { browsers: targets };
  }
  // $FlowIgnore it thinks that targets.esmodules doesn't exist.
  if (targets && targets.esmodules) {
    targets = { ...targets, esmodules: "intersect" };
  }

  let configFile;
  if (typeof options.browserslistConfigFile === "string") {
    configFile = path.resolve(root, options.browserslistConfigFile);
  }

  return getTargets((targets: any), {
    ignoreBrowserslistConfig: options.browserslistConfigFile === false,
    configFile,
    configPath: filename ?? root,
    browserslistEnv: options.browserslistEnv,
  });
}

Version data entries

4 entries across 3 versions & 2 rubygems

Version Path
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/@babel/core/src/config/resolve-targets.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/@babel/core/src/config/resolve-targets.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/@babel/core/src/config/resolve-targets.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/@babel/core/src/config/resolve-targets.js