index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. exports.requeueComputedKeyAndDecorators = requeueComputedKeyAndDecorators;
  7. {
  8. {
  9. {
  10. exports.skipAllButComputedKey = function skipAllButComputedKey(path) {
  11. path.skip();
  12. if (path.node.computed) {
  13. path.context.maybeQueue(path.get("key"));
  14. }
  15. };
  16. }
  17. }
  18. }
  19. function requeueComputedKeyAndDecorators(path) {
  20. const {
  21. context,
  22. node
  23. } = path;
  24. if (node.computed) {
  25. context.maybeQueue(path.get("key"));
  26. }
  27. if (node.decorators) {
  28. for (const decorator of path.get("decorators")) {
  29. context.maybeQueue(decorator);
  30. }
  31. }
  32. }
  33. const visitor = {
  34. FunctionParent(path) {
  35. if (path.isArrowFunctionExpression()) {
  36. return;
  37. } else {
  38. path.skip();
  39. if (path.isMethod()) {
  40. requeueComputedKeyAndDecorators(path);
  41. }
  42. }
  43. },
  44. Property(path) {
  45. if (path.isObjectProperty()) {
  46. return;
  47. }
  48. path.skip();
  49. requeueComputedKeyAndDecorators(path);
  50. }
  51. };
  52. var _default = visitor;
  53. exports.default = _default;
  54. //# sourceMappingURL=index.js.map