PHP 8.2.30
Preview: context.js.map Size: 9.64 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@babel/traverse/lib/context.js.map

{"version":3,"names":["_index","require","_t","_context","_hub","VISITOR_KEYS","TraversalContext","constructor","scope","opts","state","parentPath","queue","priorityQueue","shouldVisit","node","enter","exit","type","keys","length","key","create","container","listKey","hub","Hub","undefined","NodePath","get","parent","maybeQueue","path","notPriority","push","visitMultiple","visitQueue","visitSingle","visited","WeakSet","stop","visitIndex","resync","call","contexts","pushContext","has","add","visit","i","popContext","nodes","Array","isArray","exports","default"],"sources":["../src/context.ts"],"sourcesContent":["import NodePath from \"./path/index.ts\";\nimport { VISITOR_KEYS } from \"@babel/types\";\nimport type Scope from \"./scope/index.ts\";\nimport type { ExplodedTraverseOptions } from \"./index.ts\";\nimport type * as t from \"@babel/types\";\nimport type { Visitor } from \"./types.ts\";\nimport { popContext, pushContext, resync } from \"./path/context.ts\";\nimport Hub from \"./hub.ts\";\n\nexport default class TraversalContext<S = unknown> {\n  constructor(\n    scope: Scope | null | undefined,\n    opts: ExplodedTraverseOptions<S>,\n    state: S,\n    parentPath: NodePath | undefined,\n  ) {\n    this.parentPath = parentPath;\n    this.scope = scope;\n    this.state = state;\n    this.opts = opts;\n  }\n\n  declare parentPath: NodePath | undefined;\n  declare scope: Scope | null | undefined;\n  declare state: S;\n  declare opts: ExplodedTraverseOptions<S>;\n  queue: NodePath[] | null = null;\n  priorityQueue: NodePath[] | null = null;\n\n  /**\n   * This method does a simple check to determine whether or not we really need to attempt\n   * visit a node. This will prevent us from constructing a NodePath.\n   */\n\n  shouldVisit(node: t.Node): boolean {\n    const opts = this.opts as Visitor;\n    if (opts.enter || opts.exit) return true;\n\n    // check if we have a visitor for this node\n    if (opts[node.type]) return true;\n\n    // check if we're going to traverse into this node\n    const keys: string[] | undefined = VISITOR_KEYS[node.type];\n    if (!keys?.length) return false;\n\n    // we need to traverse into this node so ensure that it has children to traverse into!\n    for (const key of keys) {\n      if (\n        // @ts-expect-error key is from visitor keys\n        node[key]\n      ) {\n        return true;\n      }\n    }\n\n    return false;\n  }\n\n  create(\n    node: t.Node,\n    container: t.Node | t.Node[],\n    key: string | number,\n    listKey?: string,\n  ): NodePath {\n    const { parentPath } = this;\n    const hub =\n      parentPath == null\n        ? node.type === \"Program\" || node.type === \"File\"\n          ? new Hub()\n          : undefined\n        : parentPath.hub;\n\n    // We don't need to `.setContext()` here, since `.visitQueue()` already\n    // calls `.pushContext`.\n    return NodePath.get({\n      parentPath,\n      parent: node,\n      container,\n      key: key,\n      listKey,\n      hub,\n    });\n  }\n\n  maybeQueue(path: NodePath, notPriority?: boolean) {\n    if (this.queue) {\n      if (notPriority) {\n        this.queue.push(path);\n      } else {\n        this.priorityQueue!.push(path);\n      }\n    }\n  }\n\n  visitMultiple(container: t.Node[], parent: t.Node, listKey: string) {\n    // nothing to traverse!\n    if (container.length === 0) return false;\n\n    const queue = [];\n\n    // build up initial queue\n    for (let key = 0; key < container.length; key++) {\n      const node = container[key];\n      if (node && this.shouldVisit(node)) {\n        queue.push(this.create(parent, container, key, listKey));\n      }\n    }\n\n    return this.visitQueue(queue);\n  }\n\n  visitSingle(node: t.Node, key: string): boolean {\n    if (\n      this.shouldVisit(\n        // @ts-expect-error key may not index node\n        node[key],\n      )\n    ) {\n      return this.visitQueue([this.create(node, node, key)]);\n    } else {\n      return false;\n    }\n  }\n\n  visitQueue(queue: NodePath[]): boolean {\n    // set queue\n    this.queue = queue;\n    this.priorityQueue = [];\n\n    const visited = new WeakSet();\n    let stop = false;\n    let visitIndex = 0;\n\n    // visit the queue\n    for (; visitIndex < queue.length; ) {\n      const path = queue[visitIndex];\n      visitIndex++;\n      resync.call(path);\n\n      // this path no longer belongs to the tree\n      if (process.env.BABEL_8_BREAKING && path.key === null) continue;\n\n      if (\n        path.contexts.length === 0 ||\n        path.contexts[path.contexts.length - 1] !== this\n      ) {\n        // The context might already have been pushed when this path was inserted and queued.\n        // If we always re-pushed here, we could get duplicates and risk leaving contexts\n        // on the stack after the traversal has completed, which could break things.\n        pushContext.call(path, this);\n      }\n\n      // this path no longer belongs to the tree\n      if (!process.env.BABEL_8_BREAKING && path.key === null) continue;\n\n      // ensure we don't visit the same node twice\n      const { node } = path;\n      if (visited.has(node)) continue;\n      if (node) visited.add(node);\n\n      if (path.visit()) {\n        stop = true;\n        break;\n      }\n\n      if (this.priorityQueue.length) {\n        stop = this.visitQueue(this.priorityQueue);\n        this.priorityQueue = [];\n        this.queue = queue;\n        if (stop) break;\n      }\n    }\n\n    // pop contexts\n    for (let i = 0; i < visitIndex; i++) {\n      if (process.env.BABEL_8_BREAKING && queue[i].key === null) continue;\n      popContext.call(queue[i]);\n    }\n\n    // clear queue\n    this.queue = null;\n\n    return stop;\n  }\n\n  visit(node: t.Node, key: string) {\n    // @ts-expect-error key may not index node\n    const nodes = node[key] as t.Node | t.Node[] | null;\n    if (!nodes) return false;\n\n    if (Array.isArray(nodes)) {\n      return this.visitMultiple(nodes, node, key);\n    } else {\n      return this.visitSingle(node, key);\n    }\n  }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAA2B;EANlBI;AAAY,IAAAH,EAAA;AAQN,MAAMI,gBAAgB,CAAc;EACjDC,WAAWA,CACTC,KAA+B,EAC/BC,IAAgC,EAChCC,KAAQ,EACRC,UAAgC,EAChC;IAAA,KAWFC,KAAK,GAAsB,IAAI;IAAA,KAC/BC,aAAa,GAAsB,IAAI;IAXrC,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACH,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;EAcAK,WAAWA,CAACC,IAAY,EAAW;IACjC,MAAMN,IAAI,GAAG,IAAI,CAACA,IAAe;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gB,WAAW,CAACtB,IAAI,EAAEM,GAAG,CAAC;IACpC;EACF;AACF;AAACiC,OAAA,CAAAC,OAAA,GAAAjD,gBAAA","ignoreList":[]}

Directory Contents

Dirs: 2 × Files: 14

Name Size Perms Modified Actions
path DIR
- drwxr-xr-x 2026-02-28 00:29:10
Edit Download
scope DIR
- drwxr-xr-x 2026-02-28 00:29:22
Edit Download
895 B lrw-r--r-- 2026-02-28 00:26:54
Edit Download
1.99 KB lrw-r--r-- 2026-02-28 00:27:06
Edit Download
3.16 KB lrw-r--r-- 2026-02-28 00:27:14
Edit Download
9.64 KB lrw-r--r-- 2026-02-28 00:27:26
Edit Download
373 B lrw-r--r-- 2026-02-28 00:27:34
Edit Download
1.12 KB lrw-r--r-- 2026-02-28 00:27:38
Edit Download
2.57 KB lrw-r--r-- 2026-02-28 00:27:46
Edit Download
6.60 KB lrw-r--r-- 2026-02-28 00:27:58
Edit Download
3.88 KB lrw-r--r-- 2026-02-28 00:29:22
Edit Download
11.05 KB lrw-r--r-- 2026-02-28 00:29:28
Edit Download
49 B lrw-r--r-- 2026-02-28 00:29:30
Edit Download
3.10 KB lrw-r--r-- 2026-02-28 00:29:32
Edit Download
7.70 KB lrw-r--r-- 2026-02-28 00:29:32
Edit Download
22.80 KB lrw-r--r-- 2026-02-28 00:29:34
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).