source: frontend/node_modules/@babel/traverse/lib/index.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.6 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6Object.defineProperty(exports, "Hub", {
7 enumerable: true,
8 get: function () {
9 return _hub.default;
10 }
11});
12Object.defineProperty(exports, "NodePath", {
13 enumerable: true,
14 get: function () {
15 return _index.default;
16 }
17});
18Object.defineProperty(exports, "Scope", {
19 enumerable: true,
20 get: function () {
21 return _index2.default;
22 }
23});
24exports.visitors = exports.default = void 0;
25require("./path/context.js");
26var visitors = require("./visitors.js");
27exports.visitors = visitors;
28var _t = require("@babel/types");
29var cache = require("./cache.js");
30var _traverseNode = require("./traverse-node.js");
31var _index = require("./path/index.js");
32var _index2 = require("./scope/index.js");
33var _hub = require("./hub.js");
34const {
35 VISITOR_KEYS,
36 removeProperties,
37 traverseFast
38} = _t;
39function traverse(parent, opts = {}, scope, state, parentPath, visitSelf) {
40 if (!parent) return;
41 if (!opts.noScope && !scope) {
42 if (parent.type !== "Program" && parent.type !== "File") {
43 throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.");
44 }
45 }
46 if (!parentPath && visitSelf) {
47 throw new Error("visitSelf can only be used when providing a NodePath.");
48 }
49 if (!VISITOR_KEYS[parent.type]) {
50 return;
51 }
52 visitors.explode(opts);
53 (0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath, undefined, visitSelf);
54}
55var _default = exports.default = traverse;
56traverse.visitors = visitors;
57traverse.verify = visitors.verify;
58traverse.explode = visitors.explode;
59traverse.cheap = function (node, enter) {
60 traverseFast(node, enter);
61 return;
62};
63traverse.node = function (node, opts, scope, state, path, skipKeys) {
64 (0, _traverseNode.traverseNode)(node, opts, scope, state, path, skipKeys);
65};
66traverse.clearNode = function (node, opts) {
67 removeProperties(node, opts);
68};
69traverse.removeProperties = function (tree, opts) {
70 traverseFast(tree, traverse.clearNode, opts);
71 return tree;
72};
73traverse.hasType = function (tree, type, denylistTypes) {
74 if (denylistTypes != null && denylistTypes.includes(tree.type)) return false;
75 if (tree.type === type) return true;
76 return traverseFast(tree, function (node) {
77 if (denylistTypes != null && denylistTypes.includes(node.type)) {
78 return traverseFast.skip;
79 }
80 if (node.type === type) {
81 return traverseFast.stop;
82 }
83 });
84};
85traverse.cache = cache;
86
87//# sourceMappingURL=index.js.map
Note: See TracBrowser for help on using the repository browser.