_babel_options.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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: (0, util_1.getOption)(options, "sourceType", "module"),
  11. strictMode: (0, 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. "classStaticBlock",
  23. "decimal",
  24. "decorators-legacy",
  25. "doExpressions",
  26. "dynamicImport",
  27. "exportDefaultFrom",
  28. "exportExtensions",
  29. "exportNamespaceFrom",
  30. "functionBind",
  31. "functionSent",
  32. "importAssertions",
  33. "importMeta",
  34. "nullishCoalescingOperator",
  35. "numericSeparator",
  36. "objectRestSpread",
  37. "optionalCatchBinding",
  38. "optionalChaining",
  39. [
  40. "pipelineOperator",
  41. {
  42. proposal: "minimal",
  43. },
  44. ],
  45. [
  46. "recordAndTuple",
  47. {
  48. syntaxType: "hash",
  49. },
  50. ],
  51. "throwExpressions",
  52. "topLevelAwait",
  53. "v8intrinsic",
  54. ],
  55. };
  56. }
  57. exports.default = getBabelOptions;