You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.4 KiB

5 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var util_1 = require("../lib/util");
  4. function getBabelOptions(options) {
  5. // The goal here is to tolerate as much syntax as possible, since Recast
  6. // is not in the business of forbidding anything. If you want your
  7. // parser to be more restrictive for some reason, you can always pass
  8. // your own parser object to recast.parse.
  9. return {
  10. sourceType: util_1.getOption(options, "sourceType", "module"),
  11. strictMode: util_1.getOption(options, "strictMode", false),
  12. allowImportExportEverywhere: true,
  13. allowReturnOutsideFunction: true,
  14. startLine: 1,
  15. tokens: true,
  16. plugins: [
  17. "asyncGenerators",
  18. "bigInt",
  19. "classPrivateMethods",
  20. "classPrivateProperties",
  21. "classProperties",
  22. "decorators-legacy",
  23. "doExpressions",
  24. "dynamicImport",
  25. "exportDefaultFrom",
  26. "exportExtensions",
  27. "exportNamespaceFrom",
  28. "functionBind",
  29. "functionSent",
  30. "importMeta",
  31. "nullishCoalescingOperator",
  32. "numericSeparator",
  33. "objectRestSpread",
  34. "optionalCatchBinding",
  35. "optionalChaining",
  36. ["pipelineOperator", { proposal: "minimal" }],
  37. "throwExpressions",
  38. ]
  39. };
  40. }
  41. exports.default = getBabelOptions;
  42. ;