index.js 737 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _helperPluginUtils = require("@babel/helper-plugin-utils");
  7. var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
  8. api.assertVersion("^7.0.0-0 || >8.0.0-alpha <8.0.0-beta");
  9. return {
  10. name: "transform-optional-catch-binding",
  11. manipulateOptions: (_, parser) => parser.plugins.push("optionalCatchBinding"),
  12. visitor: {
  13. CatchClause(path) {
  14. if (!path.node.param) {
  15. const uid = path.scope.generateUidIdentifier("unused");
  16. const paramPath = path.get("param");
  17. paramPath.replaceWith(uid);
  18. }
  19. }
  20. }
  21. };
  22. });
  23. //# sourceMappingURL=index.js.map