babel-external-helpers.js 874 Bytes
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
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
"use strict";

function _commander() {
  const data = require("commander");

  _commander = function () {
    return data;
  };

  return data;
}

function _core() {
  const data = require("@babel/core");

  _core = function () {
    return data;
  };

  return data;
}

function collect(value, previousValue) {
  if (typeof value !== "string") return previousValue;
  const values = value.split(",");

  if (previousValue) {
    previousValue.push(...values);
    return previousValue;
  }

  return values;
}

_commander().option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);

_commander().option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");

_commander().usage("[options]");

_commander().parse(process.argv);

console.log((0, _core().buildExternalHelpers)(_commander().whitelist, _commander().outputType));