index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. function _helperPluginUtils() {
  7. const data = require("@babel/helper-plugin-utils");
  8. _helperPluginUtils = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _pluginSyntaxOptionalCatchBinding() {
  14. const data = _interopRequireDefault(require("@babel/plugin-syntax-optional-catch-binding"));
  15. _pluginSyntaxOptionalCatchBinding = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21. var _default = (0, _helperPluginUtils().declare)(api => {
  22. api.assertVersion(7);
  23. return {
  24. name: "proposal-optional-catch-binding",
  25. inherits: _pluginSyntaxOptionalCatchBinding().default,
  26. visitor: {
  27. CatchClause(path) {
  28. if (!path.node.param) {
  29. const uid = path.scope.generateUidIdentifier("unused");
  30. const paramPath = path.get("param");
  31. paramPath.replaceWith(uid);
  32. }
  33. }
  34. }
  35. };
  36. });
  37. exports.default = _default;