program-setup.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.program = void 0;
  6. var commander = _interopRequireWildcard(require("commander"), true);
  7. function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
  8. const program = exports.program = commander.default.program;
  9. function collect(value, previousValue) {
  10. if (typeof value !== "string") return previousValue;
  11. const values = value.split(",");
  12. if (previousValue) {
  13. previousValue.push(...values);
  14. return previousValue;
  15. }
  16. return values;
  17. }
  18. program.name("babel-node");
  19. program.option("-e, --eval [script]", "Evaluate script");
  20. program.option("--no-babelrc", "Specify whether or not to use .babelrc and .babelignore files");
  21. program.option("-r, --require [module]", "Require module");
  22. program.option("-p, --print [code]", "Evaluate script and print result");
  23. program.option("-o, --only [globs]", "A comma-separated list of glob patterns to compile", collect);
  24. program.option("-i, --ignore [globs]", "A comma-separated list of glob patterns to skip compiling", collect);
  25. program.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js,.es,.jsx,.mjs]", collect);
  26. program.option("--config-file [path]", "Path to the babel config file to use. Defaults to working directory babel.config.js");
  27. program.option("--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + "Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.");
  28. program.option("--root-mode [mode]", "The project-root resolution mode. " + "One of 'root' (the default), 'upward', or 'upward-optional'.");
  29. program.option("-w, --plugins [string]", "", collect);
  30. program.option("-b, --presets [string]", "", collect);
  31. {
  32. program.allowUnknownOption(true);
  33. }
  34. program.version("7.28.0");
  35. program.usage(`[options] [ -e "script" | script.js ] [--] [arguments]`);
  36. //# sourceMappingURL=program-setup.js.map