index.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 _regexpuCore() {
  14. const data = _interopRequireDefault(require("regexpu-core"));
  15. _regexpuCore = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. function regex() {
  21. const data = _interopRequireWildcard(require("@babel/helper-regex"));
  22. regex = function () {
  23. return data;
  24. };
  25. return data;
  26. }
  27. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
  28. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  29. var _default = (0, _helperPluginUtils().declare)(api => {
  30. api.assertVersion(7);
  31. return {
  32. name: "transform-dotall-regex",
  33. visitor: {
  34. RegExpLiteral(path) {
  35. const node = path.node;
  36. if (!regex().is(node, "s")) {
  37. return;
  38. }
  39. node.pattern = (0, _regexpuCore().default)(node.pattern, node.flags, {
  40. dotAllFlag: true,
  41. useUnicodeFlag: regex().is(node, "u")
  42. });
  43. regex().pullFlag(node, "s");
  44. }
  45. }
  46. };
  47. });
  48. exports.default = _default;